Chinmay Kulkarni created PHOENIX-5945:
-----------------------------------------

             Summary: TaskRegionObserver can kick off the same tasks multiple 
times if SYSTEM.TASK has split
                 Key: PHOENIX-5945
                 URL: https://issues.apache.org/jira/browse/PHOENIX-5945
             Project: Phoenix
          Issue Type: Bug
    Affects Versions: 4.15.0
            Reporter: Chinmay Kulkarni
             Fix For: 5.1.0, 4.16.0


We don't specify a split policy for 
[SYSTEM.TASK|https://github.com/apache/phoenix/blob/5f9364db7e4925229704706e148e62f4cf4ec4c2/phoenix-core/src/main/java/org/apache/phoenix/query/QueryConstants.java#L381],
 so by default it will be allowed to split. Now if SYSTEM.TASK spans multiple 
regions, each region's 
[postOpen|https://github.com/apache/phoenix/blob/5f9364db7e4925229704706e148e62f4cf4ec4c2/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/TaskRegionObserver.java#L137]
 schedules the SelfHealingTask at the specified interval and so [each region 
will run a FTS on the 
table|https://github.com/apache/phoenix/blob/5f9364db7e4925229704706e148e62f4cf4ec4c2/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/TaskRegionObserver.java#L159]
 and try to kick-off all the incomplete and non-failed tasks.

This can lead to the same tasks being kicked off multiple times as a corner 
race condition in spite of [this 
check|https://github.com/apache/phoenix/blob/5f9364db7e4925229704706e148e62f4cf4ec4c2/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/TaskRegionObserver.java#L187-L195]
 (which is another FTS) and also lead to unnecessary extra load on the server.

We do not explicitly outline that tasks need to be idempotent, so we should 
handle this properly in the TaskRegionObserver so that each region is only 
responsible for tasks lying within its boundaries.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to