funky-eyes commented on PR #7344:
URL: https://github.com/apache/incubator-seata/pull/7344#issuecomment-2891159661

   > I’ve written one question above!
   > 
   > Also, I think it would be great to add a unit test to verify that the 
`checkSize` method is called when in Raft mode.
   > 
   > If that unit test is added, I believe a full integration test may not be 
strictly necessary.
   
   In "file" mode, because GlobalSession and BranchSession instances need to be 
written to disk, their encode method is inevitably called when these instances 
are added. At this stage, the transaction size is validated. Conversely, "db" 
and "redis" modes do not require writing transaction information to disk, so 
the encode method is not called at all; consequently, these modes do not 
perform a transaction size check.
   
   In "raft" mode, however, transaction information is stored entirely in 
memory. It's only when a Raft snapshot needs to be created that these in-memory 
transactions are flushed to disk. If the encode method is executed at this 
point, it's too late. This can lead to snapshot creation failure because if a 
transaction in memory exceeds the maximum size limit, a runtime exception is 
thrown, causing the snapshot process to fail. Therefore, for "raft" mode, the 
transaction size check is performed belatedly. The purpose of this pull request 
(PR) is to implement this check at an earlier stage to prevent the 
aforementioned issue.


-- 
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: notifications-unsubscr...@seata.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@seata.apache.org
For additional commands, e-mail: notifications-h...@seata.apache.org

Reply via email to