Permalink
Browse files

fixing race condition in ShardCoordinator

  • Loading branch information...
1 parent 64678be commit f603b64f44a38e7cd09a03c81f0b7cd9322f75b6 @ssandler ssandler committed Feb 14, 2013
Showing with 10 additions and 9 deletions.
  1. +10 −9 TeslaSQL/Agents/ShardCoordinator.cs
View
19 TeslaSQL/Agents/ShardCoordinator.cs
@@ -48,16 +48,17 @@ public ShardCoordinator(IDataUtils dataUtils, Logger logger)
}
logger.Log("Working on CTID " + batch.CTID, LogLevel.Info);
- tableDBFieldLists = GetFieldListsByDB(batch.CTID);
- if (SchemasOutOfSync(tableDBFieldLists.Values)) {
- foreach (var sd in shardDatabases) {
- sourceDataUtils.RevertCTBatch(sd, batch.CTID);
- }
- logger.Log("Schemas out of sync, quitting", LogLevel.Info);
- return;
- }
if (AllShardMastersDone(batch)) {
- logger.Log("All shard masters are done; consolidating", LogLevel.Info);
+ logger.Log("All shard masters are done, checking field lists", LogLevel.Info);
+ tableDBFieldLists = GetFieldListsByDB(batch.CTID);
+ if (SchemasOutOfSync(tableDBFieldLists.Values)) {
+ foreach (var sd in shardDatabases) {
+ sourceDataUtils.RevertCTBatch(sd, batch.CTID);
+ }
+ logger.Log("Schemas out of sync, quitting", LogLevel.Info);
+ return;
+ }
+ logger.Log("Field lists in sync, consolidating", LogLevel.Info);
Consolidate(batch);
sourceDataUtils.WriteBitWise(Config.RelayDB, batch.CTID,
Convert.ToInt32(SyncBitWise.CaptureChanges) | Convert.ToInt32(SyncBitWise.UploadChanges), AgentType.ShardCoordinator);

0 comments on commit f603b64

Please sign in to comment.