You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/reverse-replication/ReverseReplicationUserGuide.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -111,6 +111,7 @@ The Dataflow job that writes to source database exposes the following per shard
111
111
|replication_lag_in_seconds_\<logical shard name\>| Replication lag min,max and count value for the shard|
112
112
| metadata_file_create_lag_retry_\<logical shard name\>| Count of file lookup retries done when the job that writes to GCS is lagging |
113
113
| mySQL_retry_\<logical shard name\>| Number of retries done when MySQL is not reachable|
114
+
| shard_failed_\<logical shard name\>| Published when there is a failure while processing the shard |
114
115
115
116
These can be used to track the pipeline progress.
116
117
However, there is a limit of 100 on the total number of metrics per project. So if this limit is exhausted, the Dataflow job will give a message like so:
@@ -199,6 +200,7 @@ In this case, check if you observe the following:
199
200
2. The primary key value was not present in the change stream data
200
201
3. When there is no data written to Spanner for a given interval for a given shard, no file is created in GCS. In such a case, the interval is skipped by the writer Dataflow job. This can be verified in the logs by searching for the text ```skipping the file```. If a file is marked as skipped in the logs but it exists in GCS - this indicates a data loss scenario - please raise a bug.
201
202
4. Check the shard_file_process_progress table in the metadata database. If it is lagging, then wait for the pipeline to catch up so such that data gets reverse replicated.
203
+
5. Check if the shard_failed_\<logical shard name\> metric is present, this indicates there was a failure when processing the shard. Look at the logs for the failure details.
202
204
203
205
204
206
#### There is higher load than the expected QPS on spanner instance post cutover
Copy file name to clipboardExpand all lines: docs/reverse-replication/RunnigReverseReplication.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,14 +45,15 @@ The script takes in multiple arguments to orchestrate the pipeline. They are:
45
45
-`metadataInstance`: Spanner instance name to store changestream metadata. Defaults to target spanner instance id.
46
46
-`metadataTableSuffix`: The suffix to apply when creating metadata tables.Helpful in case of multiple runs.Default is no suffix.
47
47
-`networkTags`: network tags addded to the Dataflow jobs worker and launcher VMs.
48
-
-`projectId`: Project id of the Spanner instance.
48
+
-`projectId`: projectId for Dataflow jobs. If spannerProjectId is not specified, this value is used for Cloud Spanner project id as well.
49
49
-`sessionFilePath`: GCS file path for session file generated via Spanner migration tool.
50
50
-`serviceAccountEmail`: the email address of the service account to run the job as.
51
51
-`skipChangeStreamCreation`: whether to skip the change stream creation. Default is false.
52
52
-`skipMetadataDatabaseCreation`: whether to skip Metadata database creation.Default is false.
53
53
-`sourceDbTimezoneOffset`: the timezone offset with respect to UTC for the source database.Defaults to +00:00.
54
54
-`sourceShardsFilePath`: GCS file path for file containing shard info. Details on structure mentioned later.
55
55
-`sourceWriterTemplateLocation` : the dataflow template location for the Source writer job.
56
+
-`spannerProjectId`: the project id where Cloud Spanner resides, for use case when Cloud Spanner is in a different project than where Dataflow would run.
56
57
-`spannerReaderTemplateLocation`: the dataflow template location for the Spanner reader job
57
58
-`startTimestamp`: Timestamp from which the changestream should start reading changes in RFC 3339 format, defaults to empty string which is equivalent to the current timestamp.
58
59
-`readerMaxWorkers`: Number of maximum workers for the reader job.
flag.StringVar(&projectId, "projectId", "", "ProjectId for Dataflow jobs. If spannerProjectId is not specified, this value is used for Cloud Spanner project id as well.")
68
69
flag.StringVar(&dataflowRegion, "dataflowRegion", "", "Region for dataflow jobs.")
69
70
flag.StringVar(&jobNamePrefix, "jobNamePrefix", "smt-reverse-replication", "Job name prefix for the dataflow jobs, defaults to reverse-rep. Automatically converted to lower case due to Dataflow name constraints.")
70
71
flag.StringVar(&changeStreamName, "changeStreamName", "reverseReplicationStream", "Change stream name, defaults to reverseReplicationStream.")
@@ -90,8 +91,8 @@ func setupGlobalFlags() {
90
91
flag.StringVar(&serviceAccountEmail, "serviceAccountEmail", "", "The email address of the service account to run the job as.")
91
92
flag.IntVar(&readerWorkers, "readerWorkers", 5, "Number of workers for reader job.")
92
93
flag.IntVar(&writerWorkers, "writerWorkers", 5, "Number of workers for writer job.")
93
-
flag.StringVar(&spannerReaderTemplateLocation, "spannerReaderTemplateLocation", "gs://dataflow-templates-us-east7/2024-03-06-00_RC00/flex/Spanner_Change_Streams_to_Sharded_File_Sink", "The dataflow template location for the Spanner reader job.")
94
-
flag.StringVar(&sourceWriterTemplateLocation, "sourceWriterTemplateLocation", "gs://dataflow-templates-us-east7/2024-03-06-00_RC00/flex/GCS_to_Sourcedb", "The dataflow template location for the Source writer job.")
94
+
flag.StringVar(&spannerReaderTemplateLocation, "spannerReaderTemplateLocation", "gs://dataflow-templates-us-east7/2024-03-27-00_RC00/flex/Spanner_Change_Streams_to_Sharded_File_Sink", "The dataflow template location for the Spanner reader job.")
95
+
flag.StringVar(&sourceWriterTemplateLocation, "sourceWriterTemplateLocation", "gs://dataflow-templates-us-east7/2024-03-27-00_RC00/flex/GCS_to_Sourcedb", "The dataflow template location for the Source writer job.")
95
96
flag.StringVar(&jobsToLaunch, "jobsToLaunch", "both", "Whether to launch the spanner reader job or the source writer job or both. Default is both. Support values are both,reader,writer.")
96
97
flag.BoolVar(&skipChangeStreamCreation, "skipChangeStreamCreation", false, "Whether to skip the change stream creation. Default is false.")
97
98
flag.BoolVar(&skipMetadataDatabaseCreation, "skipMetadataDatabaseCreation", false, "Whether to skip Metadata database creation.Default is false.")
@@ -101,6 +102,7 @@ func setupGlobalFlags() {
101
102
flag.StringVar(&runIdentifier, "runIdentifier", "", "The run identifier for the Dataflow jobs.")
102
103
flag.StringVar(&readerShardingCustomParameters, "readerShardingCustomParameters", "", "Any custom parameters to be supplied to custom sharding class.")
103
104
flag.IntVar(&readerMaxWorkers, "readerMaxWorkers", 20, "Number of max workers for reader job.")
105
+
flag.StringVar(&spannerProjectId, "spannerProjectId", "", "The project id where Cloud Spanner resides, for use case when Cloud Spanner is in a different project than where Dataflow would run.")
104
106
105
107
}
106
108
@@ -175,6 +177,11 @@ func prechecks() error {
175
177
returnfmt.Errorf("please specify a valid GCS path for readerShardingCustomJarPath, like gs://<>")
176
178
}
177
179
180
+
ifspannerProjectId=="" {
181
+
fmt.Println("Setting the Spanner Project Id to Dataflow project id: ", projectId)
0 commit comments