leaves12138 commented on code in PR #62:
URL:
https://github.com/apache/paimon-vector-index/pull/62#discussion_r3651836102
##########
java/src/main/java/org/apache/paimon/index/vector/VectorIndexReader.java:
##########
@@ -77,6 +84,55 @@ public void optimizeForSearch() {
}
}
+ public void warmupQueries(float[] queries, int queryCount, int lSearch) {
+ if (queries == null) {
+ throw new NullPointerException("queries");
+ }
+ if (queryCount < 0) {
+ throw new IllegalArgumentException("queryCount must be
non-negative");
+ }
+ if (lSearch < 0) {
+ throw new IllegalArgumentException("lSearch must be non-negative");
+ }
+ synchronized (nativeHandleLock) {
+ enterNativeHandle();
+ try {
+ VectorIndexNative.warmupQueries(requireOpen(), queries,
queryCount, lSearch);
+ } finally {
+ exitNativeHandle();
+ }
+ }
+ }
+
+ public int calibrateSearchWidth(float[] queries, int queryCount, int topK)
{
+ if (queries == null) {
+ throw new NullPointerException("queries");
+ }
+ if (queryCount <= 0 || topK <= 0) {
+ throw new IllegalArgumentException("queryCount and topK must be
positive");
+ }
+ synchronized (nativeHandleLock) {
+ enterNativeHandle();
+ try {
+ return VectorIndexNative.calibrateSearchWidth(
+ requireOpen(), queries, queryCount, topK);
+ } finally {
+ exitNativeHandle();
+ }
+ }
+ }
+
+ public VectorIndexReadPlan readPlan() {
+ synchronized (nativeHandleLock) {
Review Comment:
The owner-thread check has the same cross-thread callback deadlock as the
C++ and Python wrappers. DiskANN batch search can invoke
`VectorIndexInput.pread` on a Rayon worker while the caller thread holds
`nativeHandleLock`; if that worker callback calls `reader.metadata()` (or
another Reader method), it blocks entering this `synchronized` section, while
the outer native search waits for the callback. I reproduced it with the
current head using `RAYON_NUM_THREADS=4`, the 5,000-row DiskANN fixture, a
resident budget only 8 KiB above the required state, and 64 queries: the worker
printed its reentry attempt and the Java process timed out after 12 seconds.
Could callback reentry be rejected based on the active native
operation/callback context rather than only `Thread.currentThread()`? A
regression should exercise a callback originating from a native worker, not
only same-thread IVF callbacks.
--
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]