Skip to content

Commit 9c729fa

Browse files
committed
remove flush check IW#commit always adds a commit point now even if nothing has changed ie. docs are added, updated or deleted.
1 parent 22f0e79 commit 9c729fa

File tree

1 file changed

+5
-20
lines changed

1 file changed

+5
-20
lines changed

src/main/java/org/elasticsearch/index/engine/robin/RobinEngine.java

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -866,26 +866,11 @@ public void flush(Flush flush) throws EngineException {
866866
translog.newTransientTranslog(translogId);
867867
indexWriter.setCommitData(MapBuilder.<String, String>newMapBuilder().put(Translog.TRANSLOG_ID_KEY, Long.toString(translogId)).map());
868868
indexWriter.commit();
869-
if (flush.force()) {
870-
// if we force, we might not have committed, we need to check that its the same id
871-
Map<String, String> commitUserData = Lucene.readSegmentInfos(store.directory()).getUserData();
872-
long committedTranslogId = Long.parseLong(commitUserData.get(Translog.TRANSLOG_ID_KEY));
873-
if (committedTranslogId != translogId) {
874-
// we did not commit anything, revert to the old translog
875-
translog.revertTransient();
876-
} else {
877-
makeTransientCurrent = true;
878-
}
879-
} else {
880-
makeTransientCurrent = true;
881-
}
882-
if (makeTransientCurrent) {
883-
refreshVersioningTable(threadPool.estimatedTimeInMillis());
884-
// we need to move transient to current only after we refresh
885-
// so items added to current will still be around for realtime get
886-
// when tans overrides it
887-
translog.makeTransientCurrent();
888-
}
869+
refreshVersioningTable(threadPool.estimatedTimeInMillis());
870+
// we need to move transient to current only after we refresh
871+
// so items added to current will still be around for realtime get
872+
// when tans overrides it
873+
translog.makeTransientCurrent();
889874
} catch (OutOfMemoryError e) {
890875
translog.revertTransient();
891876
failEngine(e);

0 commit comments

Comments
 (0)