You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@geode.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2016/01/21 18:18:39 UTC

[jira] [Commented] (GEODE-716) Race in AttributesMutator.setCacheLoader on partitioned regions can result in buckets without a loader

    [ https://issues.apache.org/jira/browse/GEODE-716?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15110943#comment-15110943 ] 

ASF subversion and git services commented on GEODE-716:
-------------------------------------------------------

Commit e497a4d5b6eb0ec8020a7ef76106e17c7006af0f in incubator-geode's branch refs/heads/develop from [~upthewaterspout]
[ https://git-wip-us.apache.org/repos/asf?p=incubator-geode.git;h=e497a4d ]

GEODE-716: Getting the bucket creation lock when setting the CacheLoader

Modifying the CacheLoader using AttributesMutator had a race condition
with partitioned regions where a bucket might never get the new cache
loader. By getting the bucket creation lock, we ensure that the bucket
will either read the cache loader value after it has been set or the
cache loader modification thread will set the cache loader on the
bucket.

I've also indicated that setCacheLoader should not be used for
partitioned regions because of some of the consistency concerns with the
API.


> Race in AttributesMutator.setCacheLoader on partitioned regions can result in buckets without a loader
> ------------------------------------------------------------------------------------------------------
>
>                 Key: GEODE-716
>                 URL: https://issues.apache.org/jira/browse/GEODE-716
>             Project: Geode
>          Issue Type: Bug
>            Reporter: Dan Smith
>            Assignee: Dan Smith
>
> AttributesMutator.setCacheLoader ends up invoking this code in PartitionedRegionDataStore.cacheLoaderChanged.
> {code}
>     visitBuckets(new BucketVisitor() {
>       @Override
>       public void visit(Integer bucketId, Region r) {
>         AttributesMutator mut = r.getAttributesMutator();
>         if (logger.isDebugEnabled()) {
>           logger.debug("setting new cache loader in bucket region: {}", newLoader);
>         }
>         mut.setCacheLoader(newLoader);
>       }
>     });
> {code}
> However, that can miss buckets that are currently being created, because they read the existing value for cache loader first, and then later are added to localBucket2RegionMap - see PartitionedRegionDataStore.grabFreeBuckets.
> The net result is that some buckets can end up with null for the cache loader. If gets a routed to those buckets, they will not invoke the cache loader. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)