Skip to content

Composite recovery tests - #5

Open
Bukhtawar wants to merge 1 commit into
ask-kamal-nayan:dataformat-aware-replicationfrom
Bukhtawar:composite-recovery-tests
Open

Composite recovery tests#5
Bukhtawar wants to merge 1 commit into
ask-kamal-nayan:dataformat-aware-replicationfrom
Bukhtawar:composite-recovery-tests

Conversation

@Bukhtawar

@Bukhtawar Bukhtawar commented May 19, 2026

Copy link
Copy Markdown

Description

─────────────────────────────────────────────────────────┬───────────────────────────────────────────────┐
  │                          Test                           │                    Result                     │
  ├─────────────────────────────────────────────────────────┼───────────────────────────────────────────────┤
  │ CompositeRecoveryIT                                     │                                               │
  ├─────────────────────────────────────────────────────────┼───────────────────────────────────────────────┤
  │ testLocalRecoveryPreservesBothFormats                   │ PASSED                                        │
  ├─────────────────────────────────────────────────────────┼───────────────────────────────────────────────┤
  │ testTranslogReplayGenerationAdvances                    │ FAILED — expected 26, got 52 (2x duplication) │
  ├─────────────────────────────────────────────────────────┼───────────────────────────────────────────────┤
  │ testRecoveryAfterMerge                                  │ PASSED                                        │
  ├─────────────────────────────────────────────────────────┼───────────────────────────────────────────────┤
  │ testMultipleRestartCycles                               │ FAILED — expected 41, got 82 (2x duplication) │
  ├─────────────────────────────────────────────────────────┼───────────────────────────────────────────────┤
  │ CompositeRecoveryCrashResilienceIT                      │                                               │
  ├─────────────────────────────────────────────────────────┼───────────────────────────────────────────────┤
  │ testNoOrphanedParquetFilesAfterRecovery                 │ PASSED                                        │
  ├─────────────────────────────────────────────────────────┼───────────────────────────────────────────────┤
  │ testWriterGenerationDoesNotCollideAfterCrashMidIndexing │ FAILED — generation 2 == 2 (no advance)       │
  ├─────────────────────────────────────────────────────────┼───────────────────────────────────────────────┤
  │ testWriterGenerationMonotonicallyIncreases              │ PASSED                                        │
  ├─────────────────────────────────────────────────────────┼───────────────────────────────────────────────┤
  │ CompositeRemoteStoreRecoveryIT                          │                                               │
  ├─────────────────────────────────────────────────────────┼───────────────────────────────────────────────┤
  │ testRemoteStoreRecoveryPreservesBothFormats             │ PASSED                                        │
  ├─────────────────────────────────────────────────────────┼───────────────────────────────────────────────┤
  │ testGenerationAdvancesAfterRemoteStoreRecovery          │ PASSED                                        │
  ├─────────────────────────────────────────────────────────┼───────────────────────────────────────────────┤
  │ testTranslogReplayDoesNotDuplicateRowsWithRemoteStore   │ FAILED — expected 19, got 38 (2x duplication) │
  └─────────────────────────────────────────────────────────┴───────────────────────────────────────────────┘

Related Issues

Resolves # opensearch-project#21311

Check List

  • Functionality includes testing.
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@Bukhtawar
Bukhtawar force-pushed the composite-recovery-tests branch from 43600ba to d6b7830 Compare May 19, 2026 10:29
Tests validate data integrity across restart, translog replay, and merge
for the composite (Parquet + Lucene) engine.

Findings:
- testTranslogReplayGenerationAdvances: FAILS — translog replay duplicates
  rows already committed to Parquet (expected 26, got 52). Parquet has no
  dedup mechanism equivalent to Lucene's soft-delete seq_no handling.
- testMultipleRestartCycles: FAILS — same duplication compounds across
  restarts (row count doubles each cycle).
- testWriterGenerationDoesNotCollideAfterCrashMidIndexing: FAILS — writer
  generation counter does not advance past committed max after recovery,
  risking collision with orphaned files from a prior failed attempt.

Passing tests:
- testLocalRecoveryPreservesBothFormats: both formats survive clean restart
- testRecoveryAfterMerge: merged state (both formats) survives restart
- testNoOrphanedParquetFilesAfterRecovery: no orphans after clean restart
- testWriterGenerationMonotonicallyIncreases: generation advances correctly
  for new writes after restart

Signed-off-by: Bukhtawar Khan <bukhtawa@amazon.com>
@Bukhtawar
Bukhtawar force-pushed the composite-recovery-tests branch from d6b7830 to 7570d86 Compare May 19, 2026 10:37
* Flush commits both formats, remote store uploads both via DataFormatAwareRemoteDirectory.
* After restart, remote store downloads both and engine opens correctly.
*/
public void testRemoteStoreRecoveryPreservesBothFormats() throws Exception {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is covered via DataFormatAwareRemoteStoreRecoveryIT#testRemoteStoreRecoveryPreservesFormatMetadata

* the committed catalog snapshot. Any unreferenced file is an orphan from a
* prior crashed flush/replay — evidence that cleanup is missing.
*/
public void testNoOrphanedParquetFilesAfterRecovery() throws Exception {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This overlaps with testReplicaStartupCleansOrphanFiles

* exist outside the catalog snapshot, which would indicate a generation collision risk.
*/
@OpenSearchIntegTestCase.ClusterScope(scope = OpenSearchIntegTestCase.Scope.TEST, numDataNodes = 1)
public class CompositeRecoveryCrashResilienceIT extends AbstractCompositeEngineIT {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This overlaps with DataFormatAwareReplicaResilienceIT
Could you combine?

* Verifies that the writer generation counter is recovered from the catalog
* snapshot and starts ABOVE any existing file's generation.
*/
public void testWriterGenerationMonotonicallyIncreases() throws Exception {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to overlap with testPromotionWithInFlightRemoteStoreUpload

* Create many small segments via repeated flush. Trigger merge. Restart.
* Verify data integrity (row count) survives the merge + restart cycle.
*/
public void testRecoveryAfterMerge() throws Exception {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has overlap with testQueryResultsIdenticalAfterForceMergeAndRestart (latter is already testing search as well)

Comment on lines +76 to +89
Set<String> parquetFilesOnDisk = getParquetFilesOnDisk();
Set<String> catalogFilesAfterRecovery = getCatalogReferencedParquetFiles();

// Every Parquet file on disk must be in the catalog snapshot.
// Any file on disk but NOT in the catalog is an orphan.
Set<String> orphans = new HashSet<>(parquetFilesOnDisk);
orphans.removeAll(catalogFilesAfterRecovery);

assertTrue(
"Found orphaned Parquet files not referenced by catalog snapshot after recovery: " + orphans
+ ". These could collide with new writer generations on subsequent translog replays.",
orphans.isEmpty()
);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be flaky due to background merges.
empty parquet files are created during merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants