iprithv commented on code in PR #15982:
URL: https://github.com/apache/lucene/pull/15982#discussion_r3197548667
##########
lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene99/Lucene99ScalarQuantizedVectorsWriter.java:
##########
@@ -819,6 +822,14 @@ ScalarQuantizer createQuantizer() throws IOException {
return quantizer;
}
+ /**
+ * Returns the RAM usage of quantization-specific state only. The
underlying flat vector data is
+ * tracked separately by the rawVectorDelegate at the writer level.
+ */
+ long quantizationOverheadBytesUsed() {
+ return SHALLOW_SIZE;
+ }
+
@Override
public long ramBytesUsed() {
long size = SHALLOW_SIZE;
Review Comment:
I've updated matching the pattern in Lucene102 and Lucene104.
There's no actual double counting though, the writer level ramBytesUsed()
never calls field.ramBytesUsed(). It only calls
field.quantizationOverheadBytesUsed(). The FieldWriter.ramBytesUsed() method
exists purely to satisfy the Accountable interface for standalone introspection
(e.g. tests, debugging), not to feed the writer's own accounting. In Lucene99's
case, quantizationOverheadBytesUsed() and the old SHALLOW_SIZE return the same
value anyway (Lucene99's FieldWriter has no extra quant state like magnitudes
or dimensionSums), so it was functionally identical, just inconsistent.
Thanks @shubhamvishu!
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]