AlexStocks commented on code in PR #1079:
URL: 
https://github.com/apache/incubator-seata-go/pull/1079#discussion_r3004224500


##########
pkg/rm/tcc/fence/handler/tcc_fence_wrapper_handler.go:
##########
@@ -212,10 +212,13 @@ func (handler *tccFenceWrapperHandler) 
initLogCleanTask(db *sql.DB) {
                        log.Errorf("failed to commit transaction: %v", err)
                }
 
-               // push to clean channel
-               for _, identity := range identityList {
-                       handler.logQueue <- &identity
-               }
+               handler.enqueueFenceLogIdentities(identityList)
+       }
+}
+
+func (handler *tccFenceWrapperHandler) enqueueFenceLogIdentities(identityList 
[]model.FenceLogIdentity) {
+       for i := range identityList {

Review Comment:
   [P0] 修复严重 bug。原代码在循环中取 &identity 地址,所有指针指向同一个变量,导致队列元素全部指向最后一个 identity。修复后 
&identityList[i] 正确。



-- 
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]

Reply via email to