Ethan-Xingyue commented on PR #1140: URL: https://github.com/apache/incubator-seata-go/pull/1140#issuecomment-5301186758
> 感谢 review,下面几点分别是对应review所指出的设计意图 > > 1. 其实聚合路径给用户返回的也是 last result,因为底层驱动用的是 `go-sql-driver/mysql v1.6.0 ` ,得升级到1.8.0才能在一条聚合的情况下得到一个 sum RowsAffected 。如果要升级的话,感觉可以放到 follow-up pr 去做。所以这里两条路径返回的都是 last result,我补充下comment > 2. 这个我还没有想到更好的方案让注册了 `update/delete hook` 的sql 走聚合路径,我先让他走顺序执行然后补充日志 > 3. 这个`HooksForSQLType` 不仅用来判断长度,顺序子执行器也会调用 > > ```go > childHooks := hooksForSQLType(parseCtx.SQLType)//multi_sequential_executor.go:148 > ``` > > 另外在聚合判断中,只有有hook的才会进行复制,而且是只会给第一个有hook的statement进行复制,最多只浪费一次切片复制 > > 4. `rejectATPreparedMultiSQL` fails open 这里是只拒绝能够确认的 multi-SQL,执行阶段仍会进行正常解析。(我补充下comment) > 5. `execSequential` 重新解析每条语句其实不只是为了检查执行器类型是否变化,这个主要是为了重置子语句参数占位符的索引,从而防止越界/取错参数: > > 多语句整体解析时,占位符序号是全局连续的,例如: > > ``` > UPDATE t_user SET name = ? WHERE id = ?; > DELETE FROM t_user WHERE user_id = ?; > ``` > > 这个在整体AST中的参数序号是:`UPDATE:0,1` `DELETE:2` 但是在顺序执行时,代码是把参数拆成子语句自己的切片,并重新设置 `driver.NamedValue.Ordinal`: > > ``` > UPDATE args:[name, id] > DELETE args:[user_id] > ``` > > 这个在 `multi_sequential_executor_test.go`的`TestReparseStatementResetsParameterOrders (214)` 测试已验证。 我接下来补充下comment > > 6. 这个我打算放到follow-up pr 去实现 > 7. 第8点不是有意的,我调整下 Okay, thank you very much for the answer. Because the code is a bit long, I haven't finished crit yet, but so far it seems there aren't any major problems. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
