A trace component is used to trace mycat execution deeply(窥探mycat异步执行的神器). #1335
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A component is used to trace mycat execution deeply, which includes basic trace
and frontend-or-backend connection trace, for debug intention and our high qualified
mycat server.
The tracer is disabled by default, and you can enable it by specifying
the system property {@code -Dmycat.trace.enabled=true} and setting log4j
debug level.
跟踪示例:
后端连接创建
-- 后端连接tag - backend#hashCode-id
01/12 02:45:01.364 DEBUG [BusinessExecutor2] (Tracer.java:159) -[backend#17b3295-0] created
[backend#17b3295-0][BusinessExecutor2]> java.lang.Thread.run(Unknown Source)
[backend#17b3295-0][BusinessExecutor2] > java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
[backend#17b3295-0][BusinessExecutor2] > java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
[backend#17b3295-0][BusinessExecutor2] > org.opencloudb.backend.PhysicalDatasource$1.run(PhysicalDatasource.java:342)
[backend#17b3295-0][BusinessExecutor2] > org.opencloudb.mysql.nio.MySQLDataSource.createNewConnection(MySQLDataSource.java:51)
[backend#17b3295-0][BusinessExecutor2] > org.opencloudb.mysql.nio.MySQLConnectionFactory.make(MySQLConnectionFactory.java:77)
前端认证跟踪
-- 前端连接tag - fronend#hashCode-id
-- 2.1 连接创建
01/12 02:45:11.656 DEBUG [$_MyCatServer] (Tracer.java:159) -[fronend#1299f0a-0] created
[fronend#1299f0a-0][$_MyCatServer]> org.opencloudb.net.NIOAcceptor.run(NIOAcceptor.java:91)
[fronend#1299f0a-0][$_MyCatServer] > org.opencloudb.net.NIOAcceptor.accept(NIOAcceptor.java:110)
[fronend#1299f0a-0][$_MyCatServer] > org.opencloudb.net.factory.FrontendConnectionFactory.make(FrontendConnectionFactory.java:48)
-- 2.2 连接认证
01/12 02:45:11.668 DEBUG [$_NIOREACTOR-0-RW] (Tracer.java:159) -[fronend#1299f0a-1] ServerConnection [id=1, schema=null, host=0:0:0:0:0:0:0:1, user=null,txIsolation=3, autocommit=true, schema=null]
[fronend#1299f0a-1][$_NIOREACTOR-0-RW]> java.lang.Thread.run(Unknown Source)
[fronend#1299f0a-1][$_NIOREACTOR-0-RW] > org.opencloudb.net.NIOReactor$RW.run(NIOReactor.java:100)
[fronend#1299f0a-1][$_NIOREACTOR-0-RW] > org.opencloudb.net.AbstractConnection.asynRead(AbstractConnection.java:274)
[fronend#1299f0a-1][$_NIOREACTOR-0-RW] > org.opencloudb.net.NIOSocketWR.asynRead(NIOSocketWR.java:186)
[fronend#1299f0a-1][$_NIOREACTOR-0-RW] > org.opencloudb.net.AbstractConnection.onReadData(AbstractConnection.java:313)
[fronend#1299f0a-1][$_NIOREACTOR-0-RW] > org.opencloudb.net.FrontendConnection.handle(FrontendConnection.java:417)
[fronend#1299f0a-1][$_NIOREACTOR-0-RW] > org.opencloudb.net.FrontendConnection.rawHandle(FrontendConnection.java:435)
[fronend#1299f0a-1][$_NIOREACTOR-0-RW] > org.opencloudb.net.handler.FrontendAuthenticator.handle(FrontendAuthenticator.java:61)