s1monw commented on a change in pull request #513: LUCENE-8590: Optimize 
DocValues update datastructures
URL: https://github.com/apache/lucene-solr/pull/513#discussion_r399150255
 
 

 ##########
 File path: lucene/core/src/java/org/apache/lucene/index/BufferedUpdates.java
 ##########
 @@ -288,15 +184,24 @@ void clear() {
     deleteTerms.clear();
     deleteQueries.clear();
     deleteDocIDs.clear();
-    numericUpdates.clear();
-    binaryUpdates.clear();
     numTermDeletes.set(0);
-    numNumericUpdates.set(0);
-    numBinaryUpdates.set(0);
-    bytesUsed.set(0);
+    numFieldUpdates.set(0);
+    fieldUpdates.clear();
+    bytesUsed.addAndGet(-bytesUsed.get());
+    fieldUpdatesBytesUsed.addAndGet(-fieldUpdatesBytesUsed.get());
   }
   
   boolean any() {
-    return deleteTerms.size() > 0 || deleteDocIDs.size() > 0 || 
deleteQueries.size() > 0 || numericUpdates.size() > 0 || binaryUpdates.size() > 
0;
+    return deleteTerms.size() > 0 || deleteDocIDs.size() > 0 || 
deleteQueries.size() > 0 || numFieldUpdates.get() > 0;
+  }
+
+  @Override
+  public long ramBytesUsed() {
+    return bytesUsed.get() + fieldUpdatesBytesUsed.get();
+  }
+
+  void clearDeletedDocIds() {
+    deleteDocIDs.clear();
+    bytesUsed.addAndGet(-deleteDocIDs.size() * 
BufferedUpdates.BYTES_PER_DEL_DOCID);
   }
 
 Review comment:
   that's a bug indeed. It might not be a huge deal since we don't do much with 
the bytesUsed after this was called but it should still be fixed. Do you want 
to open a PR for this?

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