Repository navigation
Conversation
Signed-off-by: Jeff Spahr <spahrj@gmail.com>
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Concurrent first-time type upserts against PostgreSQL can both observe an absent
(name, version, type_kind)and insert different IDs. A client can then create a context under one ID whileGetContextByTypeAndNameresolves the other and returns an empty result. Two unmodified KFP clients reproduced this ascontext not found immediately after insertagainst MLMD 1.14.0; the same read-then-insert path remains on master.Acquire a transaction-scoped
SHARE ROW EXCLUSIVElock onTypebefore the upsert lookup. Under PostgreSQL's default READ COMMITTED isolation, a competing upsert waits and then reads the committed type instead of creating a duplicate. Ordinary type reads remain unblocked. The lock covers artifact, execution, and context types, including versioned and unversioned types, and requires no schema change.Add a standalone PostgreSQL query-executor test target and deterministic two-connection regression coverage for contention, commit/readback, ordinary reads, and rollback. The tests use PostgreSQL's lock timeout to exercise overlap without scheduling-dependent thread sleeps. The standalone fixture now cleans up its database between cases.
This prevents new duplicate types among upgraded writers; it does not repair existing duplicate records. Existing duplicate IDs need a separate data-repair plan, and all metadata-server writers must be upgraded before relying on this guarantee during rollout.
Validation (PostgreSQL 16, Bazel 7.7.0):
//ml_metadata/metadata_store:postgresql_query_executorand//ml_metadata/metadata_store:standalone_postgresql_query_executor_testbuild successfully.git diff --checkpass.Observed in the PostgreSQL MLflow lane of kubeflow/pipelines#14348. A KFP deployment will need a metadata-server image containing this fix before its first-use race is resolved.