Kirill Sizov created IGNITE-20379:
--------------------------------------

             Summary: Concurrency issues with write intent tracking
                 Key: IGNITE-20379
                 URL: https://issues.apache.org/jira/browse/IGNITE-20379
             Project: Ignite
          Issue Type: Bug
            Reporter:  Kirill Sizov


There are a few concurrency issues with the write intent tracking code



1. See {{PendingRows}} class. The value is a TreeSet, which is not a concurrent 
collection. Thus it's not safe to do the read this way:
{code}
  public Set<RowId> getPendingRowIds(UUID txId) {
        return txsPendingRowIds.getOrDefault(txId, EMPTY_SET);
    }
{code}

2. See {{StorageUpdateHandler.handleTransactionCleanup}}. We first get a 
collection of rows for a specific transaction from the map, then process the 
rows in the storage, then remove the whole transaction entry from the map:
{code}
    public void handleTransactionCleanup(UUID txId, boolean commit, @Nullable 
HybridTimestamp commitTimestamp) {
        Set<RowId> pendingRowIds = pendingRows.getPendingRowIds(txId);

        handleTransactionCleanup(pendingRowIds, commit, commitTimestamp, () -> 
pendingRows.removePendingRowIds(txId));
    }
{code}

If a parallel thread adds more write intents to the map, we'll silently lose 
them.




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to