Denis Chudov created IGNITE-17428:
-------------------------------------

             Summary: Race between table create and table get
                 Key: IGNITE-17428
                 URL: https://issues.apache.org/jira/browse/IGNITE-17428
             Project: Ignite
          Issue Type: Bug
            Reporter: Denis Chudov


Current version of TableManager#tableAsyncInternal can possibly not detect 
table that is being created while tableAsyncInternal is called. Scenario:
- tableAsyncInternal checks tablesByIdVv.latest() and there is no table
- the table creation started, table metadata appears in meta storage
- TableEvent.CREATE is fired
- tableAsyncInternal registers a listener for TableEvent.CREATE (after it is 
fired for corresponding table)
- tableAsyncInternal checks tablesByIdVv.latest() once again and there still is 
no table, because the table creation is not completed
- {{!isTableConfigured(id)}} condition returns *false* as the table is present 
in meta storage
- {{if (tbl != null && getTblFut.complete(tbl) || !isTableConfigured(id) && 
getTblFut.complete(null))}} evaluates *false* and the future created fot 
getTable never completes.

Possibly we should use VersionedValue#whenComplete instead of creating listener 
for event. The table is present in map wrapped in versioned value only when the 
table creation is completed, and whenComplete allows to create a callback to 
check the table presence.



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

Reply via email to