test: fix PartialUpdateChecker false failures on SchemaMismatchRetryableException

Same root cause as InsertChecker/UpsertChecker: when AddVectorFieldChecker adds
a nullable vector field, the cached schema_timestamp in the SDK becomes stale and
the server rejects the upsert with SchemaMismatch (error code 62).

Apply the same fix: catch SchemaMismatchRetryableException, invalidate the SDK
schema cache via _invalidate_schema(), and retry once.

issue: #49329

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: yanliang567 <82361606+yanliang567@users.noreply.github.com>
This commit is contained in:
yanliang567
2026-04-24 19:16:08 +08:00
co-authored by Claude Sonnet 4.6
parent 5eb07f0360
commit 8683b71720
+17 -1
View File
@@ -31,8 +31,8 @@ from pymilvus import (
connections,
)
from pymilvus.bulk_writer import BulkFileType, RemoteBulkWriter
from pymilvus.exceptions import SchemaMismatchRetryableException
from pymilvus.client.embedding_list import EmbeddingList
from pymilvus.exceptions import SchemaMismatchRetryableException
from pymilvus.milvus_client.index import IndexParams
from utils.api_request import Error
from utils.util_log import test_log as log
@@ -1715,6 +1715,22 @@ class PartialUpdateChecker(Checker):
collection_name=self.c_name, data=self.data, partial_update=True, timeout=timeout
)
return res, True
except SchemaMismatchRetryableException:
# Schema changed concurrently (AddVectorFieldChecker). Invalidate the SDK schema cache
# so the next upsert_rows() fetches the new schema_timestamp, then retry once.
log.debug("[PartialUpdateChecker] schema_timestamp stale, invalidating cache and retrying")
try:
self.milvus_client._get_connection()._invalidate_schema(self.c_name)
except Exception:
pass
try:
res = self.milvus_client.upsert(
collection_name=self.c_name, data=self.data, partial_update=True, timeout=timeout
)
return res, True
except Exception as e:
log.info(f"partial update failed (retry): {e}")
return str(e), False
except Exception as e:
log.info(f"error {e}")
return str(e), False