mikemccand commented on a change in pull request #1434: LUCENE-9324: Add an ID 
to SegmentCommitInfo
URL: https://github.com/apache/lucene-solr/pull/1434#discussion_r409554301
 
 

 ##########
 File path: lucene/core/src/java/org/apache/lucene/index/SegmentCommitInfo.java
 ##########
 @@ -388,4 +399,17 @@ public SegmentCommitInfo clone() {
   final int getDelCount(boolean includeSoftDeletes) {
     return includeSoftDeletes ? getDelCount() + getSoftDelCount() : 
getDelCount();
   }
+
+  private void generationAdvanced() {
+    sizeInBytes = -1;
+    id = null;
+  }
+
+  public byte[] getId() {
+    if (id == null) {
+      // we advanced a generation - need to generate a new ID
+      id = StringHelper.randomId();
 
 Review comment:
   Do we need some thread safety here?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to