diff --git a/src/containers/Tenant/i18n/en.json b/src/containers/Tenant/i18n/en.json index 5241e1f774..98af6e8a12 100644 --- a/src/containers/Tenant/i18n/en.json +++ b/src/containers/Tenant/i18n/en.json @@ -43,6 +43,7 @@ "actions.alterTable": "Alter table...", "actions.manageColumns": "Manage columns...", "actions.manageAutoPartitioning": "Manage auto partitioning...", + "actions.manageReadReplicas": "Add read-only replicas...", "actions.addTableIndex": "Add index...", "actions.addVectorIndex": "Add vector index...", "actions.createCdcStream": "Create changefeed...", diff --git a/src/containers/Tenant/utils/schemaActions.tsx b/src/containers/Tenant/utils/schemaActions.tsx index 77faa5ccf5..808b4164e7 100644 --- a/src/containers/Tenant/utils/schemaActions.tsx +++ b/src/containers/Tenant/utils/schemaActions.tsx @@ -47,6 +47,7 @@ import { dropTransferTemplate, dropViewTemplate, manageAutoPartitioningTemplate, + manageReadReplicasTemplate, selectQueryTemplate, showCreateTableTemplate, upsertQueryTemplate, @@ -137,6 +138,7 @@ const bindActions = ( alterTable: inputQuery(alterTableTemplate), dropTable: inputQuery(dropTableTemplate), manageAutoPartitioning: inputQuery(manageAutoPartitioningTemplate), + manageReadReplicas: inputQuery(manageReadReplicasTemplate), selectQuery: inputQuery(selectQueryTemplate), showCreateTable: inputQuery(showCreateTableTemplate), upsertQuery: inputQuery(upsertQueryTemplate), @@ -256,6 +258,10 @@ export const getActions = text: i18n('actions.manageAutoPartitioning'), action: actions.manageAutoPartitioning, }, + { + text: i18n('actions.manageReadReplicas'), + action: actions.manageReadReplicas, + }, ], }; diff --git a/src/containers/Tenant/utils/schemaQueryTemplates.ts b/src/containers/Tenant/utils/schemaQueryTemplates.ts index f9005ce79a..a52f145f77 100644 --- a/src/containers/Tenant/utils/schemaQueryTemplates.ts +++ b/src/containers/Tenant/utils/schemaQueryTemplates.ts @@ -143,6 +143,18 @@ ALTER TABLE ${path} SET AUTO_PARTITIONING_MAX_PARTITIONS_COUNT = 100 -- Partitions are split only if their number doesn't exceed the value specified by this parameter. )`; }; + +export const manageReadReplicasTemplate = (params?: SchemaQueryParams) => { + const path = params?.relativePath + ? `\`${normalizeParameter(params.relativePath)}\`` + : '${1:}'; + + return `ALTER TABLE ${path} SET +( + READ_REPLICAS_SETTINGS = 'PER_AZ:1' -- Enable read replicas for stale read, launch one replica in every availability zone. docs: https://clck.ru/3Qh8iQ +)`; +}; + export const selectQueryTemplate = (params?: SchemaQueryParams) => { const path = params?.relativePath ? `\`${normalizeParameter(params.relativePath)}\``