复古 护眼 海天 深邃 暗黑 默认

ALTER SHADOW RULE

描述

ALTER SHADOW RULE 语法用于修改影子库压测规则。

语法定义

AlterShadowRule ::=
  'ALTER' 'SHADOW' 'RULE' shadowDefinition ( ',' shadowDefinition )*

shadowDefinition ::=
  ruleName '(' storageUnitMapping shadowTableRule ( ',' shadowTableRule )* ')'
    
storageUnitMapping ::=
    'SOURCE' '=' storageUnitName ',' 'SHADOW' '=' storageUnitName

shadowTableRule ::=
    tableName '(' shadowAlgorithm ')'
    
shadowAlgorithm ::=
    'TYPE' '('  'NAME' '=' shadowAlgorithmType ',' 'PROPERTIES' '(' 'key' '=' 'value' ( ',' 'key' '=' 'value' ) ')'

ruleName ::=
  identifier

storageUnitName ::=
  identifier

tableName ::=
  identifier

algorithmName ::=
  identifier

shadowAlgorithmType ::=
  string

补充说明

  • storageUnitMapping 指定源数据库和影子库的映射关系,需使用 RDL 管理的 STORAGE UNIT ,请参考 存储单元
  • shadowAlgorithm 可同时作用于多个 shadowTableRule
  • algorithmName 会根据 ruleNametableNameshadowAlgorithmType 自动生成;
  • shadowAlgorithmType 目前支持 VALUE_MATCHREGEX_MATCHSIMPLE_HINT

示例

  • 修改影子库压测规则
ALTER SHADOW RULE shadow_rule(
  SOURCE=demo_su,
  SHADOW=demo_su_shadow,
  t_order(TYPE(NAME="SIMPLE_HINT", PROPERTIES("shadow"="true", "foo"="bar"))), 
  t_order_item(TYPE(NAME="VALUE_MATCH", PROPERTIES("operation"="insert","column"="user_id", "value"='1')))
);

保留字

ALTERSHADOWRULESOURCESHADOWTYPENAMEPROPERTIES

相关链接