You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geode.apache.org by Avinash Dongre <ad...@apache.org> on 2017/02/05 05:32:44 UTC
PR Buckets are created during Get call for non-existing key
Hi,
In the following test, I have one PR, No buckets will be created initially.
But when I call get on non-existing-key, I see 1 bucket is created.
Why bucket is getting created during get call when the Region is empty.
@Test
public void testBucketCreatedDuringGet() {
Properties props = new Properties();
props.put("mcast-port", "0");
props.put("locators", "");
Cache cache = new CacheFactory(props).create();
PartitionedRegion pr = (PartitionedRegion)
cache.createRegionFactory(RegionShortcut.PARTITION).create("PR");
org.junit.Assert.assertEquals(0,
pr.getDataStore().getAllLocalBucketIds().size());
Object notExist = pr.get("NonExistingKey");
org.junit.Assert.assertNull(notExist);
org.junit.Assert.assertEquals(0,
pr.getDataStore().getAllLocalBucketIds().size());
pr.destroyRegion();
cache.close();
}
Thanks
Avinash
Re: PR Buckets are created during Get call for non-existing key
Posted by Avinash Dongre <ad...@apache.org>.
Thanks Dan
Thanks
Avinash
On Mon, Feb 6, 2017 at 10:48 PM Dan Smith <ds...@pivotal.io> wrote:
> Hi Avinash,
>
> Any time you try to use a bucket it will get created. It doesn't matter if
> you are trying to put or get values.
>
> -Dan
>
> On Sat, Feb 4, 2017 at 9:32 PM, Avinash Dongre <ad...@apache.org> wrote:
>
> > Hi,
> > In the following test, I have one PR, No buckets will be created
> initially.
> > But when I call get on non-existing-key, I see 1 bucket is created.
> >
> > Why bucket is getting created during get call when the Region is empty.
> >
> > @Test
> > public void testBucketCreatedDuringGet() {
> > Properties props = new Properties();
> > props.put("mcast-port", "0");
> > props.put("locators", "");
> >
> > Cache cache = new CacheFactory(props).create();
> > PartitionedRegion pr = (PartitionedRegion)
> > cache.createRegionFactory(RegionShortcut.PARTITION).create("PR");
> >
> > org.junit.Assert.assertEquals(0,
> > pr.getDataStore().getAllLocalBucketIds().size());
> >
> > Object notExist = pr.get("NonExistingKey");
> > org.junit.Assert.assertNull(notExist);
> >
> > org.junit.Assert.assertEquals(0,
> > pr.getDataStore().getAllLocalBucketIds().size());
> >
> > pr.destroyRegion();
> > cache.close();
> >
> > }
> >
> > Thanks
> >
> > Avinash
> >
>
Re: PR Buckets are created during Get call for non-existing key
Posted by Dan Smith <ds...@pivotal.io>.
Hi Avinash,
Any time you try to use a bucket it will get created. It doesn't matter if
you are trying to put or get values.
-Dan
On Sat, Feb 4, 2017 at 9:32 PM, Avinash Dongre <ad...@apache.org> wrote:
> Hi,
> In the following test, I have one PR, No buckets will be created initially.
> But when I call get on non-existing-key, I see 1 bucket is created.
>
> Why bucket is getting created during get call when the Region is empty.
>
> @Test
> public void testBucketCreatedDuringGet() {
> Properties props = new Properties();
> props.put("mcast-port", "0");
> props.put("locators", "");
>
> Cache cache = new CacheFactory(props).create();
> PartitionedRegion pr = (PartitionedRegion)
> cache.createRegionFactory(RegionShortcut.PARTITION).create("PR");
>
> org.junit.Assert.assertEquals(0,
> pr.getDataStore().getAllLocalBucketIds().size());
>
> Object notExist = pr.get("NonExistingKey");
> org.junit.Assert.assertNull(notExist);
>
> org.junit.Assert.assertEquals(0,
> pr.getDataStore().getAllLocalBucketIds().size());
>
> pr.destroyRegion();
> cache.close();
>
> }
>
> Thanks
>
> Avinash
>