s1monw 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_r409575955
 
 

 ##########
 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:
   yeah good question, as far as I can tell we never read or write any of the 
member vars on this class unless we hold a lock that protects it. But it's a 
mess so I guess we should. Yet, if we do that we should make every method on 
this class synced no?

----------------------------------------------------------------
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