Skip to content
Snippets Groups Projects
Commit a5b996d5 authored by jakubs's avatar jakubs
Browse files

BIS-376 SP-574 Add error during prepare phase should also trigger rollback_pre_registration

SVN: 28666
parent 6b499389
No related branches found
No related tags found
No related merge requests found
...@@ -304,6 +304,12 @@ public class DataSetStorageAlgorithm<T extends DataSetInformation> ...@@ -304,6 +304,12 @@ public class DataSetStorageAlgorithm<T extends DataSetInformation>
*/ */
public void transitionToRolledbackState(Throwable throwable) public void transitionToRolledbackState(Throwable throwable)
{ {
// Rollback in initialized state means that preparation has failed.
if (state instanceof InitializedState)
{
return;
}
// Rollback may be called on in the precommit state or in the prepared state. // Rollback may be called on in the precommit state or in the prepared state.
if (state instanceof PreparedState) if (state instanceof PreparedState)
{ {
...@@ -328,8 +334,14 @@ public class DataSetStorageAlgorithm<T extends DataSetInformation> ...@@ -328,8 +334,14 @@ public class DataSetStorageAlgorithm<T extends DataSetInformation>
public void transitionToUndoneState() public void transitionToUndoneState()
{ {
// Rollback may be called on in the stored state or in the prepared state. In the prepared // Rollback may be called on in the stored state or in the prepared/initialized state. In
// state, there is nothing to do. // the prepared state, there is nothing to do.
if (state instanceof InitializedState)
{
state = new PreparedState<T>((InitializedState<T>) state);
}
if (state instanceof PreparedState) if (state instanceof PreparedState)
{ {
state = new UndoneState<T>((PreparedState<T>) state); state = new UndoneState<T>((PreparedState<T>) state);
...@@ -690,10 +702,13 @@ public class DataSetStorageAlgorithm<T extends DataSetInformation> ...@@ -690,10 +702,13 @@ public class DataSetStorageAlgorithm<T extends DataSetInformation>
*/ */
private void cleanUpMarkerFile() private void cleanUpMarkerFile()
{ {
getFileOperations().delete(markerFile); if (markerFile != null && markerFile.exists())
if (markerFile.exists())
{ {
operationLog.error("Marker file '" + markerFile + "' could not be deleted."); getFileOperations().delete(markerFile);
if (markerFile.exists())
{
operationLog.error("Marker file '" + markerFile + "' could not be deleted.");
}
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment