-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Fix bq load for clashing copy job names #39107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| { | ||
| "comment": "Modify this file in a trivial way to cause this test suite to run.", | ||
| "pr": "37345", | ||
| "modification": 49 | ||
| } | ||
| "modification": 50 | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -171,6 +171,15 @@ def _bq_uuid(seed=None): | |
| return str(hashlib.md5(seed.encode('utf8')).hexdigest()) | ||
|
|
||
|
|
||
| def _bq_uuid_list(list): | ||
| cs = hashlib.sha256() | ||
| for item in list: | ||
| cs.update(bigquery_tools.get_hashable_destination(item).encode('utf-8')) | ||
| # separator | ||
| cs.update(b'\x00') | ||
| return cs.hexdigest() | ||
|
|
||
|
|
||
| class _ShardDestinations(beam.DoFn): | ||
| """Adds a shard number to the key of the KV element. | ||
|
|
||
|
|
@@ -589,9 +598,7 @@ def process( | |
| write_disposition = 'WRITE_APPEND' | ||
| wait_for_job = False | ||
|
|
||
| chunk_job_name = copy_job_name_base | ||
| if len(chunks) > 1: | ||
| chunk_job_name = f"{copy_job_name_base}_{i}" | ||
| chunk_job_name = '%s_%s' % (copy_job_name_base, _bq_uuid_list(chunk)) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have to be careful here. I remember bq load job name being deterministic is intended to avoid duplicate data on retry.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If there is a commit causing these test failures (#38983 ?), consider revert it for the current release then fix forward, since release already cut yesterday and there is a risk potential problems not revealed if fix-forward with cherry-picks |
||
|
|
||
| _LOGGER.info( | ||
| "Triggering copy job %s from %s to %s (write_disposition: %s)", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use f-strings instead of
%formatting for consistency with the rest of the codebase and modern Python standards (PEP 498).References