Skip to content

Commit

Permalink
Revert test changes made for combined classes
Browse files Browse the repository at this point in the history
Signed-off-by: Sachin Kale <[email protected]>
  • Loading branch information
Sachin Kale committed Sep 3, 2024
1 parent 7b9957c commit d63200e
Showing 1 changed file with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -679,13 +679,13 @@ public void testSimpleOperationsUpload() throws Exception {
assertThat(snapshot.totalOperations(), equalTo(ops.size()));
}

assertEquals(2, translog.allUploaded().size());
assertEquals(4, translog.allUploaded().size());

addToTranslogAndListAndUpload(translog, ops, new Translog.Index("1", 1, primaryTerm.get(), new byte[] { 1 }));
assertEquals(4, translog.allUploaded().size());
assertEquals(6, translog.allUploaded().size());

translog.rollGeneration();
assertEquals(4, translog.allUploaded().size());
assertEquals(6, translog.allUploaded().size());

Set<String> mdFiles = blobStoreTransferService.listAll(getTranslogDirectory().add(METADATA_DIR));
assertEquals(2, mdFiles.size());
Expand Down Expand Up @@ -744,7 +744,7 @@ public void testSimpleOperationsUpload() throws Exception {
assertBusy(() -> assertTrue(translog.isRemoteGenerationDeletionPermitsAvailable()));
assertEquals(1, translog.readers.size());
assertBusy(() -> {
assertEquals(2, translog.allUploaded().size());
assertEquals(4, translog.allUploaded().size());
assertEquals(
4,
blobStoreTransferService.listAll(getTranslogDirectory().add(DATA_DIR).add(String.valueOf(primaryTerm.get()))).size()
Expand All @@ -763,7 +763,7 @@ public void testSimpleOperationsUpload() throws Exception {
assertEquals(1, translog.readers.size());
assertEquals(1, translog.stats().estimatedNumberOfOperations());
assertBusy(() -> {
assertEquals(2, translog.allUploaded().size());
assertEquals(4, translog.allUploaded().size());
assertEquals(
4,
blobStoreTransferService.listAll(getTranslogDirectory().add(DATA_DIR).add(String.valueOf(primaryTerm.get()))).size()
Expand All @@ -782,7 +782,7 @@ public void testMetadataFileDeletion() throws Exception {
assertBusy(() -> assertTrue(translog.isRemoteGenerationDeletionPermitsAvailable()));
assertEquals(1, translog.readers.size());
}
assertBusy(() -> assertEquals(2, translog.allUploaded().size()));
assertBusy(() -> assertEquals(4, translog.allUploaded().size()));
assertBusy(() -> assertEquals(1, blobStoreTransferService.listAll(getTranslogDirectory().add(METADATA_DIR)).size()));
int moreDocs = randomIntBetween(3, 10);
logger.info("numDocs={} moreDocs={}", numDocs, moreDocs);
Expand Down Expand Up @@ -880,7 +880,7 @@ public void testDrainSync() throws Exception {
assertBusy(() -> assertEquals(0, latch.getCount()));
assertEquals(0, translog.availablePermits());
slowDown.setSleepSeconds(0);
assertEquals(4, translog.allUploaded().size());
assertEquals(6, translog.allUploaded().size());
assertEquals(2, translog.readers.size());
Set<String> mdFiles = blobStoreTransferService.listAll(getTranslogDirectory().add(METADATA_DIR));

Expand All @@ -889,7 +889,7 @@ public void testDrainSync() throws Exception {
translog.trimUnreferencedReaders();
assertBusy(() -> assertTrue(translog.isRemoteGenerationDeletionPermitsAvailable()));
assertEquals(1, translog.readers.size());
assertEquals(2, translog.allUploaded().size());
assertEquals(6, translog.allUploaded().size());
assertEquals(mdFiles, blobStoreTransferService.listAll(getTranslogDirectory().add(METADATA_DIR)));

// Case 4 - After drainSync, if an upload is an attempted, we do not upload to remote store.
Expand All @@ -899,21 +899,21 @@ public void testDrainSync() throws Exception {
new Translog.Index(String.valueOf(2), 2, primaryTerm.get(), new byte[] { 1 })
);
assertEquals(1, translog.readers.size());
assertEquals(2, translog.allUploaded().size());
assertEquals(6, translog.allUploaded().size());
assertEquals(mdFiles, blobStoreTransferService.listAll(getTranslogDirectory().add(METADATA_DIR)));

// Refill the permits back
Releasables.close(releasable);
addToTranslogAndListAndUpload(translog, ops, new Translog.Index(String.valueOf(3), 3, primaryTerm.get(), new byte[] { 1 }));
assertEquals(2, translog.readers.size());
assertEquals(4, translog.allUploaded().size());
assertEquals(8, translog.allUploaded().size());
assertEquals(3, blobStoreTransferService.listAll(getTranslogDirectory().add(METADATA_DIR)).size());

translog.setMinSeqNoToKeep(3);
translog.trimUnreferencedReaders();
assertBusy(() -> assertTrue(translog.isRemoteGenerationDeletionPermitsAvailable()));
assertEquals(1, translog.readers.size());
assertBusy(() -> assertEquals(2, translog.allUploaded().size()));
assertBusy(() -> assertEquals(4, translog.allUploaded().size()));
assertBusy(() -> assertEquals(1, blobStoreTransferService.listAll(getTranslogDirectory().add(METADATA_DIR)).size()));
}

Expand Down

0 comments on commit d63200e

Please sign in to comment.