Dataflow Template for Firestore to Firestore Documents Copy (Clone of PR 3098)#3392
Dataflow Template for Firestore to Firestore Documents Copy (Clone of PR 3098)#3392jingqizz wants to merge 3 commits intoGoogleCloudPlatform:mainfrom
Conversation
Summary of ChangesHello @jingqizz, 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 robust Dataflow template designed to efficiently copy documents from one Firestore database to another. This new capability streamlines data migration and replication workflows for Firestore users. Accompanying this template are new utility classes for managing Firestore resources during testing, ensuring the reliability and maintainability of the new pipeline. The changes also include updated project configurations and detailed documentation to facilitate adoption and deployment. Highlights
Changelog
Activity
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
|
… to fix the format issue
| p.apply(Create.of(collectionIdsList)) | ||
| .apply( | ||
| new CreatePartitionQueryRequestFn( | ||
| sourceProjectId, sourceDatabaseId, maxNumWorkers > 1 ? maxNumWorkers : 20L)); |
There was a problem hiding this comment.
nit: We should probably store the default max workers in a constant, and include it in the documentation of the flag as well.
(update: looks like this is a shared flag, what's the default as is?)
| collectionIdsList = getAllCollectionIds(sourceProjectId, sourceDatabaseId); | ||
| } catch (Exception e) { | ||
| LOG.error("Failed to list collections: {}", e.getMessage(), e); | ||
| return; |
There was a problem hiding this comment.
I think we actually want to throw the exception here to make sure the pipeline clearly fails in case this happens.
| description = { | ||
| "The Firestore to Firestore template is a batch pipeline that reads documents from one" | ||
| + " <a href=\"https://cloud.google.com/firestore/docs\">Firestore</a> database and writes" | ||
| + " them to another Firestore database.", |
There was a problem hiding this comment.
Can you add a callout that this does not support Enterprise edition databases as the source?
| .addParameter("sourceDatabaseId", SOURCE_DATABASE_ID) | ||
| .addParameter("destinationProjectId", PROJECT) | ||
| .addParameter("destinationDatabaseId", DESTINATION_DATABASE_ID) | ||
| .addParameter("collectionIds", collectionId) |
There was a problem hiding this comment.
Can you add a test case that doesn't specify collectionIds, and verify that all collections are copied?
| <groupId>com.google.cloud</groupId> | ||
| <artifactId>google-cloud-spanner</artifactId> | ||
| <version>6.104.0</version> | ||
| <version>6.102.0</version> |
There was a problem hiding this comment.
Is this needed? Ideally we wouldn't downgrade the spanner version here as this looks like a shared dependency.
(sorry can't remember if this was part of my original changes and what the context was).
| <dependency> | ||
| <groupId>com.google.cloud</groupId> | ||
| <artifactId>google-cloud-pubsublite</artifactId> | ||
| </dependency> |
There was a problem hiding this comment.
Similar here I think this is unrelated to our change, remove and very it's not needed?
| validateOptions(options); | ||
| LOG.info("Pipeline options parsed and validated."); | ||
|
|
||
| Pipeline p = Pipeline.create(options); |
There was a problem hiding this comment.
Can you add a pipeline option to log errors to a given GCS path? See https://docs.cloud.google.com/dataflow/docs/guides/templates/provided/cloud-storage-to-firestore for an example.
Cloned the changes from https://github.com/GoogleCloudPlatform/DataflowTemplates/pull/3098/files.
(cc @pacoavila808)