Skip to content
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

added dlq implementation v1 #1577

Conversation

bharadwaj-aditya
Copy link
Contributor

Added support for writing errors to DLQ.

This PR does not include the files in a format that can be retried using the existing retrial scripts. That will be taken up in a follow up PR.

@bharadwaj-aditya bharadwaj-aditya requested a review from a team as a code owner May 19, 2024 12:21
@bharadwaj-aditya bharadwaj-aditya requested review from Deep1998 and VardhanThigle and removed request for a team May 19, 2024 12:21
Copy link

codecov bot commented May 20, 2024

Codecov Report

Attention: Patch coverage is 64.12214% with 47 lines in your changes are missing coverage. Please review.

Project coverage is 43.54%. Comparing base (8dfb6de) to head (80ad3ae).
Report is 55 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1577      +/-   ##
============================================
+ Coverage     40.93%   43.54%   +2.61%     
+ Complexity     2808      654    -2154     
============================================
  Files           739      294     -445     
  Lines         42855    15542   -27313     
  Branches       4582     1548    -3034     
============================================
- Hits          17542     6768   -10774     
+ Misses        23814     8255   -15559     
+ Partials       1499      519     -980     
Components Coverage Δ
spanner-templates 55.73% <64.12%> (-4.13%) ⬇️
spanner-import-export ∅ <ø> (∅)
spanner-live-forward-migration 73.64% <75.00%> (-0.04%) ⬇️
spanner-live-reverse-replication 48.55% <75.00%> (-0.09%) ⬇️
spanner-bulk-migration 78.07% <64.06%> (+0.02%) ⬆️
Files Coverage Δ
...le/cloud/teleport/v2/constants/MetricCounters.java 0.00% <ø> (ø)
.../v2/source/reader/io/schema/SourceTableSchema.java 100.00% <ø> (ø)
...google/cloud/teleport/v2/templates/RowContext.java 100.00% <100.00%> (ø)
...eport/v2/constants/SourceDbToSpannerConstants.java 66.66% <66.66%> (ø)
...leport/v2/transformer/SourceRowToMutationDoFn.java 97.36% <90.90%> (-2.64%) ⬇️
.../v2/spanner/migrations/avro/AvroToValueMapper.java 90.90% <75.00%> (-1.56%) ⬇️
...google/cloud/teleport/v2/writer/SpannerWriter.java 50.00% <50.00%> (ø)
...ogle/cloud/teleport/v2/writer/DeadLetterQueue.java 73.33% <73.33%> (ø)
...cloud/teleport/v2/templates/SourceDbToSpanner.java 24.28% <25.00%> (+24.28%) ⬆️

... and 466 files with indirect coverage changes

Copy link
Contributor

@Deep1998 Deep1998 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@manitgupta manitgupta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we structure this a little better? The code flow is very hard to understand, especially wrt how failed mutations and failed transformations are getting written to the DLQ.

We used TupleTag for transformer errors to collect the errors and we directly write the records for mutation errors. We should be consistent.

IMO if we should collect the failed records, attributed to the failure reason (transform, retryable, permanent etc) and then write them out to a DLQ...

The PCollections of all types of errors (categorized by permanent or retryable) can be merged and the DLQ can be written in a single stage, something like -

// example for class of permanent errors
PCollectionList.of(errorTransformedRecords)
            .and(spannerWriteResults.permanentErrors())
            .apply(Flatten.pCollections())
            .apply(DLQWriteTransform....)

@bharadwaj-aditya
Copy link
Contributor Author

Can we structure this a little better? The code flow is very hard to understand, especially wrt how failed mutations and failed transformations are getting written to the DLQ.

We used TupleTag for transformer errors to collect the errors and we directly write the records for mutation errors. We should be consistent.

IMO if we should collect the failed records, attributed to the failure reason (transform, retryable, permanent etc) and then write them out to a DLQ...

The PCollections of all types of errors (categorized by permanent or retryable) can be merged and the DLQ can be written in a single stage, something like -

// example for class of permanent errors
PCollectionList.of(errorTransformedRecords)
            .and(spannerWriteResults.permanentErrors())
            .apply(Flatten.pCollections())
            .apply(DLQWriteTransform....)

That was the original idea, but this is currently not possible in this flow owing to the different objects being created. I will catch up with you to explain.

Aditya Bharadwaj added 2 commits May 21, 2024 03:36
spotless apply

checkstyle violation fixes

fixed tests

fixed tests

corrected checkstyle

added tests

moved constants

updated javadocs

addressed review comments

addressed review comments

addressed review comments
Aditya Bharadwaj added 2 commits May 21, 2024 15:12
updated codecov

added tests on avro mapper

removed unused code from Spanner Writer

spotless run
@manitgupta manitgupta added the Google LGTM Approval of a pull request to be merged into the repository label May 22, 2024
@bharadwaj-aditya bharadwaj-aditya removed the request for review from VardhanThigle May 22, 2024 09:01
@copybara-service copybara-service bot merged commit 5d3d94d into GoogleCloudPlatform:main May 22, 2024
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Google LGTM Approval of a pull request to be merged into the repository size/XL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants