mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-25 06:16:40 +00:00
Only assert single commit iff index created on 6.2
We introduced a single commit assertion when opening an index but create a new translog. However, this assertion is not held in this situation. 1. A replica with two commits c1 and c2 starts peer-recovery with c1 2. The recovery is sequence-based recovery but the primary is before 6.2 so it sent true for “createNewTranslog” 3. Replica opens engine and create translog. We expect "open index and create translog" have 1 commit but we have c1 and c2. This commit makes sure to assert this iff the index was created on 6.2+.
This commit is contained in:
parent
80a7943d6a
commit
7847cded80
@ -1298,8 +1298,11 @@ public class IndexShard extends AbstractIndexShardComponent implements IndicesCl
|
||||
assert commitInfo.localCheckpoint >= globalCheckpoint :
|
||||
"trying to create a shard whose local checkpoint [" + commitInfo.localCheckpoint + "] is < global checkpoint ["
|
||||
+ globalCheckpoint + "]";
|
||||
final List<IndexCommit> existingCommits = DirectoryReader.listCommits(store.directory());
|
||||
assert existingCommits.size() == 1 : "Open index create translog should have one commit, commits[" + existingCommits + "]";
|
||||
// This assertion is only guaranteed if all nodes are on 6.2+.
|
||||
if (indexSettings.getIndexVersionCreated().onOrAfter(Version.V_6_2_0)) {
|
||||
final List<IndexCommit> existingCommits = DirectoryReader.listCommits(store.directory());
|
||||
assert existingCommits.size() == 1 : "Open index create translog should have one commit, commits[" + existingCommits + "]";
|
||||
}
|
||||
}
|
||||
globalCheckpointTracker.updateGlobalCheckpointOnReplica(globalCheckpoint, "opening index with a new translog");
|
||||
innerOpenEngineAndTranslog(EngineConfig.OpenMode.OPEN_INDEX_CREATE_TRANSLOG, forceNewHistoryUUID);
|
||||
|
Loading…
x
Reference in New Issue
Block a user