refactor(thread-pool): make CPU affinity opt-in (#623)

This commit is contained in:
luoxiaojian
2026-07-29 15:30:04 +08:00
committed by GitHub
parent 31be25598a
commit 1ad6df2539
25 changed files with 435 additions and 74 deletions
+11
View File
@@ -13,6 +13,7 @@
# limitations under the License.
import logging
import inspect
import pytest
import tempfile
import os
@@ -149,6 +150,16 @@ class TestDbConfigMemoryLimitValidation:
class TestDbConfigThreadValidation:
def test_thread_binding_options_are_not_exposed(self):
parameters = inspect.signature(zvec.init).parameters
assert "query_thread_binding" not in parameters
assert "optimize_thread_binding" not in parameters
with pytest.raises(TypeError):
zvec.init(query_thread_binding=True)
with pytest.raises(TypeError):
zvec.init(optimize_thread_binding=True)
@run_in_subprocess
def test_query_threads(self):
zvec.init(query_threads=1)
+2 -1
View File
@@ -81,7 +81,8 @@ def init(
Must be ≥ 1 if provided.
optimize_threads (Optional[int], optional):
Threads for background tasks (e.g., compaction, indexing).
If ``None``, defaults to same as ``query_threads`` or CPU count.
If ``None`` (default), uses the same environment-aware default as
``query_threads``.
invert_to_forward_scan_ratio (Optional[float], optional):
Threshold to switch from inverted index to full forward scan.
Range: [0.0, 1.0]. Higher → more aggressive index skipping.