Skip to content

Commit 09fcc7c

Browse files
committed
Add assertion
1 parent 54f2511 commit 09fcc7c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

server/src/main/java/org/elasticsearch/index/seqno/ReplicationTracker.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,13 @@ public synchronized RetentionLease renewRetentionLease(final String id, final lo
230230
}
231231
final RetentionLease retentionLease =
232232
new RetentionLease(id, retainingSequenceNumber, currentTimeMillisSupplier.getAsLong(), source);
233-
retentionLeases.put(id, retentionLease);
233+
final RetentionLease existingRetentionLease = retentionLeases.put(id, retentionLease);
234+
assert existingRetentionLease != null;
235+
assert existingRetentionLease.retainingSequenceNumber() <= retentionLease.retainingSequenceNumber() :
236+
"retention lease renewal for [" + id + "]"
237+
+ " from [" + source + "]"
238+
+ " renewed a lower retaining sequence number [" + retentionLease.retainingSequenceNumber() + "]"
239+
+ " than the current lease retaining sequence number [" + existingRetentionLease.retainingSequenceNumber() + "]";
234240
return retentionLease;
235241
}
236242

0 commit comments

Comments
 (0)