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

Enhance CheckpointState to support no-op replication #5447

Closed
wants to merge 20 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add UTs
Signed-off-by: Ashish Singh <ssashish@amazon.com>
  • Loading branch information
ashking94 committed Dec 1, 2022
commit 8318e784bfc3bd0dfba2de4f180e8b5ebbefb5a6
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,32 @@ public void testMissingInSyncIdsPreventAdvance() {
assertThat(updatedGlobalCheckpoint.get(), not(equalTo(UNASSIGNED_SEQ_NO)));
}

public void testMissingInSyncIdsDoesNotPreventAdvanceWithRemoteTranslogEnabled() {
final Map<AllocationId, Long> active = randomAllocationsWithLocalCheckpoints(1, 5);
final Map<AllocationId, Long> initializing = randomAllocationsWithLocalCheckpoints(2, 5);
logger.info("active: {}, initializing: {}", active, initializing);

AllocationId primaryId = active.keySet().iterator().next();
Settings settings = Settings.builder().put("index.remote_store.translog.enabled", "true").build();
final ReplicationTracker tracker = newTracker(primaryId, settings);
tracker.updateFromClusterManager(randomNonNegativeLong(), ids(active.keySet()), routingTable(initializing.keySet(), primaryId));
tracker.activatePrimaryMode(NO_OPS_PERFORMED);
randomSubsetOf(randomIntBetween(1, initializing.size() - 1), initializing.keySet()).forEach(
aId -> markAsTrackingAndInSyncQuietly(tracker, aId.getId(), NO_OPS_PERFORMED)
);
long primaryLocalCheckpoint = active.get(primaryId);

active.forEach((aid, localCP) -> updateLocalCheckpoint(tracker, aid.getId(), localCP));

assertEquals(tracker.getGlobalCheckpoint(), primaryLocalCheckpoint);
assertEquals(updatedGlobalCheckpoint.get(), primaryLocalCheckpoint);

// update again
initializing.forEach((aid, localCP) -> updateLocalCheckpoint(tracker, aid.getId(), localCP));
assertEquals(tracker.getGlobalCheckpoint(), primaryLocalCheckpoint);
assertEquals(updatedGlobalCheckpoint.get(), primaryLocalCheckpoint);
}

public void testInSyncIdsAreIgnoredIfNotValidatedByClusterManager() {
final Map<AllocationId, Long> active = randomAllocationsWithLocalCheckpoints(1, 5);
final Map<AllocationId, Long> initializing = randomAllocationsWithLocalCheckpoints(1, 5);
Expand Down