bug5574: send ImportMasterDataOperation first, then apply locally

This commit is contained in:
Axel Uhl committed 2021-06-22 14:04:38 +02:00
1 parent bf3edc0860
commit 4bbdffaf74
2 files changed
+23 -1

No files matched your search

@@ -112,6 +112,26 @@ public class ImportMasterDataOperation extends
this.connectivityParametersToRestore = masterData.getConnectivityParametersToRestore();
}
/**
* Operations of this type are expected to be explicitly sent out <em>before</em> the operation is applied locally on
* the master server. This is important because otherwise tracking-related operations may be sent out before the
* structures for regattas, events, etc. have been replicated. This also holds for the "reverse" replication direction
* from a replica to a master. See also bug5574.
*/
@Override
public boolean isRequiresExplicitTransitiveReplication() {
return false;
}
@Override
protected Object clone() throws CloneNotSupportedException {
// TODO Implement ImportMasterDataOperation.clone(...)
return super.clone();
}
@Override
public MasterDataImportObjectCreationCountImpl internalApplyTo(RacingEventService toState) throws Exception {
final DataImportLockWithProgress dataImportLock = toState.getDataImportLock();
@@ -421,7 +441,7 @@ public class ImportMasterDataOperation extends
&& Util.equalsWithNull(fix.getPosition(), existingFix.getPosition()))) {
windTrackToWriteTo.add(fix);
} else {
logger.info("Didn't add wind fix in import, because equal fix was already there.");
logger.fine("Didn't add wind fix in import, because equal fix was already there.");
}
}
} finally {
@@ -115,6 +115,8 @@ public class MasterDataImporter {
MasterDataImportObjectCreationCountImpl creationCount = new MasterDataImportObjectCreationCountImpl();
ImportMasterDataOperation op = new ImportMasterDataOperation(topLevelMasterData, importOperationId, override,
creationCount, user, tenant);
// replicate explicitly first and let isRequiresExplicitTransitiveReplication return false; see also bug5574
racingEventService.replicate(op);
creationCount = racingEventService.apply(op);
return creationCount;
}