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

Dan Smith updated GEODE-716:
----------------------------
    Description: 
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. 

  was:
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. 

On fix might be to get the PartitionedRegionDataStore.bucketCreationLock in 
cacheLoaderChanged.


> 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
>
> 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)

Reply via email to