[ 
https://issues.apache.org/jira/browse/GEODE-2714?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Hitesh Khamesra updated GEODE-2714:
-----------------------------------
    Description: 
Function execution is the most useful feature of Geode. It allows you to 
execute a user-defined function on the node which holds the primary bucket of 
the partition region. In many cases application has colocated partition regions 
and using function application can operate on all the colocated primary buckets.

In that function, the application makes sure that no other thread is operating 
on same colocated keys. But during bucket rebalance there is a possibility that 
two thread might be executing a function on the same set of keys on different 
nodes.

It can happen as we don't take the lock(read-lock) on a primary bucket while 
executing the function. That allows Geode to move bucket for rebalancing.

Proposal: Introduce the following api on Function interface to indicate the 
need to primariness.

boolean acquirePrimaryBucketLock(); // name suggestion?

The application would return true if they need a lock on the primary bucket. 
Default would be false.

Geode would call the interface and try to take readLock before executing the 
function on that node. Otherwise, it will throw the exception and let app 
re-execute that function.

  was:
Function execution is the most useful feature of Geode. It allows you to 
execute a user-defined function on the node which holds the primary bucket of 
the partition region. In many cases application has colocated partition regions 
and using function application can operate on all the colocated primary buckets.

In that function, the application makes sure that no other thread is operating 
on same colocated keys. But during bucket rebalance there is a possibility that 
two thread might be executing a function on the same set of keys on different 
nodes.

It can happen as we don't take the lock(read-lock) on a primary bucket while 
executing the function. That allows Geode to move bucket for rebalancing.

Proposal: Introduce the following api on Function interface to indicate the 
need to primariness.

boolean needPrimaryLock(); // name suggestion?

The application would return true if they need a lock on the primary bucket. 
Default would be false.

Geode would call the interface and try to take readLock before executing the 
function on that node. Otherwise, it will throw the exception and let app 
re-execute that function.


> Proposal for new api on Function interface
> ------------------------------------------
>
>                 Key: GEODE-2714
>                 URL: https://issues.apache.org/jira/browse/GEODE-2714
>             Project: Geode
>          Issue Type: Bug
>          Components: functions
>            Reporter: Hitesh Khamesra
>
> Function execution is the most useful feature of Geode. It allows you to 
> execute a user-defined function on the node which holds the primary bucket of 
> the partition region. In many cases application has colocated partition 
> regions and using function application can operate on all the colocated 
> primary buckets.
> In that function, the application makes sure that no other thread is 
> operating on same colocated keys. But during bucket rebalance there is a 
> possibility that two thread might be executing a function on the same set of 
> keys on different nodes.
> It can happen as we don't take the lock(read-lock) on a primary bucket while 
> executing the function. That allows Geode to move bucket for rebalancing.
> Proposal: Introduce the following api on Function interface to indicate the 
> need to primariness.
> boolean acquirePrimaryBucketLock(); // name suggestion?
> The application would return true if they need a lock on the primary bucket. 
> Default would be false.
> Geode would call the interface and try to take readLock before executing the 
> function on that node. Otherwise, it will throw the exception and let app 
> re-execute that function.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to