[DataStreamToSpanner] Improvement: Adding group by key step before Spanner write step#3249
Conversation
Summary of ChangesHello @darshan-sj, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a crucial optimization to the DataStreamToSpanner pipeline by implementing a primary key-based grouping mechanism for change events. This enhancement aims to serialize operations on the same key, thereby significantly reducing lock contention within Spanner during high-volume write operations. The change improves the robustness and efficiency of the data replication process, particularly for scenarios with concentrated event activity on a small set of keys. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3249 +/- ##
============================================
+ Coverage 50.93% 54.91% +3.98%
+ Complexity 5157 2277 -2880
============================================
Files 977 493 -484
Lines 60347 28861 -31486
Branches 6594 3036 -3558
============================================
- Hits 30735 15848 -14887
+ Misses 27457 12050 -15407
+ Partials 2155 963 -1192
🚀 New features to boost your workflow:
|
...n/java/com/google/cloud/teleport/v2/templates/CreateKeyValuePairsWithPrimaryKeyHashDoFn.java
Show resolved
Hide resolved
bharadwaj-aditya
left a comment
There was a problem hiding this comment.
Couple of minor changes. otherwise LGTM
...o-spanner/src/main/java/com/google/cloud/teleport/v2/templates/SpannerTransactionWriter.java
Outdated
Show resolved
Hide resolved
...o-spanner/src/main/java/com/google/cloud/teleport/v2/templates/SpannerTransactionWriter.java
Outdated
Show resolved
Hide resolved
…anner write step (GoogleCloudPlatform#3249) * Adding group by key step before Spanner write step * Renaming class name * Added unit tests * Correcting UTs * Correcting a bug * Fixing a bug * Correcting a bug * Adding more Unit test cases * Addressing comments
Improvement: Adding group by key step before Spanner write step
This would serialize events happening on same key in Dataflow job and hence avoid lock contention in Spanner when there are too many events corresponding to a small set of keys.