wesql / wescale

WeScale is a Modern MySQL proxy that supports read-write-split, read-after-write-consistency, load balancing and OnlineDDL.
Apache License 2.0
199 stars 8 forks source link

feat: add wescale filter cmd #475

Closed newborn22 closed 5 months ago

newborn22 commented 5 months ago

Related Issue(s) & Descriptions

Checklist

earayu commented 5 months ago

ERROR 1105 (HY000): vttablet: rpc error: code = Unknown desc = action type: FAIL have no parameters to set

create filter if not exists (
        name='test1',
        desc='test description',
        priority='1000',
        status='ACTIVE'
)
with_pattern(
        plans='Select,Insert',
        fully_qualified_table_names='d1.t1',
        query_regex='',
        query_template='',
        request_ip_regex='',
        user_regex='',
        leading_comment_regex='',
        trailing_comment_regex='',
        bind_var_conds=''
)
execute(
        action='FAIL',
        action_args=''
);

For thoses actions that do not require args, UserActionArgsToJSON would return error.

earayu commented 5 months ago
mysql> create filter if not exists (         name='test1',         desc='test description',         priority='1000',         status='ACTIVE' ) with_pattern(         plans='Select,Insert',         fully_qualified_table_names='d1.t1',         query_regex='',         query_template='',         request_ip_regex='',         user_regex='',         leading_comment_regex='',         trailing_comment_regex='',         bind_var_conds='' ) execute(         action='FAIL',         action_args='' );
ERROR 1046 (3D000): VT09005: No database selected

I think we should allow users to create filter even if they didn't specify the database

earayu commented 5 months ago
create filter if not exists (         name='test1',         desc='test description',         priority='1000',         status='ACTIVE' ) with_pattern(         plans='Select,Insert',         fully_qualified_table_names='d1.t1',         query_regex='',         query_template='',         request_ip_regex='',         user_regex='',         leading_comment_regex='',         trailing_comment_regex='',         bind_var_conds='' ) execute(         action='FAIL',         action_args='' );

The if not exists doesn't work

earayu commented 5 months ago

add more tests