[ENGINE] Add current translog ID to commit meta before closing
Today we simply close the IW when we have to open a new one if ie. we change merge settings. Yet, the API is deprecated and under the hood it commits the IW. For safety we should add the current translog ID and use rollback instead to not wait for merges.
This commit is contained in:
parent
006acfe8bf
commit
0a072f6fd0
|
@ -838,10 +838,12 @@ public class InternalEngine extends AbstractIndexShardComponent implements Engin
|
|||
// disable refreshing, not dirty
|
||||
dirty = false;
|
||||
try {
|
||||
// that's ok if the index writer failed and is in inconsistent state
|
||||
// we will get an exception on a dirty operation, and will cause the shard
|
||||
// to be allocated to a different node
|
||||
currentIndexWriter().close(false);
|
||||
{ // commit and close the current writer - we write the current tanslog ID just in case
|
||||
final long translogId = translog.currentId();
|
||||
indexWriter.setCommitData(MapBuilder.<String, String>newMapBuilder().put(Translog.TRANSLOG_ID_KEY, Long.toString(translogId)).map());
|
||||
indexWriter.commit();
|
||||
indexWriter.rollback();
|
||||
}
|
||||
indexWriter = createWriter();
|
||||
mergeScheduler.removeListener(this.throttle);
|
||||
|
||||
|
|
Loading…
Reference in New Issue