Andrey Mashenkov created IGNITE-25663:
-----------------------------------------

             Summary: Sql. Table statistic calculation may never ends.
                 Key: IGNITE-25663
                 URL: https://issues.apache.org/jira/browse/IGNITE-25663
             Project: Ignite
          Issue Type: Bug
          Components: sql ai3
            Reporter: Andrey Mashenkov


Motivation.

Shortly, it's possible a task, which calculates statistic, may never save a 
results and fall into infinity retry.

Technical details.
Every access to table statistics, tries to trigger a task for calculating 
statistics if the statistics values is older than a threshold 
`thresholdTimeToPostponeUpdateMs`.
Firstly, the task replaces a holder object in the tableSizeMap with the current 
timestamp, then start calculations that finally should lead to publish actual 
data to this holder. 
However, if calculations takes more time than the threshold, one may update the 
holder with the newer timestamp. This leads to the previous task will drop the 
result after completion, because of observing unexpectedly recent timestamp in 
the holder. 

Possible solution.
Let's introduce an `outdated` flag into a placeholder. The flag is raised, when 
a thread triggers calculations, and flag is removed, iff calculations are done 
and timestamp is expected.

With the flag we can ensure only one thread do calculations.
We should NOT trigger calculation in-place, when see the flag raised (means 
other thread do calculations), but update the timestamp. After calculation 
done, we should write the result (to guarantee the progress) and either drop 
the flag or restart calculations regarding the timestamp. 




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

Reply via email to