Skip to content

Commit 625b66c

Browse files
committed
At genesis, first check indexing type, then heartbeat
1 parent 521c836 commit 625b66c

File tree

1 file changed

+5
-5
lines changed
  • fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/provider/foundationdb

1 file changed

+5
-5
lines changed

fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/provider/foundationdb/IndexingBase.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -363,18 +363,18 @@ private CompletableFuture<Void> setIndexingTypeOrThrow(FDBRecordStore store, boo
363363
IndexBuildProto.IndexBuildIndexingStamp indexingTypeStamp = getIndexingTypeStamp(store);
364364
heartbeat = new IndexingHeartbeat(common.getIndexerId(), indexingTypeStamp.getMethod(), common.config.getLeaseLengthMillis());
365365

366-
return forEachTargetIndex(index -> setIndexingTypeOrThrow(store, continuedBuild, index, indexingTypeStamp));
366+
return forEachTargetIndex(index -> setIndexingTypeOrThrow(store, continuedBuild, index, indexingTypeStamp)
367+
.thenApply(ignore -> updateHeartbeat(true, store, index)));
367368
}
368369

369370
@Nonnull
370371
private CompletableFuture<Void> setIndexingTypeOrThrow(FDBRecordStore store, boolean continuedBuild, Index index, IndexBuildProto.IndexBuildIndexingStamp newStamp) {
371-
final CompletableFuture<Void> checkUpdateHeartbeat = updateHeartbeat(true, store, index);
372372
if (forceStampOverwrite && !continuedBuild) {
373373
// Fresh session + overwrite = no questions asked
374374
store.saveIndexingTypeStamp(index, newStamp);
375-
return checkUpdateHeartbeat;
375+
return AsyncUtil.DONE ;
376376
}
377-
return checkUpdateHeartbeat.thenCompose(ignore -> store.loadIndexingTypeStampAsync(index)
377+
return store.loadIndexingTypeStampAsync(index)
378378
.thenCompose(savedStamp -> {
379379
if (savedStamp == null) {
380380
if (continuedBuild && newStamp.getMethod() !=
@@ -416,7 +416,7 @@ private CompletableFuture<Void> setIndexingTypeOrThrow(FDBRecordStore store, boo
416416
}
417417
// fall down to exception
418418
throw newPartlyBuiltException(continuedBuild, savedStamp, newStamp, index);
419-
}));
419+
});
420420
}
421421

422422
private boolean shouldAllowTypeConversionContinue(IndexBuildProto.IndexBuildIndexingStamp newStamp, IndexBuildProto.IndexBuildIndexingStamp savedStamp) {

0 commit comments

Comments
 (0)