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

CassandraToBigtable classic template feature: Cassandra Writetime replication #1653

Merged
merged 28 commits into from
Oct 15, 2024

Conversation

georgecma
Copy link
Contributor

@georgecma georgecma commented Jun 12, 2024

Add Cassandra writetime replication feature to CassandraToBigtable classic template.

Cassandra writetime can now be replicated to Bigtable as Bigtable cell timestamp. For this feature to work, users have to upload a json-like schema file to a GCS bucket location first for the table they wish to replicate writetimes for. The command to generate this schema file is:

cqlsh -e "select json * from system_schema.columns
                where keyspace_name='$CASSANDRA_KEYSPACE'
                and table_name='$CASSANDRA_TABLE'"
    > column_schema.json

Then, to upload the file:

gcloud storage cp column_schema $WRITETIME_CASSANDRA_COLUMN_SCHEMA

The schema GCS file path should then be set as $WRITETIME_CASSANDRA_COLUMN_SCHEMA to be parsed by the template at run time.

The template replication behavior now sets Bigtable cell time as replication time (i.e. now) instead of epoch start time previously. SetZeroTimestamp is the backwards compatibility option to set 0 as the timestamp.

@GoogleCloudPlatform/dataflow-templates-wg

@georgecma georgecma marked this pull request as ready for review June 12, 2024 15:53
@georgecma georgecma changed the title (DRAFT) CassandraToBigtable classic template feature: Cassandra Writetime replication CassandraToBigtable classic template feature: Cassandra Writetime replication Jun 12, 2024
@georgecma
Copy link
Contributor Author

@GoogleCloudPlatform/dataflow-templates-wg

@liferoad liferoad requested a review from Abacn August 19, 2024 17:55
Copy link

codecov bot commented Aug 19, 2024

Codecov Report

Attention: Patch coverage is 56.77419% with 67 lines in your changes missing coverage. Please review.

Project coverage is 44.00%. Comparing base (c4df310) to head (8a38b50).
Report is 108 commits behind head on main.

Files with missing lines Patch % Lines
...port/bigtable/CassandraWritetimeQueryProvider.java 0.00% 22 Missing ⚠️
...e/cloud/teleport/bigtable/BeamRowToBigtableFn.java 81.69% 7 Missing and 6 partials ⚠️
...gle/cloud/teleport/util/GCSAwareValueProvider.java 0.00% 10 Missing ⚠️
...cloud/teleport/bigtable/CassandraColumnSchema.java 76.31% 4 Missing and 5 partials ⚠️
...e/cloud/teleport/bigtable/CassandraToBigtable.java 0.00% 8 Missing ⚠️
.../java/com/google/cloud/teleport/util/GCSUtils.java 0.00% 5 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1653      +/-   ##
============================================
+ Coverage     42.98%   44.00%   +1.01%     
- Complexity     3405     3479      +74     
============================================
  Files           818      829      +11     
  Lines         47779    49186    +1407     
  Branches       5127     5168      +41     
============================================
+ Hits          20537    21642    +1105     
- Misses        25581    25883     +302     
  Partials       1661     1661              
Components Coverage Δ
spanner-templates 63.56% <ø> (-0.32%) ⬇️
spanner-import-export 63.76% <ø> (-0.55%) ⬇️
spanner-live-forward-migration 75.24% <ø> (+0.07%) ⬆️
spanner-live-reverse-replication 68.40% <ø> (-3.23%) ⬇️
spanner-bulk-migration 84.29% <ø> (+0.44%) ⬆️
Files with missing lines Coverage Δ
...gle/cloud/teleport/bigtable/CassandraKeyUtils.java 95.65% <ø> (ø)
.../cloud/teleport/bigtable/CassandraRowMapperFn.java 89.88% <100.00%> (+0.11%) ⬆️
.../java/com/google/cloud/teleport/util/GCSUtils.java 40.00% <0.00%> (-13.34%) ⬇️
...e/cloud/teleport/bigtable/CassandraToBigtable.java 0.00% <0.00%> (ø)
...cloud/teleport/bigtable/CassandraColumnSchema.java 76.31% <76.31%> (ø)
...gle/cloud/teleport/util/GCSAwareValueProvider.java 0.00% <0.00%> (ø)
...e/cloud/teleport/bigtable/BeamRowToBigtableFn.java 87.11% <81.69%> (-4.32%) ⬇️
...port/bigtable/CassandraWritetimeQueryProvider.java 0.00% <0.00%> (ø)

... and 163 files with indirect coverage changes

Copy link
Contributor

@Polber Polber left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution! I left a couple small comments for core templates related files. Please tag a member from the BigTable team to review BigTable-related changes

…ed pom.xml import version for datastax query builder, changed CharStreams import in GCSUtils
@vermas2012 vermas2012 self-requested a review September 5, 2024 13:59
@georgecma georgecma requested a review from a team as a code owner September 9, 2024 22:18
vermas2012
vermas2012 previously approved these changes Sep 19, 2024
Copy link

@vermas2012 vermas2012 left a comment

Choose a reason for hiding this comment

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

Please go through all the warnings of lines not covered by tests and add any relevant Tests.

Copy link
Contributor

@Abacn Abacn left a comment

Choose a reason for hiding this comment

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

ack. will merge after fixing the format (mv. spotless:apply)

@Abacn
Copy link
Contributor

Abacn commented Oct 4, 2024

cc: @Polber looks like merge is still blocked pending your approval

@vermas2012
Copy link

@Polber Is there anything pending from the CBT side? can we merge this change?

Copy link
Contributor

@Polber Polber left a comment

Choose a reason for hiding this comment

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

Thanks!

@Polber Polber merged commit 6fa8867 into GoogleCloudPlatform:main Oct 15, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants