Class MetadataTableAdminDao
java.lang.Object
org.apache.beam.sdk.io.gcp.bigtable.changestreams.dao.MetadataTableAdminDao
Data access object for creating and dropping the metadata table.
The metadata table will be used to keep the state of the entire Beam pipeline as well as splitting and merging partitions.
Each Beam pipeline will create its own metadata table.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.collect.ImmutableList
<String> static final int
static final String
static final ByteString
static final ByteString
static final String
static final ByteString
-
Constructor Summary
ConstructorsConstructorDescriptionMetadataTableAdminDao
(com.google.cloud.bigtable.admin.v2.BigtableTableAdminClient tableAdminClient, com.google.cloud.bigtable.admin.v2.BigtableInstanceAdminClient instanceAdminClient, String changeStreamName, String tableId) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Delete all the metadata rows starting with the change stream name prefix, except for detect new partition row because it signals the existence of a pipeline with the change stream name.boolean
Create the metadata table if it does not exist yet.boolean
Return the prefix used to identify the rows belonging to this job.Return the metadata table name.boolean
isAppProfileSingleClusterAndTransactional
(String appProfileId) Verify the app profile is for single cluster routing with allow single-row transactions enabled.
-
Field Details
-
DEFAULT_METADATA_TABLE_NAME
- See Also:
-
CF_INITIAL_TOKEN
- See Also:
-
CF_PARENT_PARTITIONS
- See Also:
-
CF_PARENT_LOW_WATERMARKS
- See Also:
-
CF_WATERMARK
- See Also:
-
CF_CONTINUATION_TOKEN
- See Also:
-
CF_LOCK
- See Also:
-
CF_MISSING_PARTITIONS
- See Also:
-
CF_VERSION
- See Also:
-
CF_SHOULD_DELETE
- See Also:
-
QUALIFIER_DEFAULT
- See Also:
-
COLUMN_FAMILIES
public static final org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.collect.ImmutableList<String> COLUMN_FAMILIES -
NEW_PARTITION_PREFIX
-
STREAM_PARTITION_PREFIX
-
DETECT_NEW_PARTITION_SUFFIX
-
CURRENT_METADATA_TABLE_VERSION
public static final int CURRENT_METADATA_TABLE_VERSION- See Also:
-
-
Constructor Details
-
MetadataTableAdminDao
-
-
Method Details
-
getChangeStreamNamePrefix
Return the prefix used to identify the rows belonging to this job.- Returns:
- the prefix used to identify the rows belonging to this job
-
getTableId
Return the metadata table name.- Returns:
- the metadata table name
-
isAppProfileSingleClusterAndTransactional
Verify the app profile is for single cluster routing with allow single-row transactions enabled. For metadata data operations, the app profile needs to be single cluster routing because it requires read-after-write consistency. Also, the operations depend on single row transactions operations like CheckAndMutateRow.- Returns:
- true if the app profile is single-cluster and allows single-row transactions, otherwise false
-
doesMetadataTableExist
public boolean doesMetadataTableExist()- Returns:
- true if metadata table exists, otherwise false.
-
createMetadataTable
public boolean createMetadataTable()Create the metadata table if it does not exist yet. If the table does exist, verify all the column families exists, if not add those column families. This table only need to be created once per instance. All change streams jobs will use this table. This table is created in the same instance as the table being streamed. While we don't restrict access to the table, manually editing the table can lead to inconsistent beam jobs.- Returns:
- true if the table was successfully created, otherwise false.
-
cleanUpPrefix
public void cleanUpPrefix()Delete all the metadata rows starting with the change stream name prefix, except for detect new partition row because it signals the existence of a pipeline with the change stream name.
-