Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added data operation failure table and a partially succesful status X… #388

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

gcsantos-gpa
Copy link
Contributor

@gcsantos-gpa gcsantos-gpa commented Nov 18, 2024

XDA-49

@@ -234,6 +234,7 @@ private void Process(FileGroup fileGroup, Meter meter)
configurator(reader);

MeterDataSet meterDataSet = reader.Parse(fileGroup);
FileGroupProcessingStatus processingStatus = FileGroupProcessingStatus.Failed;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously if (meterDataSet is null) it would got into FileGroupProcessingStatus.Processed state while now it will remain in Failed that seems to be an issue. Technically I am not sure who frequent that is since it should not reach the AnalysisNode in most cases but I think there is a potential for issues here.

try
{
if (IsDisposed)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am pretty sure this will generate multiple failures now. Previously IsDisposed caused it to exit the Process function completly. Now it will move on to the next dataOperationDefinition . Because IsDisposed is global for all dataOperationDefinigitons we end up with the same error message multiple times. at the very least we should prevent that

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will still exit the function completely, but only after logging the exception in the data operation failure. When we catch the exception on line 319, there is a block that checks IsDisposed on line 334. If we are, we return out of the function, and never move onto another definition.

Comment on lines +315 to +317
if (index == 0) status = FileGroupProcessingStatus.Success;
else if (status == FileGroupProcessingStatus.Failed) status = FileGroupProcessingStatus.PartialSuccess;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic seems off.
If it has 3 dataOperationDefinitions (and all suceed) it will go:
from Failure to Success in index = 0
not change in index = 1 and index = 2

But if the last one fails it will go
from Failure to Success in index = 0
not change in index = 1 and
from Success to Failure in index = 2 which is not correct.

Copy link
Contributor Author

@gcsantos-gpa gcsantos-gpa Jan 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the current code, on failure it should either
Be in Failure or Partial Success, in either case things shouldn't change.
Be in Success and go to Partial Success, as is the case on line 323.

In the case you highlighted, the code I believe it is doing the following.
Go from Failure to Success in index = 0 (line 315)
Not change in index = 1 (line 315-316, neither condition should be met)
Go from Success to Partial Success in index = 2 (line 323)

StackTrace = ex.StackTrace,
TimeOfFailure = DateTime.UtcNow
});
if (IsDisposed)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we dispose we need to consider the entire Processing Failed.
PartialSuccess should only apply to failures inside

 meterDataSet.Configure(dataOperation);
 dataOperation.Execute(meterDataSet);

If the underlying infrastiurcture AnalysisNode fails that is considered a complete failure since It will not even attepmt to run the rest of the analytics

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense, updated.

}

FileGroup fileGroup = meterDataSet.FileGroup;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removing that seems problematic - though it could be a result of Github not aligning changes well. Is that still in there somewhere

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It got moved up into line 275

Comment on lines 351 to 366
private void LogDataOperationFailures(IEnumerable<DataOperationFailure> failures)
{
using (AdoDataConnection connection = CreateDbConnection())
{
TableOperations<DataOperationFailure> failureTable = new TableOperations<DataOperationFailure>(connection);
foreach (DataOperationFailure failure in failures)
failureTable.AddNewRecord(failure);
}

}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to make sure if that table is missing it does not take everything down with it.
Probably should tunr this into TryLogDataOperationFailures and wrap everything in a try/catch with a standard log if it fails.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good suggestion, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants