[Task]: Add MetadataSpannerConfig class for generating SpannerConfig for accessing change stream metadata database
- Dominant language
- Java
- Stars
- 8.7k
- Forks
- 4.7k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 196
Description
### What needs to happen?
created from https://github.com/apache/beam/pull/25108#issuecomment-1400709831:
When reading from change streams there are two databases involved, 1) the primary database that contains the change stream, and 2) a metadata database (maintained by Beam) that holds partition progress state so a job can be restarted and pick up where it left off. To create a spanner config to access the metadata database, the following pattern is used:
```
SpannerConfig metadataConfig = spannerConfig.toBuilder()
.setInstanceId(metadataInstanceId)
.setDatabaseId(metadataDatabaseId)
.build();
```
The metadata config (`metadataConfig`) is initialized using the primary database config (`spannerConfig`) since most of the fields are the same and then the ones that are different get overwritten. With the Fine-Grained Access Control project, we've added a new config field _databaseRole_ that should only be set for primary database access. Unfortunately the pattern above blindly copies this field to the metadata config. A better approach would be to write a metadata config create function that copies a whitelisted set of fields from the primary config and leaves all of the other fields empty.
### Issue Priority
Priority: 2 (default / most normal work should be filed as P2)
### Issue Components
- [ ] Component: Python SDK
- [X] Component: Java SDK
- [ ] Component: Go SDK
- [ ] Component: Typescript SDK
- [X] Component: IO connector
- [ ] Component: Beam examples
- [ ] Component: Beam playground
- [ ] Component: Beam katas
- [ ] Component: Website
- [ ] Component: Spark Runner
- [ ] Component: Flink Runner
- [ ] Component: Samza Runner
- [ ] Component: Twister2 Runner
- [ ] Component: Hazelcast Jet Runner
- [ ] Component: Google Cloud Dataflow Runner
Contributor guide
Assessment
This issue has not been assessed yet.