Repository navigation
Conversation
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.
Summary
Makes
InitializeDoFn.createFakeParentPartition()idempotent under overlapping or retriedInitializeDoFnexecutions during pipeline startup:DoFnexecution has at-least-once semantics, two workers can executeInitializeDoFnconcurrently during job startup before the firstCREATE TABLE IF NOT EXISTSDDL operation completes. Both executions observepartitionMetadataDao.tableExists() == false, both executecreatePartitionMetadataTable()(CREATE TABLE IF NOT EXISTS), and both proceed tocreateFakeParentPartition(), causing the second execution to fail withSpannerException: ALREADY_EXISTS: Row [Parent0] ... already exists.partitionMetadataDao.runInTransaction), checktransaction.getPartition(...) == nullbefore inserting each initial parent partition (consistent withChildPartitionsRecordActionandPartitionStartRecordAction), ensuring existingParent0rows (and any state transitions already in progress) are never overwritten.SpannerExceptionwithErrorCode.ALREADY_EXISTSas a safeguard against concurrent insert races.Testing
InitializeDoFnTestcovering new insertions, pre-existing initial partitions (single and TVF list),ErrorCode.ALREADY_EXISTShandling, and non-ALREADY_EXISTSexception propagation.