Open dyrnq opened 1 month ago
附上mysql5的测试
root@debian:~# tcpdump -i lo port 34306 -vv
tcpdump: listening on lo, link-type EN10MB (Ethernet), snapshot length 262144 bytes
13:08:14.835777 IP (tos 0x0, ttl 64, id 26090, offset 0, flags [DF], proto TCP (6), length 52)
localhost.41560 > localhost.34306: Flags [S], cksum 0xfe28 (incorrect -> 0xb0a6), seq 455180998, win 65535, options [mss 65495,nop,nop,sackOK,nop,wscale 9], length 0
13:08:14.835790 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 52)
localhost.34306 > localhost.41560: Flags [S.], cksum 0xfe28 (incorrect -> 0x0fac), seq 2019502218, ack 455180999, win 65535, options [mss 65495,nop,nop,sackOK,nop,wscale 9], length 0
13:08:14.835799 IP (tos 0x0, ttl 64, id 26091, offset 0, flags [DF], proto TCP (6), length 40)
localhost.41560 > localhost.34306: Flags [.], cksum 0xfe1c (incorrect -> 0x4a24), seq 1, ack 1, win 128, length 0
13:08:14.836233 IP (tos 0x0, ttl 64, id 6571, offset 0, flags [DF], proto TCP (6), length 122)
localhost.34306 > localhost.41560: Flags [P.], cksum 0xfe6e (incorrect -> 0xa192), seq 1:83, ack 1, win 128, length 82
13:08:14.836239 IP (tos 0x0, ttl 64, id 26092, offset 0, flags [DF], proto TCP (6), length 40)
localhost.41560 > localhost.34306: Flags [.], cksum 0xfe1c (incorrect -> 0x49d2), seq 1, ack 83, win 128, length 0
13:08:14.862749 IP (tos 0x0, ttl 64, id 26093, offset 0, flags [DF], proto TCP (6), length 125)
localhost.41560 > localhost.34306: Flags [P.], cksum 0xfe71 (incorrect -> 0x6d5e), seq 1:86, ack 83, win 128, length 85
13:08:14.862768 IP (tos 0x0, ttl 64, id 6572, offset 0, flags [DF], proto TCP (6), length 40)
localhost.34306 > localhost.41560: Flags [.], cksum 0xfe1c (incorrect -> 0x497d), seq 83, ack 86, win 128, length 0
13:08:14.862939 IP (tos 0x0, ttl 64, id 6573, offset 0, flags [DF], proto TCP (6), length 51)
localhost.34306 > localhost.41560: Flags [P.], cksum 0xfe27 (incorrect -> 0x4266), seq 83:94, ack 86, win 128, length 11
13:08:14.863744 IP (tos 0x0, ttl 64, id 26094, offset 0, flags [DF], proto TCP (6), length 44)
localhost.41560 > localhost.34306: Flags [P.], cksum 0xfe20 (incorrect -> 0x2a66), seq 86:90, ack 94, win 128, length 4
13:08:14.863774 IP (tos 0x0, ttl 64, id 26095, offset 0, flags [DF], proto TCP (6), length 71)
localhost.41560 > localhost.34306: Flags [P.], cksum 0xfe3b (incorrect -> 0xa450), seq 90:121, ack 94, win 128, length 31
13:08:14.863793 IP (tos 0x0, ttl 64, id 6574, offset 0, flags [DF], proto TCP (6), length 40)
localhost.34306 > localhost.41560: Flags [.], cksum 0xfe1c (incorrect -> 0x494f), seq 94, ack 121, win 128, length 0
13:08:14.864584 IP (tos 0x0, ttl 64, id 6575, offset 0, flags [DF], proto TCP (6), length 224)
localhost.34306 > localhost.41560: Flags [P.], cksum 0xfed4 (incorrect -> 0x33e0), seq 94:278, ack 121, win 128, length 184
13:08:14.864739 IP (tos 0x0, ttl 64, id 26096, offset 0, flags [DF], proto TCP (6), length 40)
localhost.41560 > localhost.34306: Flags [.], cksum 0xfe1c (incorrect -> 0x4797), seq 121, ack 278, win 384, length 0
13:08:14.867952 IP (tos 0x0, ttl 64, id 26097, offset 0, flags [DF], proto TCP (6), length 44)
localhost.41560 > localhost.34306: Flags [P.], cksum 0xfe20 (incorrect -> 0x298b), seq 121:125, ack 278, win 384, length 4
13:08:14.867992 IP (tos 0x0, ttl 64, id 26098, offset 0, flags [DF], proto TCP (6), length 70)
localhost.41560 > localhost.34306: Flags [P.], cksum 0xfe3a (incorrect -> 0xcdd6), seq 125:155, ack 278, win 384, length 30
13:08:14.868020 IP (tos 0x0, ttl 64, id 6576, offset 0, flags [DF], proto TCP (6), length 40)
localhost.34306 > localhost.41560: Flags [.], cksum 0xfe1c (incorrect -> 0x4875), seq 278, ack 155, win 128, length 0
13:08:14.868891 IP (tos 0x0, ttl 64, id 6577, offset 0, flags [DF], proto TCP (6), length 223)
localhost.34306 > localhost.41560: Flags [P.], cksum 0xfed3 (incorrect -> 0x3f88), seq 278:461, ack 155, win 128, length 183
13:08:14.869419 IP (tos 0x0, ttl 64, id 26099, offset 0, flags [DF], proto TCP (6), length 44)
localhost.41560 > localhost.34306: Flags [P.], cksum 0xfe20 (incorrect -> 0x27b2), seq 155:159, ack 461, win 640, length 4
13:08:14.869449 IP (tos 0x0, ttl 64, id 26100, offset 0, flags [DF], proto TCP (6), length 70)
localhost.41560 > localhost.34306: Flags [P.], cksum 0xfe3a (incorrect -> 0x19c3), seq 159:189, ack 461, win 640, length 30
13:08:14.869472 IP (tos 0x0, ttl 64, id 6578, offset 0, flags [DF], proto TCP (6), length 40)
localhost.34306 > localhost.41560: Flags [.], cksum 0xfe1c (incorrect -> 0x479c), seq 461, ack 189, win 128, length 0
13:08:14.870923 IP (tos 0x0, ttl 64, id 6579, offset 0, flags [DF], proto TCP (6), length 507)
localhost.34306 > localhost.41560: Flags [P.], cksum 0xffef (incorrect -> 0xb290), seq 461:928, ack 189, win 128, length 467
13:08:14.871620 IP (tos 0x0, ttl 64, id 26101, offset 0, flags [DF], proto TCP (6), length 44)
localhost.41560 > localhost.34306: Flags [P.], cksum 0xfe20 (incorrect -> 0x29bd), seq 189:193, ack 928, win 896, length 4
13:08:14.871652 IP (tos 0x0, ttl 64, id 26102, offset 0, flags [DF], proto TCP (6), length 65)
localhost.41560 > localhost.34306: Flags [P.], cksum 0xfe35 (incorrect -> 0xed50), seq 193:218, ack 928, win 896, length 25
13:08:14.871675 IP (tos 0x0, ttl 64, id 6580, offset 0, flags [DF], proto TCP (6), length 40)
localhost.34306 > localhost.41560: Flags [.], cksum 0xfe1c (incorrect -> 0x45ac), seq 928, ack 218, win 128, length 0
13:08:14.871841 IP (tos 0x0, ttl 64, id 6581, offset 0, flags [DF], proto TCP (6), length 85)
localhost.34306 > localhost.41560: Flags [P.], cksum 0xfe49 (incorrect -> 0x6b08), seq 928:973, ack 218, win 128, length 45
13:08:14.873352 IP (tos 0x0, ttl 64, id 26103, offset 0, flags [DF], proto TCP (6), length 40)
localhost.41560 > localhost.34306: Flags [F.], cksum 0xfe1c (incorrect -> 0x427e), seq 218, ack 973, win 896, length 0
13:08:14.873598 IP (tos 0x0, ttl 64, id 6582, offset 0, flags [DF], proto TCP (6), length 40)
localhost.34306 > localhost.41560: Flags [F.], cksum 0xfe1c (incorrect -> 0x457d), seq 973, ack 219, win 128, length 0
13:08:14.873607 IP (tos 0x0, ttl 64, id 26104, offset 0, flags [DF], proto TCP (6), length 40)
localhost.41560 > localhost.34306: Flags [.], cksum 0xfe1c (incorrect -> 0x427d), seq 219, ack 974, win 896, length 0
13:08:14.838 [main] INFO com.alibaba.otter.canal.parse.driver.mysql.MysqlConnector - connect MysqlConnection to /127.0.0.1:34306...
13:08:14.843 [main] INFO com.alibaba.otter.canal.parse.driver.mysql.MysqlConnector - handshake initialization packet received, prepare the client authentication packet to send
13:08:14.843 [main] INFO com.alibaba.otter.canal.parse.driver.mysql.MysqlConnector - auth plugin: mysql_native_password
13:08:14.862 [main] INFO com.alibaba.otter.canal.parse.driver.mysql.MysqlConnector - client authentication packet is sent out.
13:08:14.869 [main] INFO com.alibaba.otter.canal.parse.driver.mysql.MysqlConnector - connect MysqlConnection in sslMode DISABLED, Ssl_version:, Ssl_cipher:
ResultSetPacket [fieldDescriptors=[FieldPacket [catalog=def, character=224, db=, decimals=0, definition=null, flags=4097, length=256, name=Variable_name, originalName=Variable_name, originalTable=session_variables, table=session_variables, type=-3], FieldPacket [catalog=def, character=224, db=, decimals=0, definition=null, flags=0, length=4096, name=Value, originalName=Value, originalTable=session_variables, table=session_variables, type=-3]], fieldValues=[character_set_client, utf8mb4, character_set_connection, utf8mb4, character_set_database, utf8mb4, character_set_filesystem, binary, character_set_results, utf8mb4, character_set_server, utf8mb4, character_set_system, utf8, character_sets_dir, /usr/share/mysql/charsets/], sourceAddress=/127.0.0.1:34306]
java.io.IOException: ErrorPacket [errorNumber=1146, fieldCount=-1, message=Table 'test.test1' doesn't exist, sqlState=42S02, sqlStateMarker=#]
with command: select * from test.test1
at com.alibaba.otter.canal.parse.driver.mysql.MysqlQueryExecutor.query(MysqlQueryExecutor.java:61)
at com.alibaba.otter.canal.parse.driver.mysql.MysqlConnectorTest.testQuery(MysqlConnectorTest.java:24)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:232)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:55)
13:08:14.873 [main] INFO com.alibaba.otter.canal.parse.driver.mysql.MysqlConnector - disConnect MysqlConnection to /127.0.0.1:34306...
java.lang.AssertionError: ErrorPacket [errorNumber=1146, fieldCount=-1, message=Table 'test.test1' doesn't exist, sqlState=42S02, sqlStateMarker=#]
with command: select * from test.test1
at org.junit.Assert.fail(Assert.java:88)
at com.alibaba.otter.canal.parse.driver.mysql.MysqlConnectorTest.testQuery(MysqlConnectorTest.java:28)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:232)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:55)
经过回滚测试
将代码回滚到 https://github.com/alibaba/canal/commit/b8c2a757a02e89bb36966d4c4a4b4eef6d252cf0,测试通过。
git checkout -b newbranch b8c2a757a02e89bb36966d4c4a4b4eef6d252cf0
14:30:08.804 [main] INFO com.alibaba.otter.canal.parse.driver.mysql.MysqlConnector - connect MysqlConnection to /127.0.0.1:33306...
14:30:08.809 [main] INFO com.alibaba.otter.canal.parse.driver.mysql.MysqlConnector - handshake initialization packet received, prepare the client authentication packet to send
14:30:08.832 [main] INFO com.alibaba.otter.canal.parse.driver.mysql.MysqlConnector - client authentication packet is sent out.
14:30:08.833 [main] INFO com.alibaba.otter.canal.parse.driver.mysql.MysqlConnector - auth switch pluginName is caching_sha2_password.
14:30:08.833 [main] INFO com.alibaba.otter.canal.parse.driver.mysql.MysqlConnector - auth switch response packet is sent out.
14:30:08.834 [main] INFO com.alibaba.otter.canal.parse.driver.mysql.MysqlConnector - caching sha2 password fullAuth request public key packet is sent out.
14:30:08.835 [main] INFO com.alibaba.otter.canal.parse.driver.mysql.MysqlConnector - caching sha2 password fullAuth get server public key succeed.
14:30:08.881 [main] INFO com.alibaba.otter.canal.parse.driver.mysql.MysqlConnector - caching sha2 password fullAuth response auth data packet is sent out.
ResultSetPacket [fieldDescriptors=[FieldPacket [catalog=def, character=33, db=performance_schema, decimals=0, definition=null, flags=4097, length=192, name=Variable_name, originalName=Variable_name, originalTable=session_variables, table=session_variables, type=-3], FieldPacket [catalog=def, character=33, db=performance_schema, decimals=0, definition=null, flags=0, length=3072, name=Value, originalName=Value, originalTable=session_variables, table=session_variables, type=-3]], fieldValues=[character_set_client, utf8mb3, character_set_connection, utf8mb3, character_set_database, utf8mb4, character_set_filesystem, binary, character_set_results, utf8mb3, character_set_server, utf8mb4, character_set_system, utf8mb3, character_sets_dir, /usr/share/mysql-8.0/charsets/], sourceAddress=/127.0.0.1:33306]
14:30:08.894 [main] INFO com.alibaba.otter.canal.parse.driver.mysql.MysqlConnector - disConnect MysqlConnection to /127.0.0.1:33306...
java.lang.AssertionError: ErrorPacket [errorNumber=1049, fieldCount=-1, message=Unknown database 'test', sqlState=42000, sqlStateMarker=#]
with command: select * from test.test1
at org.junit.Assert.fail(Assert.java:88)
at com.alibaba.otter.canal.parse.driver.mysql.MysqlConnectorTest.testQuery(MysqlConnectorTest.java:27)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:232)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:55)
正确的抓包信息
root@debian:~# tcpdump -i lo port 33306 -vv
tcpdump: listening on lo, link-type EN10MB (Ethernet), snapshot length 262144 bytes
15:00:37.572296 IP (tos 0x0, ttl 64, id 62340, offset 0, flags [DF], proto TCP (6), length 52)
localhost.3784 > localhost.33306: Flags [S], cksum 0xfe28 (incorrect -> 0xec1f), seq 3672383234, win 65535, options [mss 65495,nop,nop,sackOK,nop,wscale 9], length 0
15:00:37.572308 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 52)
localhost.33306 > localhost.3784: Flags [S.], cksum 0xfe28 (incorrect -> 0x09c7), seq 309579732, ack 3672383235, win 65535, options [mss 65495,nop,nop,sackOK,nop,wscale 9], length 0
15:00:37.572316 IP (tos 0x0, ttl 64, id 62341, offset 0, flags [DF], proto TCP (6), length 40)
localhost.3784 > localhost.33306: Flags [.], cksum 0xfe1c (incorrect -> 0x443f), seq 1, ack 1, win 128, length 0
15:00:37.572631 IP (tos 0x0, ttl 64, id 1250, offset 0, flags [DF], proto TCP (6), length 118)
localhost.33306 > localhost.3784: Flags [P.], cksum 0xfe6a (incorrect -> 0xdddb), seq 1:79, ack 1, win 128, length 78
15:00:37.572634 IP (tos 0x0, ttl 64, id 62342, offset 0, flags [DF], proto TCP (6), length 40)
localhost.3784 > localhost.33306: Flags [.], cksum 0xfe1c (incorrect -> 0x43f1), seq 1, ack 79, win 128, length 0
15:00:37.600404 IP (tos 0x0, ttl 64, id 62343, offset 0, flags [DF], proto TCP (6), length 125)
localhost.3784 > localhost.33306: Flags [P.], cksum 0xfe71 (incorrect -> 0x601e), seq 1:86, ack 79, win 128, length 85
15:00:37.600418 IP (tos 0x0, ttl 64, id 1251, offset 0, flags [DF], proto TCP (6), length 40)
localhost.33306 > localhost.3784: Flags [.], cksum 0xfe1c (incorrect -> 0x439c), seq 79, ack 86, win 128, length 0
15:00:37.600553 IP (tos 0x0, ttl 64, id 1252, offset 0, flags [DF], proto TCP (6), length 88)
localhost.33306 > localhost.3784: Flags [P.], cksum 0xfe4c (incorrect -> 0xb65d), seq 79:127, ack 86, win 128, length 48
15:00:37.602137 IP (tos 0x0, ttl 64, id 62344, offset 0, flags [DF], proto TCP (6), length 76)
localhost.3784 > localhost.33306: Flags [P.], cksum 0xfe40 (incorrect -> 0x0818), seq 86:122, ack 127, win 128, length 36
15:00:37.602318 IP (tos 0x0, ttl 64, id 1253, offset 0, flags [DF], proto TCP (6), length 57)
localhost.33306 > localhost.3784: Flags [P.], cksum 0xfe2d (incorrect -> 0x3921), seq 127:144, ack 122, win 128, length 17
15:00:37.602804 IP (tos 0x0, ttl 64, id 62345, offset 0, flags [DF], proto TCP (6), length 44)
localhost.3784 > localhost.33306: Flags [P.], cksum 0xfe20 (incorrect -> 0x252b), seq 122:126, ack 144, win 128, length 4
15:00:37.602972 IP (tos 0x0, ttl 64, id 62346, offset 0, flags [DF], proto TCP (6), length 70)
localhost.3784 > localhost.33306: Flags [P.], cksum 0xfe3a (incorrect -> 0x173c), seq 126:156, ack 144, win 128, length 30
15:00:37.602989 IP (tos 0x0, ttl 64, id 1254, offset 0, flags [DF], proto TCP (6), length 40)
localhost.33306 > localhost.3784: Flags [.], cksum 0xfe1c (incorrect -> 0x4315), seq 144, ack 156, win 128, length 0
15:00:37.604466 IP (tos 0x0, ttl 64, id 1255, offset 0, flags [DF], proto TCP (6), length 550)
localhost.33306 > localhost.3784: Flags [P.], cksum 0x001b (incorrect -> 0x2e35), seq 144:654, ack 156, win 128, length 510
15:00:37.604528 IP (tos 0x0, ttl 64, id 62347, offset 0, flags [DF], proto TCP (6), length 40)
localhost.3784 > localhost.33306: Flags [.], cksum 0xfe1c (incorrect -> 0x4017), seq 156, ack 654, win 384, length 0
15:00:37.607370 IP (tos 0x0, ttl 64, id 62348, offset 0, flags [DF], proto TCP (6), length 44)
localhost.3784 > localhost.33306: Flags [P.], cksum 0xfe20 (incorrect -> 0x270b), seq 156:160, ack 654, win 384, length 4
15:00:37.607400 IP (tos 0x0, ttl 64, id 62349, offset 0, flags [DF], proto TCP (6), length 65)
localhost.3784 > localhost.33306: Flags [P.], cksum 0xfe35 (incorrect -> 0xea9e), seq 160:185, ack 654, win 384, length 25
15:00:37.607411 IP (tos 0x0, ttl 64, id 1256, offset 0, flags [DF], proto TCP (6), length 40)
localhost.33306 > localhost.3784: Flags [.], cksum 0xfe1c (incorrect -> 0x40fa), seq 654, ack 185, win 128, length 0
15:00:37.607761 IP (tos 0x0, ttl 64, id 1257, offset 0, flags [DF], proto TCP (6), length 76)
localhost.33306 > localhost.3784: Flags [P.], cksum 0xfe40 (incorrect -> 0x89b1), seq 654:690, ack 185, win 128, length 36
15:00:37.608226 IP (tos 0x0, ttl 64, id 62350, offset 0, flags [DF], proto TCP (6), length 40)
localhost.3784 > localhost.33306: Flags [F.], cksum 0xfe1c (incorrect -> 0x3fd5), seq 185, ack 690, win 384, length 0
15:00:37.608329 IP (tos 0x0, ttl 64, id 1258, offset 0, flags [DF], proto TCP (6), length 95)
localhost.33306 > localhost.3784: Flags [P.], cksum 0xfe53 (incorrect -> 0xd3f6), seq 690:745, ack 186, win 128, length 55
15:00:37.608344 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 40)
localhost.3784 > localhost.33306: Flags [R], cksum 0x265b (correct), seq 3672383420, win 0, length 0
经过对比测试,代码的执行逻辑在于
正确的代码会进入这个else的分支,打印输出logger.info("auth switch pluginName is {}.", pluginName);
} else {
AuthSwitchRequestPacket packet = new AuthSwitchRequestPacket();
packet.fromBytes(body);
authData = packet.authData;
pluginName = packet.authName;
logger.info("auth switch pluginName is {}.", pluginName);
}
同样的问题
使用MysqlConnectorTest测试抓包如下