Skip to content

Commit b4e7810

Browse files
committed
getMinGenerationForSeqNo should acquire read lock (#29126)
The method Translog#getMinGenerationForSeqNo does not modify the current translog but only access, it therefore should acquire the readLock instead of writeLock.
1 parent c4de75b commit b4e7810

File tree

1 file changed

+1
-1
lines changed
  • server/src/main/java/org/elasticsearch/index/translog

1 file changed

+1
-1
lines changed

server/src/main/java/org/elasticsearch/index/translog/Translog.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1515,7 +1515,7 @@ public static void writeOperationNoSize(BufferedChecksumStreamOutput out, Transl
15151515
* @return the minimum generation for the sequence number
15161516
*/
15171517
public TranslogGeneration getMinGenerationForSeqNo(final long seqNo) {
1518-
try (ReleasableLock ignored = writeLock.acquire()) {
1518+
try (ReleasableLock ignored = readLock.acquire()) {
15191519
/*
15201520
* When flushing, the engine will ask the translog for the minimum generation that could contain any sequence number after the
15211521
* local checkpoint. Immediately after flushing, there will be no such generation, so this minimum generation in this case will

0 commit comments

Comments
 (0)