mycat路由模块

来源:互联网 发布:简历管理系统知乎 编辑:程序博客网 时间:2024/06/07 21:21

接受连接就不说了 nio的事情

接受完之后会使用ServerConnectionFactory#getConnection 获取一个连接ServerConnection



然后就是

FrontendCommandHandler#handle  这个handle内部维护了一个source 就是FrontendConnection 如果是查询 就会source.query(data);

FrontendConnection#query 

queryHandler.query(sql); 根据sql的类型 调用各种handler ShowHandler 等等

ServerConnection#execute

ServerConnection#routeEndExecuteSQL

rrs = MycatServer
.getInstance()
.getRouterservice()
.route(MycatServer.getInstance().getConfig().getSystem(),
schema, type, sql, this.charset, this);

进入route之后不管if 看else (先不管注解的情况,只看普通的sql)

RouteStrategyFactory.getRouteStrategy().route(sysconf, schema, sqlType, stmt,
charset, sc, tableId2DataNodeCache);

然后开始路由了。。下班了。。休息下。。。下次在继续做笔记

原创粉丝点击