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

[Segment Replication] Ingestion round removes previously ingested documents #5969

Closed
dreamer-89 opened this issue Jan 22, 2023 · 2 comments
Closed
Labels
bug Something isn't working distributed framework

Comments

@dreamer-89
Copy link
Member

Describe the bug
While working on #5946, identified scenario where documents ingested in current round removes all documents ingested previously. This might be potential data loss issue, so filing the bug.

To Reproduce
This issue appears pretty reliably with below integration test.

    public void testMultipleIngestions() throws Exception {
        final String primary = internalCluster().startNode();
        createIndex(INDEX_NAME);
        final String replica = internalCluster().startNode();
        ensureGreen(INDEX_NAME);

        // First round of ingestion
        final int initialDocCount = 500;
        ingestDocs(initialDocCount);
        refresh(INDEX_NAME);
        waitForReplicaUpdate();
        assertDocCounts(initialDocCount, replica, primary); // Test assertion passes here i.e. documents are searchable at this point

        // Second round of ingestion
        ingestDocs(2 * initialDocCount);
        ensureGreen(INDEX_NAME);
        flushAndRefresh(INDEX_NAME);
        waitForReplicaUpdate();
        assertDocCounts(3 * initialDocCount, replica, primary); // --> Test fails here with actual document count = 2 * initialdocCount
    }

Expected behavior
The total document count should match with documents ingested.

Host/Environment (please complete the following information):

  • OS: iOS
  • Version: main
@dreamer-89 dreamer-89 added bug Something isn't working untriaged labels Jan 22, 2023
@dreamer-89 dreamer-89 changed the title [Segment Replication] [BUG] Document override previous ingestion [Segment Replication] [BUG] Ingestion round removes previously ingested documents Jan 22, 2023
@anasalkouz anasalkouz changed the title [Segment Replication] [BUG] Ingestion round removes previously ingested documents [Segment Replication] Ingestion round removes previously ingested documents Feb 9, 2023
@mch2
Copy link
Member

mch2 commented Feb 9, 2023

@dreamer-89. I'm not sure what the implementation of ingestDocs is doing in this test, is it tracking the id used between rounds guaranteeing they are unique? This test is ingesting 500 docs, waiting for replica to update then ingesting 1000 docs. Based on the result it looks to me that it is resetting the id each time, so i'd expect only 1k docs, with 500 goign through an update. Perhaps you can check latest op seqno at the end?

@mch2
Copy link
Member

mch2 commented Feb 9, 2023

I think its from SegmentReplicationSnapshotIT? In which case every invocation will create a new bg indexer starting from 0 doc id.

    public void ingestData(int docCount, String indexName) throws Exception {
        try (
            BackgroundIndexer indexer = new BackgroundIndexer(
                indexName,
                "_doc",
                client(),
                -1,
                RandomizedTest.scaledRandomIntBetween(2, 5),
                false,
                random()
            )
        ) {
            indexer.start(docCount);
            waitForDocs(docCount, indexer);
            refresh(indexName);
        }
    }

@mch2 mch2 closed this as not planned Won't fix, can't repro, duplicate, stale Feb 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working distributed framework
Projects
Status: Done
Development

No branches or pull requests

3 participants