Skip to content

Commit

Permalink
Fix testRecoverFromHardDeletesIndex (#50663)
Browse files Browse the repository at this point in the history
We need to create a hard-deletes engine in the test with soft-deletes 
disabled; otherwise, we the min_retained_seqno will be calculated
incorrectly.

Closes #50654
  • Loading branch information
dnhatn authored Jan 6, 2020
1 parent 9a7ff38 commit c2a3eda
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5476,10 +5476,14 @@ public long softUpdateDocuments(Term term, Iterable<? extends Iterable<? extends
final AtomicLong globalCheckpoint = new AtomicLong(SequenceNumbers.NO_OPS_PERFORMED);
Path translogPath = createTempDir();
List<Engine.Operation> operations = generateHistoryOnReplica(between(1, 500), randomBoolean(), randomBoolean(), randomBoolean());
final IndexMetaData indexMetaData = IndexMetaData.builder(defaultSettings.getIndexMetaData())
.settings(Settings.builder().put(defaultSettings.getSettings()).put(IndexSettings.INDEX_SOFT_DELETES_SETTING.getKey(), false))
.build();
final IndexSettings indexSettings = IndexSettingsModule.newIndexSettings(indexMetaData);
try (Store store = createStore()) {
EngineConfig config = config(defaultSettings, store, translogPath, NoMergePolicy.INSTANCE, null, null, globalCheckpoint::get);
EngineConfig config = config(indexSettings, store, translogPath, NoMergePolicy.INSTANCE, null, null, globalCheckpoint::get);
final List<DocIdSeqNoAndSource> docs;
try (InternalEngine hardDeletesEngine = createEngine(defaultSettings, store, translogPath, newMergePolicy(),
try (InternalEngine hardDeletesEngine = createEngine(indexSettings, store, translogPath, newMergePolicy(),
hardDeletesWriter, null, globalCheckpoint::get)) {
for (Engine.Operation op : operations) {
applyOperation(hardDeletesEngine, op);
Expand Down

0 comments on commit c2a3eda

Please sign in to comment.