You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "ivandasch (via GitHub)" <gi...@apache.org> on 2023/05/26 07:34:02 UTC

[GitHub] [ignite] ivandasch commented on a diff in pull request #10732: IGNITE-19529 IgniteTxStateImpl's non-thread safe fields may cause incorrect node behavior

ivandasch commented on code in PR #10732:
URL: https://github.com/apache/ignite/pull/10732#discussion_r1206347132


##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxStateImpl.java:
##########
@@ -57,51 +57,49 @@
  */
 public class IgniteTxStateImpl extends IgniteTxLocalStateAdapter {
     /** Active cache IDs. */
-    private GridIntList activeCacheIds = new GridIntList();
+    private final GridIntList activeCacheIds = new GridIntList();
 
     /** Per-transaction read map. */
     @GridToStringExclude
-    protected Map<IgniteTxKey, IgniteTxEntry> txMap;
+    private Map<IgniteTxKey, IgniteTxEntry> txMap;
 
     /** Read view on transaction map. */
     @GridToStringExclude
-    protected IgniteTxMap readView;
+    private IgniteTxMap readView;
 
     /** Write view on transaction map. */
     @GridToStringExclude
-    protected IgniteTxMap writeView;
+    private IgniteTxMap writeView;
 
     /** */
     @GridToStringInclude
-    protected Boolean recovery;
+    private Boolean recovery;
 
     /** */
     @GridToStringInclude
-    protected Boolean mvccEnabled;
+    private Boolean mvccEnabled;
 
     /** Cache ids used for mvcc caching. See {@link MvccCachingManager}. */
-    private GridIntList mvccCachingCacheIds = new GridIntList();
+    private final GridIntList mvccCachingCacheIds = new GridIntList();
 
     /** {@inheritDoc} */
     @Override public boolean implicitSingle() {
         return false;
     }
 
     /** {@inheritDoc} */
-    @Nullable @Override public Integer firstCacheId() {
+    @Nullable @Override public synchronized Integer firstCacheId() {
         return activeCacheIds.isEmpty() ? null : activeCacheIds.get(0);
     }
 
     /** {@inheritDoc} */
-    @Nullable @Override public GridIntList cacheIds() {
+    @Nullable @Override public synchronized GridIntList cacheIds() {

Review Comment:
   It seems that we should return a copy here



-- 
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-unsubscribe@ignite.apache.org

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