mycat 功能提交联系讨论 qq:294712221
动态注解
属性名 | 值 | 数量限制 |
annotations | 多个动态注解配置 | 无 |
annotation-type | single(暂时只支持单节点) | 1 |
annotation-name | 动态注解名字 | 1 |
annotation-column-name-list | 分片字段名列表,以英文逗号 分隔多个(正则表达式) | 无 |
annotation-column-value-list | 分片字段值列表,以英文逗号 分隔多个(正则表达式) | 无 |
annotation-table-name | 分片逻辑表名字 | 1 |
annotation-additional-list | 供路由算法使用的额外信息 | 无 |
*single 类型下 annotation-column-name-list 和 annotation-column-value-list 只支持写一个
annotation-name,
annotation-column-name-list,
annotation-column-value-list,
annotation-table-name,
annotation-additional-list
最终参数值都是正则表达式
Mycat 接收 MySQL 客户端报文,得出 SQL 字符串,然后把此 SQL 作为动态注解的参数和当前
schema,调用动态注解,然后动态注解返回上表信息
配置样例:
annotations:
- annotation:
type: single
name: annotation-name
columnNameList: id
columnValueList: ^[1-9]\d*$
tableName: travelrecord
additional:
- param1: ^[1-9]\d*$
- param2: ^[1-9]\d*$
例子: https://gist.github.com/junwen12221/d3edc3d9c0973effc99a918b445b8eff
性能要求:不包含括号的 SQL 解析,单线程不少于每秒 35W 次调用
void processSQL(CharSequence sql, String schema) throws ParseException;
第一个参数的类型可以是 byte[],ByteBuffer,CharBuffer,甚至是指向堆外的指针 long 以及它的长度
int