Copilot commented on code in PR #87:
URL:
https://github.com/apache/paimon-vector-index/pull/87#discussion_r3912202465
##########
python/paimon_vindex/__init__.py:
##########
@@ -512,6 +521,15 @@ def __init__(self, training: VectorIndexTraining):
_check_error("failed to open writer")
self._dimension = self._read_dimension()
+ @classmethod
+ def _from_handle(cls, handle):
+ writer = cls.__new__(cls)
+ writer._native_handle_lock = _NativeHandleLock()
+ writer._closed = False
+ writer._handle = handle
+ writer._dimension = writer._read_dimension()
+ return writer
Review Comment:
VectorIndexWriter._from_handle() can leak the native writer handle if
_read_dimension() raises (e.g., if the native call returns an error). Since
this is a new entry point used by VectorIndexTraining.create_writer(), it
should eagerly free the handle on initialization failure rather than relying on
GC to eventually call __del__.
--
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]