@@ -249,6 +249,8 @@ public class RobinEngine extends AbstractIndexShardComponent implements Engine {
249
249
}
250
250
251
251
try {
252
+ // commit on a just opened writer will commit even if there are no changes done to it
253
+ // we rely on that for the commit data translog id key
252
254
if (IndexReader .indexExists (store .directory ())) {
253
255
Map <String , String > commitUserData = IndexReader .getCommitUserData (store .directory ());
254
256
if (commitUserData .containsKey (Translog .TRANSLOG_ID_KEY )) {
@@ -803,6 +805,8 @@ private void innerDelete(Delete delete, IndexWriter writer) throws IOException {
803
805
indexWriter .close (false );
804
806
indexWriter = createWriter ();
805
807
808
+ // commit on a just opened writer will commit even if there are no changes done to it
809
+ // we rely on that for the commit data translog id key
806
810
if (flushNeeded || flush .force ()) {
807
811
flushNeeded = false ;
808
812
long translogId = translogIdGenerator .incrementAndGet ();
@@ -813,6 +817,8 @@ private void innerDelete(Delete delete, IndexWriter writer) throws IOException {
813
817
AcquirableResource <ReaderSearcherHolder > current = nrtResource ;
814
818
nrtResource = buildNrtResource (indexWriter );
815
819
current .markForClose ();
820
+
821
+ refreshVersioningTable (threadPool .estimatedTimeInMillis ());
816
822
} catch (Exception e ) {
817
823
throw new FlushFailedEngineException (shardId , e );
818
824
} catch (OutOfMemoryError e ) {
@@ -851,6 +857,13 @@ private void innerDelete(Delete delete, IndexWriter writer) throws IOException {
851
857
} else {
852
858
makeTransientCurrent = true ;
853
859
}
860
+ if (makeTransientCurrent ) {
861
+ refreshVersioningTable (threadPool .estimatedTimeInMillis ());
862
+ // we need to move transient to current only after we refresh
863
+ // so items added to current will still be around for realtime get
864
+ // when tans overrides it
865
+ translog .makeTransientCurrent ();
866
+ }
854
867
} catch (Exception e ) {
855
868
translog .revertTransient ();
856
869
throw new FlushFailedEngineException (shardId , e );
@@ -864,13 +877,6 @@ private void innerDelete(Delete delete, IndexWriter writer) throws IOException {
864
877
rwl .readLock ().unlock ();
865
878
}
866
879
}
867
- refreshVersioningTable (threadPool .estimatedTimeInMillis ());
868
- // we need to move transient to current only after we refresh
869
- // so items added to current will still be around for realtime get
870
- // when tans overrides it
871
- if (makeTransientCurrent ) {
872
- translog .makeTransientCurrent ();
873
- }
874
880
try {
875
881
SegmentInfos infos = new SegmentInfos ();
876
882
infos .read (store .directory ());
0 commit comments