You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geode.apache.org by Goutam Tadi <gt...@pivotal.io> on 2016/09/23 23:47:47 UTC

Region Put errors out in Local Multi Server environment.

Hi,

I was facing the *"Region not found"* exception when I do the following on
local machine (single Node) :
And, I don't see the exception when I was trying to perform remote debug
which introduced some time lapse. I tried to introduce some `sleep` , but
of no use
Can you please help and let me know what I could be possibly doing wrong?

*Geode version: 1.0.0-incubating.M3*

1. *Start a locator : *

start locator --name=testlocator --include-system-classpath

​
2. *Start two servers:*

- start server --name=testserver1
--cache-xml-file=SITMultiServerMultiRegion1.cache.xml
--locators=localhost[10334] --server-port=30303
--include-system-classpath

- start server --name=testserver2
--cache-xml-file=SITMultiServerMultiRegion2.cache.xml
--locators=localhost[10334] --server-port=30304
--include-system-classpath

​
3. *Java code to create ClientRegion and perform region.put()*

private final static String LOCATOR_HOST = "localhost";
private final static int LOCATOR_PORT = 10334;

clientCache = new ClientCacheFactory().addPoolLocator(LOCATOR_HOST,
LOCATOR_PORT).create();

Region region1 = clientCache.
createClientRegionFactory("PROXY").create(REGION1);
assertNotNull(region1);

Region region2 = clientCache.createClientRegionFactory("PROXY").create(REGION2);
assertNotNull(region2);

region1.put("key1", "region1"); // SUCCESSFUL
region2.put("key2", "region2"); // ERROR OCCURRED.

​
4.* Cache xmls used:*

*Cache-XML- 1*

<?xml version="1.0" encoding="UTF-8"?>

<cache
 xmlns="http://schema.pivotal.io/gemfire/cache"
 xmlns:gpdb="http://schema.pivotal.io/gemfire/gpdb"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://schema.pivotal.io/gemfire/cache
http://schema.pivotal.io/gemfire/cache/cache-8.1.xsd"
 version="8.1">

 <pdx read-serialized="true" persistent="false"/>

 <region name="SITMultiServerMultiRegion1">
 <region-attributes data-policy="partition">
 <partition-attributes redundant-copies="1" />
 </region>

</cache>

​


*Cache-XML- 2*

<?xml version="1.0" encoding="UTF-8"?>

<cache
 xmlns="http://schema.pivotal.io/gemfire/cache"
 xmlns:gpdb="http://schema.pivotal.io/gemfire/gpdb"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://schema.pivotal.io/gemfire/cache
http://schema.pivotal.io/gemfire/cache/cache-8.1.xsd"
 version="8.1">

 <pdx read-serialized="true" persistent="false"/>

 <region name="SITMultiServerMultiRegion2">
 <region-attributes data-policy="partition">
 <partition-attributes redundant-copies="1" />
 </region>

</cache>

​

5. *StackTrace*:


com.gemstone.gemfire.cache.client.ServerOperationException: remote
server on gpdb(28401:loner):45180:20c75e59: : While performing a
remote put

    at com.gemstone.gemfire.cache.client.internal.PutOp$PutOpImpl.processAck(PutOp.java:445)

    at com.gemstone.gemfire.cache.client.internal.PutOp$PutOpImpl.processResponse(PutOp.java:355)

    at com.gemstone.gemfire.cache.client.internal.PutOp$PutOpImpl.attemptReadResponse(PutOp.java:540)

    at com.gemstone.gemfire.cache.client.internal.AbstractOp.attempt(AbstractOp.java:378)

    at com.gemstone.gemfire.cache.client.internal.ConnectionImpl.execute(ConnectionImpl.java:274)

    at com.gemstone.gemfire.cache.client.internal.pooling.PooledConnection.execute(PooledConnection.java:328)

    at com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.executeWithPossibleReAuthentication(OpExecutorImpl.java:937)

    at com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.execute(OpExecutorImpl.java:155)

    at com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.execute(OpExecutorImpl.java:110)

    at com.gemstone.gemfire.cache.client.internal.PoolImpl.execute(PoolImpl.java:700)

    at com.gemstone.gemfire.cache.client.internal.PutOp.execute(PutOp.java:102)

    at com.gemstone.gemfire.cache.client.internal.ServerRegionProxy.put(ServerRegionProxy.java:175)

    at com.gemstone.gemfire.internal.cache.LocalRegion.serverPut(LocalRegion.java:3173)

    at com.gemstone.gemfire.internal.cache.LocalRegion.cacheWriteBeforePut(LocalRegion.java:3300)

    at com.gemstone.gemfire.internal.cache.ProxyRegionMap.basicPut(ProxyRegionMap.java:230)

    at com.gemstone.gemfire.internal.cache.LocalRegion.virtualPut(LocalRegion.java:5955)

    at com.gemstone.gemfire.internal.cache.LocalRegionDataView.putEntry(LocalRegionDataView.java:132)

    at com.gemstone.gemfire.internal.cache.LocalRegion.basicPut(LocalRegion.java:5350)

    at com.gemstone.gemfire.internal.cache.LocalRegion.validatedPut(LocalRegion.java:1668)

    at com.gemstone.gemfire.internal.cache.LocalRegion.put(LocalRegion.java:1655)

    at com.gemstone.gemfire.internal.cache.AbstractRegion.put(AbstractRegion.java:288)

    at io.pivotal.gemfire.gpdb.SITSample.testMultiRegion(SITSample.java:104)

Caused by: com.gemstone.gemfire.cache.RegionDestroyedException: Server
connection from
[identity(gpdb(28401:loner):45180:20c75e59,connection=1; port=45180]:
Region named /SITMultiServerMultiRegion2 was not found during put
request

    at com.gemstone.gemfire.internal.cache.tier.sockets.BaseCommand.writeRegionDestroyedEx(BaseCommand.java:642)

    at com.gemstone.gemfire.internal.cache.tier.sockets.command.Put65.cmdExecute(Put65.java:195)

    at com.gemstone.gemfire.internal.cache.tier.sockets.BaseCommand.execute(BaseCommand.java:146)

    at com.gemstone.gemfire.internal.cache.tier.sockets.ServerConnection.doNormalMsg(ServerConnection.java:783)

    at com.gemstone.gemfire.internal.cache.tier.sockets.ServerConnection.doOneMessage(ServerConnection.java:913)

    at com.gemstone.gemfire.internal.cache.tier.sockets.ServerConnection.run(ServerConnection.java:1180)

    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

    at com.gemstone.gemfire.internal.cache.tier.sockets.AcceptorImpl$1$1.run(AcceptorImpl.java:555)

    at java.lang.Thread.run(Thread.java:745)

​

Thanks,

Goutam Tadi.

-- 
Regards,
*Goutam Tadi.*

Re: Region Put errors out in Local Multi Server environment.

Posted by Dan Smith <ds...@pivotal.io>.
Hi Jun,

Your perspective coming coming from the HDFS world makes sense with geode
as well. You configure the same partitioned region on all of your geode
nodes. Geode will then place partition your data across those nodes. Your
client will figure out where it should connect to get to the data correctly.

It is a bit confusing in this case that geode gives you the control to
shoot yourself in the foot by configuring your servers with different
regions. That type of configuration is potentially valid for some rare use
cases, but only if you also make use of server-groups to make sure your
client regions connect to the right servers. It's unfortunate that geode is
not enforcing that at configuration time.

See this page for a bit more about server-groups if you really need to go
that route. But generally you shouldn't need to do this:
http://geode.docs.pivotal.io/docs/topologies_and_comm/topology_concepts/how_server_discovery_works.html

-Dan

On Fri, Sep 23, 2016 at 5:29 PM, jun aoki <ja...@apache.org> wrote:

> I maybe making some stupid question but I'm from HDFS world where I don't
> have to care where data's physical location is. (You just connect to
> Namenode and you are good.) Bear with me.
>
> On Fri, Sep 23, 2016 at 5:26 PM, jun aoki <ja...@apache.org> wrote:
>
> > Hi Dan, thank you for sharing your insightful information.
> >
> > We only know how to get a cache from a locator as client cache.
> > e.g. clientCache = new ClientCacheFactory().addPoolLocator(LOCATOR_HOST,
> > LOCATOR_PORT).create();
> >
> > This way, when we try to create a PROXY region, we don't know which
> server
> > we are connecting to thus we don't know which region is available to the
> > client. (in Goutam's case, it seems it is actually connecting to server1
> > thus region1 is visible but not region2)
> >
> > Is there any way we can specify which server to connect so that under
> this
> > inconsistent configuration (each server holds different region) so that
> we
> > access to a target region appropriately?
> > Is this inconsistent configuration a valid configuration since it doesn't
> > error out at least, or it is a bad practice where Geode might not work as
> > we expect?
> >
> >
> >
> > On Fri, Sep 23, 2016 at 5:02 PM, Goutam Tadi <gt...@pivotal.io> wrote:
> >
> >> Thanks a lot Dan :-).
> >>
> >> Yeah, that was intentional.
> >> Your solution solves my problem.
> >>
> >> Thanks,
> >> Goutam Tadi.
> >>
> >> On Fri, Sep 23, 2016 at 4:58 PM Dan Smith <ds...@pivotal.io> wrote:
> >>
> >> > Hi Goutam,
> >> >
> >> > It looks like you configured your two servers to have different
> regions.
> >> > Was that intentional? What's happening is that the client is
> connecting
> >> to
> >> > only one of the servers, which has one of your regions but not the
> >> other.
> >> >
> >> > Generally, when you configure gemfire servers, you should configure
> the
> >> > same regions on all servers. In this case I would put both of your
> >> regions
> >> > in the same cache.xml and use that for both servers. By default a
> geode
> >> > client will assume that all of your servers have the same regions and
> >> will
> >> > connect to one or more servers as it sees fit to minimize the number
> of
> >> > connections and reduce the number of network hops.
> >> >
> >> > If you really want to have servers that have different regions, you
> will
> >> > need to make use of the server-groups property on the server and
> create
> >> two
> >> > different pools on the client, using PoolFactory.setServerGroup to
> >> control
> >> > which group the client connects to. But I would say that's a less
> common
> >> > use case.
> >> >
> >> > -Dan
> >> >
> >> > On Fri, Sep 23, 2016 at 4:47 PM, Goutam Tadi <gt...@pivotal.io>
> wrote:
> >> >
> >> > > Hi,
> >> > >
> >> > > I was facing the *"Region not found"* exception when I do the
> >> following
> >> > on
> >> > > local machine (single Node) :
> >> > > And, I don't see the exception when I was trying to perform remote
> >> debug
> >> > > which introduced some time lapse. I tried to introduce some `sleep`
> ,
> >> but
> >> > > of no use
> >> > > Can you please help and let me know what I could be possibly doing
> >> wrong?
> >> > >
> >> > > *Geode version: 1.0.0-incubating.M3*
> >> > >
> >> > > 1. *Start a locator : *
> >> > >
> >> > > start locator --name=testlocator --include-system-classpath
> >> > >
> >> > > ​
> >> > > 2. *Start two servers:*
> >> > >
> >> > > - start server --name=testserver1
> >> > > --cache-xml-file=SITMultiServerMultiRegion1.cache.xml
> >> > > --locators=localhost[10334] --server-port=30303
> >> > > --include-system-classpath
> >> > >
> >> > > - start server --name=testserver2
> >> > > --cache-xml-file=SITMultiServerMultiRegion2.cache.xml
> >> > > --locators=localhost[10334] --server-port=30304
> >> > > --include-system-classpath
> >> > >
> >> > > ​
> >> > > 3. *Java code to create ClientRegion and perform region.put()*
> >> > >
> >> > > private final static String LOCATOR_HOST = "localhost";
> >> > > private final static int LOCATOR_PORT = 10334;
> >> > >
> >> > > clientCache = new ClientCacheFactory().addPoolLocator(LOCATOR_HOST,
> >> > > LOCATOR_PORT).create();
> >> > >
> >> > > Region region1 = clientCache.
> >> > > createClientRegionFactory("PROXY").create(REGION1);
> >> > > assertNotNull(region1);
> >> > >
> >> > > Region region2 = clientCache.createClientRegionFactory("
> >> > > PROXY").create(REGION2);
> >> > > assertNotNull(region2);
> >> > >
> >> > > region1.put("key1", "region1"); // SUCCESSFUL
> >> > > region2.put("key2", "region2"); // ERROR OCCURRED.
> >> > >
> >> > > ​
> >> > > 4.* Cache xmls used:*
> >> > >
> >> > > *Cache-XML- 1*
> >> > >
> >> > > <?xml version="1.0" encoding="UTF-8"?>
> >> > >
> >> > > <cache
> >> > >  xmlns="http://schema.pivotal.io/gemfire/cache"
> >> > >  xmlns:gpdb="http://schema.pivotal.io/gemfire/gpdb"
> >> > >  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >> > >  xsi:schemaLocation="http://schema.pivotal.io/gemfire/cache
> >> > > http://schema.pivotal.io/gemfire/cache/cache-8.1.xsd"
> >> > >  version="8.1">
> >> > >
> >> > >  <pdx read-serialized="true" persistent="false"/>
> >> > >
> >> > >  <region name="SITMultiServerMultiRegion1">
> >> > >  <region-attributes data-policy="partition">
> >> > >  <partition-attributes redundant-copies="1" />
> >> > >  </region>
> >> > >
> >> > > </cache>
> >> > >
> >> > > ​
> >> > >
> >> > >
> >> > > *Cache-XML- 2*
> >> > >
> >> > > <?xml version="1.0" encoding="UTF-8"?>
> >> > >
> >> > > <cache
> >> > >  xmlns="http://schema.pivotal.io/gemfire/cache"
> >> > >  xmlns:gpdb="http://schema.pivotal.io/gemfire/gpdb"
> >> > >  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >> > >  xsi:schemaLocation="http://schema.pivotal.io/gemfire/cache
> >> > > http://schema.pivotal.io/gemfire/cache/cache-8.1.xsd"
> >> > >  version="8.1">
> >> > >
> >> > >  <pdx read-serialized="true" persistent="false"/>
> >> > >
> >> > >  <region name="SITMultiServerMultiRegion2">
> >> > >  <region-attributes data-policy="partition">
> >> > >  <partition-attributes redundant-copies="1" />
> >> > >  </region>
> >> > >
> >> > > </cache>
> >> > >
> >> > > ​
> >> > >
> >> > > 5. *StackTrace*:
> >> > >
> >> > >
> >> > > com.gemstone.gemfire.cache.client.ServerOperationException: remote
> >> > > server on gpdb(28401:loner):45180:20c75e59: : While performing a
> >> > > remote put
> >> > >
> >> > >     at com.gemstone.gemfire.cache.client.internal.PutOp$
> >> > > PutOpImpl.processAck(PutOp.java:445)
> >> > >
> >> > >     at com.gemstone.gemfire.cache.client.internal.PutOp$
> >> > > PutOpImpl.processResponse(PutOp.java:355)
> >> > >
> >> > >     at com.gemstone.gemfire.cache.client.internal.PutOp$
> >> > > PutOpImpl.attemptReadResponse(PutOp.java:540)
> >> > >
> >> > >     at com.gemstone.gemfire.cache.client.internal.AbstractOp.
> >> > > attempt(AbstractOp.java:378)
> >> > >
> >> > >     at com.gemstone.gemfire.cache.client.internal.ConnectionImpl.ex
> >> ecute(
> >> > > ConnectionImpl.java:274)
> >> > >
> >> > >     at com.gemstone.gemfire.cache.client.internal.pooling.
> >> > > PooledConnection.execute(PooledConnection.java:328)
> >> > >
> >> > >     at com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.
> >> > > executeWithPossibleReAuthentication(OpExecutorImpl.java:937)
> >> > >
> >> > >     at com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.ex
> >> ecute(
> >> > > OpExecutorImpl.java:155)
> >> > >
> >> > >     at com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.ex
> >> ecute(
> >> > > OpExecutorImpl.java:110)
> >> > >
> >> > >     at com.gemstone.gemfire.cache.client.internal.PoolImpl.
> >> > > execute(PoolImpl.java:700)
> >> > >
> >> > >     at com.gemstone.gemfire.cache.client.internal.PutOp.execute(
> >> > > PutOp.java:102)
> >> > >
> >> > >     at com.gemstone.gemfire.cache.client.internal.ServerRegionProxy
> >> .put(
> >> > > ServerRegionProxy.java:175)
> >> > >
> >> > >     at com.gemstone.gemfire.internal.cache.LocalRegion.serverPut(
> >> > > LocalRegion.java:3173)
> >> > >
> >> > >     at com.gemstone.gemfire.internal.cache.LocalRegion.
> >> > > cacheWriteBeforePut(LocalRegion.java:3300)
> >> > >
> >> > >     at com.gemstone.gemfire.internal.cache.ProxyRegionMap.basicPut(
> >> > > ProxyRegionMap.java:230)
> >> > >
> >> > >     at com.gemstone.gemfire.internal.cache.LocalRegion.virtualPut(
> >> > > LocalRegion.java:5955)
> >> > >
> >> > >     at com.gemstone.gemfire.internal.cache.LocalRegionDataView.
> >> > > putEntry(LocalRegionDataView.java:132)
> >> > >
> >> > >     at com.gemstone.gemfire.internal.cache.LocalRegion.basicPut(
> >> > > LocalRegion.java:5350)
> >> > >
> >> > >     at com.gemstone.gemfire.internal.cache.LocalRegion.
> >> > > validatedPut(LocalRegion.java:1668)
> >> > >
> >> > >     at com.gemstone.gemfire.internal.cache.LocalRegion.put(
> >> > > LocalRegion.java:1655)
> >> > >
> >> > >     at com.gemstone.gemfire.internal.cache.AbstractRegion.put(
> >> > > AbstractRegion.java:288)
> >> > >
> >> > >     at io.pivotal.gemfire.gpdb.SITSample.testMultiRegion(
> >> > > SITSample.java:104)
> >> > >
> >> > > Caused by: com.gemstone.gemfire.cache.RegionDestroyedException:
> >> Server
> >> > > connection from
> >> > > [identity(gpdb(28401:loner):45180:20c75e59,connection=1;
> port=45180]:
> >> > > Region named /SITMultiServerMultiRegion2 was not found during put
> >> > > request
> >> > >
> >> > >     at com.gemstone.gemfire.internal.cache.tier.sockets.
> BaseCommand.
> >> > > writeRegionDestroyedEx(BaseCommand.java:642)
> >> > >
> >> > >     at com.gemstone.gemfire.internal.cache.tier.sockets.command.
> >> > > Put65.cmdExecute(Put65.java:195)
> >> > >
> >> > >     at com.gemstone.gemfire.internal.cache.tier.sockets.
> >> > > BaseCommand.execute(BaseCommand.java:146)
> >> > >
> >> > >     at com.gemstone.gemfire.internal.cache.tier.sockets.
> >> > > ServerConnection.doNormalMsg(ServerConnection.java:783)
> >> > >
> >> > >     at com.gemstone.gemfire.internal.cache.tier.sockets.
> >> > > ServerConnection.doOneMessage(ServerConnection.java:913)
> >> > >
> >> > >     at com.gemstone.gemfire.internal.cache.tier.sockets.
> >> > > ServerConnection.run(ServerConnection.java:1180)
> >> > >
> >> > >     at java.util.concurrent.ThreadPoolExecutor.runWorker(
> >> > > ThreadPoolExecutor.java:1142)
> >> > >
> >> > >     at java.util.concurrent.ThreadPoolExecutor$Worker.run(
> >> > > ThreadPoolExecutor.java:617)
> >> > >
> >> > >     at com.gemstone.gemfire.internal.cache.tier.sockets.
> >> > > AcceptorImpl$1$1.run(AcceptorImpl.java:555)
> >> > >
> >> > >     at java.lang.Thread.run(Thread.java:745)
> >> > >
> >> > > ​
> >> > >
> >> > > Thanks,
> >> > >
> >> > > Goutam Tadi.
> >> > >
> >> > > --
> >> > > Regards,
> >> > > *Goutam Tadi.*
> >> > >
> >> >
> >> --
> >> Regards,
> >> *Goutam Tadi.*
> >>
> >
> >
> >
> > --
> > -jun
> >
>
>
>
> --
> -jun
>

Re: Region Put errors out in Local Multi Server environment.

Posted by jun aoki <ja...@apache.org>.
I maybe making some stupid question but I'm from HDFS world where I don't
have to care where data's physical location is. (You just connect to
Namenode and you are good.) Bear with me.

On Fri, Sep 23, 2016 at 5:26 PM, jun aoki <ja...@apache.org> wrote:

> Hi Dan, thank you for sharing your insightful information.
>
> We only know how to get a cache from a locator as client cache.
> e.g. clientCache = new ClientCacheFactory().addPoolLocator(LOCATOR_HOST,
> LOCATOR_PORT).create();
>
> This way, when we try to create a PROXY region, we don't know which server
> we are connecting to thus we don't know which region is available to the
> client. (in Goutam's case, it seems it is actually connecting to server1
> thus region1 is visible but not region2)
>
> Is there any way we can specify which server to connect so that under this
> inconsistent configuration (each server holds different region) so that we
> access to a target region appropriately?
> Is this inconsistent configuration a valid configuration since it doesn't
> error out at least, or it is a bad practice where Geode might not work as
> we expect?
>
>
>
> On Fri, Sep 23, 2016 at 5:02 PM, Goutam Tadi <gt...@pivotal.io> wrote:
>
>> Thanks a lot Dan :-).
>>
>> Yeah, that was intentional.
>> Your solution solves my problem.
>>
>> Thanks,
>> Goutam Tadi.
>>
>> On Fri, Sep 23, 2016 at 4:58 PM Dan Smith <ds...@pivotal.io> wrote:
>>
>> > Hi Goutam,
>> >
>> > It looks like you configured your two servers to have different regions.
>> > Was that intentional? What's happening is that the client is connecting
>> to
>> > only one of the servers, which has one of your regions but not the
>> other.
>> >
>> > Generally, when you configure gemfire servers, you should configure the
>> > same regions on all servers. In this case I would put both of your
>> regions
>> > in the same cache.xml and use that for both servers. By default a geode
>> > client will assume that all of your servers have the same regions and
>> will
>> > connect to one or more servers as it sees fit to minimize the number of
>> > connections and reduce the number of network hops.
>> >
>> > If you really want to have servers that have different regions, you will
>> > need to make use of the server-groups property on the server and create
>> two
>> > different pools on the client, using PoolFactory.setServerGroup to
>> control
>> > which group the client connects to. But I would say that's a less common
>> > use case.
>> >
>> > -Dan
>> >
>> > On Fri, Sep 23, 2016 at 4:47 PM, Goutam Tadi <gt...@pivotal.io> wrote:
>> >
>> > > Hi,
>> > >
>> > > I was facing the *"Region not found"* exception when I do the
>> following
>> > on
>> > > local machine (single Node) :
>> > > And, I don't see the exception when I was trying to perform remote
>> debug
>> > > which introduced some time lapse. I tried to introduce some `sleep` ,
>> but
>> > > of no use
>> > > Can you please help and let me know what I could be possibly doing
>> wrong?
>> > >
>> > > *Geode version: 1.0.0-incubating.M3*
>> > >
>> > > 1. *Start a locator : *
>> > >
>> > > start locator --name=testlocator --include-system-classpath
>> > >
>> > > ​
>> > > 2. *Start two servers:*
>> > >
>> > > - start server --name=testserver1
>> > > --cache-xml-file=SITMultiServerMultiRegion1.cache.xml
>> > > --locators=localhost[10334] --server-port=30303
>> > > --include-system-classpath
>> > >
>> > > - start server --name=testserver2
>> > > --cache-xml-file=SITMultiServerMultiRegion2.cache.xml
>> > > --locators=localhost[10334] --server-port=30304
>> > > --include-system-classpath
>> > >
>> > > ​
>> > > 3. *Java code to create ClientRegion and perform region.put()*
>> > >
>> > > private final static String LOCATOR_HOST = "localhost";
>> > > private final static int LOCATOR_PORT = 10334;
>> > >
>> > > clientCache = new ClientCacheFactory().addPoolLocator(LOCATOR_HOST,
>> > > LOCATOR_PORT).create();
>> > >
>> > > Region region1 = clientCache.
>> > > createClientRegionFactory("PROXY").create(REGION1);
>> > > assertNotNull(region1);
>> > >
>> > > Region region2 = clientCache.createClientRegionFactory("
>> > > PROXY").create(REGION2);
>> > > assertNotNull(region2);
>> > >
>> > > region1.put("key1", "region1"); // SUCCESSFUL
>> > > region2.put("key2", "region2"); // ERROR OCCURRED.
>> > >
>> > > ​
>> > > 4.* Cache xmls used:*
>> > >
>> > > *Cache-XML- 1*
>> > >
>> > > <?xml version="1.0" encoding="UTF-8"?>
>> > >
>> > > <cache
>> > >  xmlns="http://schema.pivotal.io/gemfire/cache"
>> > >  xmlns:gpdb="http://schema.pivotal.io/gemfire/gpdb"
>> > >  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> > >  xsi:schemaLocation="http://schema.pivotal.io/gemfire/cache
>> > > http://schema.pivotal.io/gemfire/cache/cache-8.1.xsd"
>> > >  version="8.1">
>> > >
>> > >  <pdx read-serialized="true" persistent="false"/>
>> > >
>> > >  <region name="SITMultiServerMultiRegion1">
>> > >  <region-attributes data-policy="partition">
>> > >  <partition-attributes redundant-copies="1" />
>> > >  </region>
>> > >
>> > > </cache>
>> > >
>> > > ​
>> > >
>> > >
>> > > *Cache-XML- 2*
>> > >
>> > > <?xml version="1.0" encoding="UTF-8"?>
>> > >
>> > > <cache
>> > >  xmlns="http://schema.pivotal.io/gemfire/cache"
>> > >  xmlns:gpdb="http://schema.pivotal.io/gemfire/gpdb"
>> > >  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> > >  xsi:schemaLocation="http://schema.pivotal.io/gemfire/cache
>> > > http://schema.pivotal.io/gemfire/cache/cache-8.1.xsd"
>> > >  version="8.1">
>> > >
>> > >  <pdx read-serialized="true" persistent="false"/>
>> > >
>> > >  <region name="SITMultiServerMultiRegion2">
>> > >  <region-attributes data-policy="partition">
>> > >  <partition-attributes redundant-copies="1" />
>> > >  </region>
>> > >
>> > > </cache>
>> > >
>> > > ​
>> > >
>> > > 5. *StackTrace*:
>> > >
>> > >
>> > > com.gemstone.gemfire.cache.client.ServerOperationException: remote
>> > > server on gpdb(28401:loner):45180:20c75e59: : While performing a
>> > > remote put
>> > >
>> > >     at com.gemstone.gemfire.cache.client.internal.PutOp$
>> > > PutOpImpl.processAck(PutOp.java:445)
>> > >
>> > >     at com.gemstone.gemfire.cache.client.internal.PutOp$
>> > > PutOpImpl.processResponse(PutOp.java:355)
>> > >
>> > >     at com.gemstone.gemfire.cache.client.internal.PutOp$
>> > > PutOpImpl.attemptReadResponse(PutOp.java:540)
>> > >
>> > >     at com.gemstone.gemfire.cache.client.internal.AbstractOp.
>> > > attempt(AbstractOp.java:378)
>> > >
>> > >     at com.gemstone.gemfire.cache.client.internal.ConnectionImpl.ex
>> ecute(
>> > > ConnectionImpl.java:274)
>> > >
>> > >     at com.gemstone.gemfire.cache.client.internal.pooling.
>> > > PooledConnection.execute(PooledConnection.java:328)
>> > >
>> > >     at com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.
>> > > executeWithPossibleReAuthentication(OpExecutorImpl.java:937)
>> > >
>> > >     at com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.ex
>> ecute(
>> > > OpExecutorImpl.java:155)
>> > >
>> > >     at com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.ex
>> ecute(
>> > > OpExecutorImpl.java:110)
>> > >
>> > >     at com.gemstone.gemfire.cache.client.internal.PoolImpl.
>> > > execute(PoolImpl.java:700)
>> > >
>> > >     at com.gemstone.gemfire.cache.client.internal.PutOp.execute(
>> > > PutOp.java:102)
>> > >
>> > >     at com.gemstone.gemfire.cache.client.internal.ServerRegionProxy
>> .put(
>> > > ServerRegionProxy.java:175)
>> > >
>> > >     at com.gemstone.gemfire.internal.cache.LocalRegion.serverPut(
>> > > LocalRegion.java:3173)
>> > >
>> > >     at com.gemstone.gemfire.internal.cache.LocalRegion.
>> > > cacheWriteBeforePut(LocalRegion.java:3300)
>> > >
>> > >     at com.gemstone.gemfire.internal.cache.ProxyRegionMap.basicPut(
>> > > ProxyRegionMap.java:230)
>> > >
>> > >     at com.gemstone.gemfire.internal.cache.LocalRegion.virtualPut(
>> > > LocalRegion.java:5955)
>> > >
>> > >     at com.gemstone.gemfire.internal.cache.LocalRegionDataView.
>> > > putEntry(LocalRegionDataView.java:132)
>> > >
>> > >     at com.gemstone.gemfire.internal.cache.LocalRegion.basicPut(
>> > > LocalRegion.java:5350)
>> > >
>> > >     at com.gemstone.gemfire.internal.cache.LocalRegion.
>> > > validatedPut(LocalRegion.java:1668)
>> > >
>> > >     at com.gemstone.gemfire.internal.cache.LocalRegion.put(
>> > > LocalRegion.java:1655)
>> > >
>> > >     at com.gemstone.gemfire.internal.cache.AbstractRegion.put(
>> > > AbstractRegion.java:288)
>> > >
>> > >     at io.pivotal.gemfire.gpdb.SITSample.testMultiRegion(
>> > > SITSample.java:104)
>> > >
>> > > Caused by: com.gemstone.gemfire.cache.RegionDestroyedException:
>> Server
>> > > connection from
>> > > [identity(gpdb(28401:loner):45180:20c75e59,connection=1; port=45180]:
>> > > Region named /SITMultiServerMultiRegion2 was not found during put
>> > > request
>> > >
>> > >     at com.gemstone.gemfire.internal.cache.tier.sockets.BaseCommand.
>> > > writeRegionDestroyedEx(BaseCommand.java:642)
>> > >
>> > >     at com.gemstone.gemfire.internal.cache.tier.sockets.command.
>> > > Put65.cmdExecute(Put65.java:195)
>> > >
>> > >     at com.gemstone.gemfire.internal.cache.tier.sockets.
>> > > BaseCommand.execute(BaseCommand.java:146)
>> > >
>> > >     at com.gemstone.gemfire.internal.cache.tier.sockets.
>> > > ServerConnection.doNormalMsg(ServerConnection.java:783)
>> > >
>> > >     at com.gemstone.gemfire.internal.cache.tier.sockets.
>> > > ServerConnection.doOneMessage(ServerConnection.java:913)
>> > >
>> > >     at com.gemstone.gemfire.internal.cache.tier.sockets.
>> > > ServerConnection.run(ServerConnection.java:1180)
>> > >
>> > >     at java.util.concurrent.ThreadPoolExecutor.runWorker(
>> > > ThreadPoolExecutor.java:1142)
>> > >
>> > >     at java.util.concurrent.ThreadPoolExecutor$Worker.run(
>> > > ThreadPoolExecutor.java:617)
>> > >
>> > >     at com.gemstone.gemfire.internal.cache.tier.sockets.
>> > > AcceptorImpl$1$1.run(AcceptorImpl.java:555)
>> > >
>> > >     at java.lang.Thread.run(Thread.java:745)
>> > >
>> > > ​
>> > >
>> > > Thanks,
>> > >
>> > > Goutam Tadi.
>> > >
>> > > --
>> > > Regards,
>> > > *Goutam Tadi.*
>> > >
>> >
>> --
>> Regards,
>> *Goutam Tadi.*
>>
>
>
>
> --
> -jun
>



-- 
-jun

Re: Region Put errors out in Local Multi Server environment.

Posted by jun aoki <ja...@apache.org>.
Hi Dan, thank you for sharing your insightful information.

We only know how to get a cache from a locator as client cache.
e.g. clientCache = new ClientCacheFactory().addPoolLocator(LOCATOR_HOST,
LOCATOR_PORT).create();

This way, when we try to create a PROXY region, we don't know which server
we are connecting to thus we don't know which region is available to the
client. (in Goutam's case, it seems it is actually connecting to server1
thus region1 is visible but not region2)

Is there any way we can specify which server to connect so that under this
inconsistent configuration (each server holds different region) so that we
access to a target region appropriately?
Is this inconsistent configuration a valid configuration since it doesn't
error out at least, or it is a bad practice where Geode might not work as
we expect?



On Fri, Sep 23, 2016 at 5:02 PM, Goutam Tadi <gt...@pivotal.io> wrote:

> Thanks a lot Dan :-).
>
> Yeah, that was intentional.
> Your solution solves my problem.
>
> Thanks,
> Goutam Tadi.
>
> On Fri, Sep 23, 2016 at 4:58 PM Dan Smith <ds...@pivotal.io> wrote:
>
> > Hi Goutam,
> >
> > It looks like you configured your two servers to have different regions.
> > Was that intentional? What's happening is that the client is connecting
> to
> > only one of the servers, which has one of your regions but not the other.
> >
> > Generally, when you configure gemfire servers, you should configure the
> > same regions on all servers. In this case I would put both of your
> regions
> > in the same cache.xml and use that for both servers. By default a geode
> > client will assume that all of your servers have the same regions and
> will
> > connect to one or more servers as it sees fit to minimize the number of
> > connections and reduce the number of network hops.
> >
> > If you really want to have servers that have different regions, you will
> > need to make use of the server-groups property on the server and create
> two
> > different pools on the client, using PoolFactory.setServerGroup to
> control
> > which group the client connects to. But I would say that's a less common
> > use case.
> >
> > -Dan
> >
> > On Fri, Sep 23, 2016 at 4:47 PM, Goutam Tadi <gt...@pivotal.io> wrote:
> >
> > > Hi,
> > >
> > > I was facing the *"Region not found"* exception when I do the following
> > on
> > > local machine (single Node) :
> > > And, I don't see the exception when I was trying to perform remote
> debug
> > > which introduced some time lapse. I tried to introduce some `sleep` ,
> but
> > > of no use
> > > Can you please help and let me know what I could be possibly doing
> wrong?
> > >
> > > *Geode version: 1.0.0-incubating.M3*
> > >
> > > 1. *Start a locator : *
> > >
> > > start locator --name=testlocator --include-system-classpath
> > >
> > > ​
> > > 2. *Start two servers:*
> > >
> > > - start server --name=testserver1
> > > --cache-xml-file=SITMultiServerMultiRegion1.cache.xml
> > > --locators=localhost[10334] --server-port=30303
> > > --include-system-classpath
> > >
> > > - start server --name=testserver2
> > > --cache-xml-file=SITMultiServerMultiRegion2.cache.xml
> > > --locators=localhost[10334] --server-port=30304
> > > --include-system-classpath
> > >
> > > ​
> > > 3. *Java code to create ClientRegion and perform region.put()*
> > >
> > > private final static String LOCATOR_HOST = "localhost";
> > > private final static int LOCATOR_PORT = 10334;
> > >
> > > clientCache = new ClientCacheFactory().addPoolLocator(LOCATOR_HOST,
> > > LOCATOR_PORT).create();
> > >
> > > Region region1 = clientCache.
> > > createClientRegionFactory("PROXY").create(REGION1);
> > > assertNotNull(region1);
> > >
> > > Region region2 = clientCache.createClientRegionFactory("
> > > PROXY").create(REGION2);
> > > assertNotNull(region2);
> > >
> > > region1.put("key1", "region1"); // SUCCESSFUL
> > > region2.put("key2", "region2"); // ERROR OCCURRED.
> > >
> > > ​
> > > 4.* Cache xmls used:*
> > >
> > > *Cache-XML- 1*
> > >
> > > <?xml version="1.0" encoding="UTF-8"?>
> > >
> > > <cache
> > >  xmlns="http://schema.pivotal.io/gemfire/cache"
> > >  xmlns:gpdb="http://schema.pivotal.io/gemfire/gpdb"
> > >  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > >  xsi:schemaLocation="http://schema.pivotal.io/gemfire/cache
> > > http://schema.pivotal.io/gemfire/cache/cache-8.1.xsd"
> > >  version="8.1">
> > >
> > >  <pdx read-serialized="true" persistent="false"/>
> > >
> > >  <region name="SITMultiServerMultiRegion1">
> > >  <region-attributes data-policy="partition">
> > >  <partition-attributes redundant-copies="1" />
> > >  </region>
> > >
> > > </cache>
> > >
> > > ​
> > >
> > >
> > > *Cache-XML- 2*
> > >
> > > <?xml version="1.0" encoding="UTF-8"?>
> > >
> > > <cache
> > >  xmlns="http://schema.pivotal.io/gemfire/cache"
> > >  xmlns:gpdb="http://schema.pivotal.io/gemfire/gpdb"
> > >  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > >  xsi:schemaLocation="http://schema.pivotal.io/gemfire/cache
> > > http://schema.pivotal.io/gemfire/cache/cache-8.1.xsd"
> > >  version="8.1">
> > >
> > >  <pdx read-serialized="true" persistent="false"/>
> > >
> > >  <region name="SITMultiServerMultiRegion2">
> > >  <region-attributes data-policy="partition">
> > >  <partition-attributes redundant-copies="1" />
> > >  </region>
> > >
> > > </cache>
> > >
> > > ​
> > >
> > > 5. *StackTrace*:
> > >
> > >
> > > com.gemstone.gemfire.cache.client.ServerOperationException: remote
> > > server on gpdb(28401:loner):45180:20c75e59: : While performing a
> > > remote put
> > >
> > >     at com.gemstone.gemfire.cache.client.internal.PutOp$
> > > PutOpImpl.processAck(PutOp.java:445)
> > >
> > >     at com.gemstone.gemfire.cache.client.internal.PutOp$
> > > PutOpImpl.processResponse(PutOp.java:355)
> > >
> > >     at com.gemstone.gemfire.cache.client.internal.PutOp$
> > > PutOpImpl.attemptReadResponse(PutOp.java:540)
> > >
> > >     at com.gemstone.gemfire.cache.client.internal.AbstractOp.
> > > attempt(AbstractOp.java:378)
> > >
> > >     at com.gemstone.gemfire.cache.client.internal.ConnectionImpl.
> execute(
> > > ConnectionImpl.java:274)
> > >
> > >     at com.gemstone.gemfire.cache.client.internal.pooling.
> > > PooledConnection.execute(PooledConnection.java:328)
> > >
> > >     at com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.
> > > executeWithPossibleReAuthentication(OpExecutorImpl.java:937)
> > >
> > >     at com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.
> execute(
> > > OpExecutorImpl.java:155)
> > >
> > >     at com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.
> execute(
> > > OpExecutorImpl.java:110)
> > >
> > >     at com.gemstone.gemfire.cache.client.internal.PoolImpl.
> > > execute(PoolImpl.java:700)
> > >
> > >     at com.gemstone.gemfire.cache.client.internal.PutOp.execute(
> > > PutOp.java:102)
> > >
> > >     at com.gemstone.gemfire.cache.client.internal.ServerRegionProxy
> .put(
> > > ServerRegionProxy.java:175)
> > >
> > >     at com.gemstone.gemfire.internal.cache.LocalRegion.serverPut(
> > > LocalRegion.java:3173)
> > >
> > >     at com.gemstone.gemfire.internal.cache.LocalRegion.
> > > cacheWriteBeforePut(LocalRegion.java:3300)
> > >
> > >     at com.gemstone.gemfire.internal.cache.ProxyRegionMap.basicPut(
> > > ProxyRegionMap.java:230)
> > >
> > >     at com.gemstone.gemfire.internal.cache.LocalRegion.virtualPut(
> > > LocalRegion.java:5955)
> > >
> > >     at com.gemstone.gemfire.internal.cache.LocalRegionDataView.
> > > putEntry(LocalRegionDataView.java:132)
> > >
> > >     at com.gemstone.gemfire.internal.cache.LocalRegion.basicPut(
> > > LocalRegion.java:5350)
> > >
> > >     at com.gemstone.gemfire.internal.cache.LocalRegion.
> > > validatedPut(LocalRegion.java:1668)
> > >
> > >     at com.gemstone.gemfire.internal.cache.LocalRegion.put(
> > > LocalRegion.java:1655)
> > >
> > >     at com.gemstone.gemfire.internal.cache.AbstractRegion.put(
> > > AbstractRegion.java:288)
> > >
> > >     at io.pivotal.gemfire.gpdb.SITSample.testMultiRegion(
> > > SITSample.java:104)
> > >
> > > Caused by: com.gemstone.gemfire.cache.RegionDestroyedException: Server
> > > connection from
> > > [identity(gpdb(28401:loner):45180:20c75e59,connection=1; port=45180]:
> > > Region named /SITMultiServerMultiRegion2 was not found during put
> > > request
> > >
> > >     at com.gemstone.gemfire.internal.cache.tier.sockets.BaseCommand.
> > > writeRegionDestroyedEx(BaseCommand.java:642)
> > >
> > >     at com.gemstone.gemfire.internal.cache.tier.sockets.command.
> > > Put65.cmdExecute(Put65.java:195)
> > >
> > >     at com.gemstone.gemfire.internal.cache.tier.sockets.
> > > BaseCommand.execute(BaseCommand.java:146)
> > >
> > >     at com.gemstone.gemfire.internal.cache.tier.sockets.
> > > ServerConnection.doNormalMsg(ServerConnection.java:783)
> > >
> > >     at com.gemstone.gemfire.internal.cache.tier.sockets.
> > > ServerConnection.doOneMessage(ServerConnection.java:913)
> > >
> > >     at com.gemstone.gemfire.internal.cache.tier.sockets.
> > > ServerConnection.run(ServerConnection.java:1180)
> > >
> > >     at java.util.concurrent.ThreadPoolExecutor.runWorker(
> > > ThreadPoolExecutor.java:1142)
> > >
> > >     at java.util.concurrent.ThreadPoolExecutor$Worker.run(
> > > ThreadPoolExecutor.java:617)
> > >
> > >     at com.gemstone.gemfire.internal.cache.tier.sockets.
> > > AcceptorImpl$1$1.run(AcceptorImpl.java:555)
> > >
> > >     at java.lang.Thread.run(Thread.java:745)
> > >
> > > ​
> > >
> > > Thanks,
> > >
> > > Goutam Tadi.
> > >
> > > --
> > > Regards,
> > > *Goutam Tadi.*
> > >
> >
> --
> Regards,
> *Goutam Tadi.*
>



-- 
-jun

Re: Region Put errors out in Local Multi Server environment.

Posted by Goutam Tadi <gt...@pivotal.io>.
Thanks a lot Dan :-).

Yeah, that was intentional.
Your solution solves my problem.

Thanks,
Goutam Tadi.

On Fri, Sep 23, 2016 at 4:58 PM Dan Smith <ds...@pivotal.io> wrote:

> Hi Goutam,
>
> It looks like you configured your two servers to have different regions.
> Was that intentional? What's happening is that the client is connecting to
> only one of the servers, which has one of your regions but not the other.
>
> Generally, when you configure gemfire servers, you should configure the
> same regions on all servers. In this case I would put both of your regions
> in the same cache.xml and use that for both servers. By default a geode
> client will assume that all of your servers have the same regions and will
> connect to one or more servers as it sees fit to minimize the number of
> connections and reduce the number of network hops.
>
> If you really want to have servers that have different regions, you will
> need to make use of the server-groups property on the server and create two
> different pools on the client, using PoolFactory.setServerGroup to control
> which group the client connects to. But I would say that's a less common
> use case.
>
> -Dan
>
> On Fri, Sep 23, 2016 at 4:47 PM, Goutam Tadi <gt...@pivotal.io> wrote:
>
> > Hi,
> >
> > I was facing the *"Region not found"* exception when I do the following
> on
> > local machine (single Node) :
> > And, I don't see the exception when I was trying to perform remote debug
> > which introduced some time lapse. I tried to introduce some `sleep` , but
> > of no use
> > Can you please help and let me know what I could be possibly doing wrong?
> >
> > *Geode version: 1.0.0-incubating.M3*
> >
> > 1. *Start a locator : *
> >
> > start locator --name=testlocator --include-system-classpath
> >
> > ​
> > 2. *Start two servers:*
> >
> > - start server --name=testserver1
> > --cache-xml-file=SITMultiServerMultiRegion1.cache.xml
> > --locators=localhost[10334] --server-port=30303
> > --include-system-classpath
> >
> > - start server --name=testserver2
> > --cache-xml-file=SITMultiServerMultiRegion2.cache.xml
> > --locators=localhost[10334] --server-port=30304
> > --include-system-classpath
> >
> > ​
> > 3. *Java code to create ClientRegion and perform region.put()*
> >
> > private final static String LOCATOR_HOST = "localhost";
> > private final static int LOCATOR_PORT = 10334;
> >
> > clientCache = new ClientCacheFactory().addPoolLocator(LOCATOR_HOST,
> > LOCATOR_PORT).create();
> >
> > Region region1 = clientCache.
> > createClientRegionFactory("PROXY").create(REGION1);
> > assertNotNull(region1);
> >
> > Region region2 = clientCache.createClientRegionFactory("
> > PROXY").create(REGION2);
> > assertNotNull(region2);
> >
> > region1.put("key1", "region1"); // SUCCESSFUL
> > region2.put("key2", "region2"); // ERROR OCCURRED.
> >
> > ​
> > 4.* Cache xmls used:*
> >
> > *Cache-XML- 1*
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> >
> > <cache
> >  xmlns="http://schema.pivotal.io/gemfire/cache"
> >  xmlns:gpdb="http://schema.pivotal.io/gemfire/gpdb"
> >  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >  xsi:schemaLocation="http://schema.pivotal.io/gemfire/cache
> > http://schema.pivotal.io/gemfire/cache/cache-8.1.xsd"
> >  version="8.1">
> >
> >  <pdx read-serialized="true" persistent="false"/>
> >
> >  <region name="SITMultiServerMultiRegion1">
> >  <region-attributes data-policy="partition">
> >  <partition-attributes redundant-copies="1" />
> >  </region>
> >
> > </cache>
> >
> > ​
> >
> >
> > *Cache-XML- 2*
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> >
> > <cache
> >  xmlns="http://schema.pivotal.io/gemfire/cache"
> >  xmlns:gpdb="http://schema.pivotal.io/gemfire/gpdb"
> >  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >  xsi:schemaLocation="http://schema.pivotal.io/gemfire/cache
> > http://schema.pivotal.io/gemfire/cache/cache-8.1.xsd"
> >  version="8.1">
> >
> >  <pdx read-serialized="true" persistent="false"/>
> >
> >  <region name="SITMultiServerMultiRegion2">
> >  <region-attributes data-policy="partition">
> >  <partition-attributes redundant-copies="1" />
> >  </region>
> >
> > </cache>
> >
> > ​
> >
> > 5. *StackTrace*:
> >
> >
> > com.gemstone.gemfire.cache.client.ServerOperationException: remote
> > server on gpdb(28401:loner):45180:20c75e59: : While performing a
> > remote put
> >
> >     at com.gemstone.gemfire.cache.client.internal.PutOp$
> > PutOpImpl.processAck(PutOp.java:445)
> >
> >     at com.gemstone.gemfire.cache.client.internal.PutOp$
> > PutOpImpl.processResponse(PutOp.java:355)
> >
> >     at com.gemstone.gemfire.cache.client.internal.PutOp$
> > PutOpImpl.attemptReadResponse(PutOp.java:540)
> >
> >     at com.gemstone.gemfire.cache.client.internal.AbstractOp.
> > attempt(AbstractOp.java:378)
> >
> >     at com.gemstone.gemfire.cache.client.internal.ConnectionImpl.execute(
> > ConnectionImpl.java:274)
> >
> >     at com.gemstone.gemfire.cache.client.internal.pooling.
> > PooledConnection.execute(PooledConnection.java:328)
> >
> >     at com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.
> > executeWithPossibleReAuthentication(OpExecutorImpl.java:937)
> >
> >     at com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.execute(
> > OpExecutorImpl.java:155)
> >
> >     at com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.execute(
> > OpExecutorImpl.java:110)
> >
> >     at com.gemstone.gemfire.cache.client.internal.PoolImpl.
> > execute(PoolImpl.java:700)
> >
> >     at com.gemstone.gemfire.cache.client.internal.PutOp.execute(
> > PutOp.java:102)
> >
> >     at com.gemstone.gemfire.cache.client.internal.ServerRegionProxy.put(
> > ServerRegionProxy.java:175)
> >
> >     at com.gemstone.gemfire.internal.cache.LocalRegion.serverPut(
> > LocalRegion.java:3173)
> >
> >     at com.gemstone.gemfire.internal.cache.LocalRegion.
> > cacheWriteBeforePut(LocalRegion.java:3300)
> >
> >     at com.gemstone.gemfire.internal.cache.ProxyRegionMap.basicPut(
> > ProxyRegionMap.java:230)
> >
> >     at com.gemstone.gemfire.internal.cache.LocalRegion.virtualPut(
> > LocalRegion.java:5955)
> >
> >     at com.gemstone.gemfire.internal.cache.LocalRegionDataView.
> > putEntry(LocalRegionDataView.java:132)
> >
> >     at com.gemstone.gemfire.internal.cache.LocalRegion.basicPut(
> > LocalRegion.java:5350)
> >
> >     at com.gemstone.gemfire.internal.cache.LocalRegion.
> > validatedPut(LocalRegion.java:1668)
> >
> >     at com.gemstone.gemfire.internal.cache.LocalRegion.put(
> > LocalRegion.java:1655)
> >
> >     at com.gemstone.gemfire.internal.cache.AbstractRegion.put(
> > AbstractRegion.java:288)
> >
> >     at io.pivotal.gemfire.gpdb.SITSample.testMultiRegion(
> > SITSample.java:104)
> >
> > Caused by: com.gemstone.gemfire.cache.RegionDestroyedException: Server
> > connection from
> > [identity(gpdb(28401:loner):45180:20c75e59,connection=1; port=45180]:
> > Region named /SITMultiServerMultiRegion2 was not found during put
> > request
> >
> >     at com.gemstone.gemfire.internal.cache.tier.sockets.BaseCommand.
> > writeRegionDestroyedEx(BaseCommand.java:642)
> >
> >     at com.gemstone.gemfire.internal.cache.tier.sockets.command.
> > Put65.cmdExecute(Put65.java:195)
> >
> >     at com.gemstone.gemfire.internal.cache.tier.sockets.
> > BaseCommand.execute(BaseCommand.java:146)
> >
> >     at com.gemstone.gemfire.internal.cache.tier.sockets.
> > ServerConnection.doNormalMsg(ServerConnection.java:783)
> >
> >     at com.gemstone.gemfire.internal.cache.tier.sockets.
> > ServerConnection.doOneMessage(ServerConnection.java:913)
> >
> >     at com.gemstone.gemfire.internal.cache.tier.sockets.
> > ServerConnection.run(ServerConnection.java:1180)
> >
> >     at java.util.concurrent.ThreadPoolExecutor.runWorker(
> > ThreadPoolExecutor.java:1142)
> >
> >     at java.util.concurrent.ThreadPoolExecutor$Worker.run(
> > ThreadPoolExecutor.java:617)
> >
> >     at com.gemstone.gemfire.internal.cache.tier.sockets.
> > AcceptorImpl$1$1.run(AcceptorImpl.java:555)
> >
> >     at java.lang.Thread.run(Thread.java:745)
> >
> > ​
> >
> > Thanks,
> >
> > Goutam Tadi.
> >
> > --
> > Regards,
> > *Goutam Tadi.*
> >
>
-- 
Regards,
*Goutam Tadi.*

Re: Region Put errors out in Local Multi Server environment.

Posted by Dan Smith <ds...@pivotal.io>.
Hi Goutam,

It looks like you configured your two servers to have different regions.
Was that intentional? What's happening is that the client is connecting to
only one of the servers, which has one of your regions but not the other.

Generally, when you configure gemfire servers, you should configure the
same regions on all servers. In this case I would put both of your regions
in the same cache.xml and use that for both servers. By default a geode
client will assume that all of your servers have the same regions and will
connect to one or more servers as it sees fit to minimize the number of
connections and reduce the number of network hops.

If you really want to have servers that have different regions, you will
need to make use of the server-groups property on the server and create two
different pools on the client, using PoolFactory.setServerGroup to control
which group the client connects to. But I would say that's a less common
use case.

-Dan

On Fri, Sep 23, 2016 at 4:47 PM, Goutam Tadi <gt...@pivotal.io> wrote:

> Hi,
>
> I was facing the *"Region not found"* exception when I do the following on
> local machine (single Node) :
> And, I don't see the exception when I was trying to perform remote debug
> which introduced some time lapse. I tried to introduce some `sleep` , but
> of no use
> Can you please help and let me know what I could be possibly doing wrong?
>
> *Geode version: 1.0.0-incubating.M3*
>
> 1. *Start a locator : *
>
> start locator --name=testlocator --include-system-classpath
>
> ​
> 2. *Start two servers:*
>
> - start server --name=testserver1
> --cache-xml-file=SITMultiServerMultiRegion1.cache.xml
> --locators=localhost[10334] --server-port=30303
> --include-system-classpath
>
> - start server --name=testserver2
> --cache-xml-file=SITMultiServerMultiRegion2.cache.xml
> --locators=localhost[10334] --server-port=30304
> --include-system-classpath
>
> ​
> 3. *Java code to create ClientRegion and perform region.put()*
>
> private final static String LOCATOR_HOST = "localhost";
> private final static int LOCATOR_PORT = 10334;
>
> clientCache = new ClientCacheFactory().addPoolLocator(LOCATOR_HOST,
> LOCATOR_PORT).create();
>
> Region region1 = clientCache.
> createClientRegionFactory("PROXY").create(REGION1);
> assertNotNull(region1);
>
> Region region2 = clientCache.createClientRegionFactory("
> PROXY").create(REGION2);
> assertNotNull(region2);
>
> region1.put("key1", "region1"); // SUCCESSFUL
> region2.put("key2", "region2"); // ERROR OCCURRED.
>
> ​
> 4.* Cache xmls used:*
>
> *Cache-XML- 1*
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <cache
>  xmlns="http://schema.pivotal.io/gemfire/cache"
>  xmlns:gpdb="http://schema.pivotal.io/gemfire/gpdb"
>  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>  xsi:schemaLocation="http://schema.pivotal.io/gemfire/cache
> http://schema.pivotal.io/gemfire/cache/cache-8.1.xsd"
>  version="8.1">
>
>  <pdx read-serialized="true" persistent="false"/>
>
>  <region name="SITMultiServerMultiRegion1">
>  <region-attributes data-policy="partition">
>  <partition-attributes redundant-copies="1" />
>  </region>
>
> </cache>
>
> ​
>
>
> *Cache-XML- 2*
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <cache
>  xmlns="http://schema.pivotal.io/gemfire/cache"
>  xmlns:gpdb="http://schema.pivotal.io/gemfire/gpdb"
>  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>  xsi:schemaLocation="http://schema.pivotal.io/gemfire/cache
> http://schema.pivotal.io/gemfire/cache/cache-8.1.xsd"
>  version="8.1">
>
>  <pdx read-serialized="true" persistent="false"/>
>
>  <region name="SITMultiServerMultiRegion2">
>  <region-attributes data-policy="partition">
>  <partition-attributes redundant-copies="1" />
>  </region>
>
> </cache>
>
> ​
>
> 5. *StackTrace*:
>
>
> com.gemstone.gemfire.cache.client.ServerOperationException: remote
> server on gpdb(28401:loner):45180:20c75e59: : While performing a
> remote put
>
>     at com.gemstone.gemfire.cache.client.internal.PutOp$
> PutOpImpl.processAck(PutOp.java:445)
>
>     at com.gemstone.gemfire.cache.client.internal.PutOp$
> PutOpImpl.processResponse(PutOp.java:355)
>
>     at com.gemstone.gemfire.cache.client.internal.PutOp$
> PutOpImpl.attemptReadResponse(PutOp.java:540)
>
>     at com.gemstone.gemfire.cache.client.internal.AbstractOp.
> attempt(AbstractOp.java:378)
>
>     at com.gemstone.gemfire.cache.client.internal.ConnectionImpl.execute(
> ConnectionImpl.java:274)
>
>     at com.gemstone.gemfire.cache.client.internal.pooling.
> PooledConnection.execute(PooledConnection.java:328)
>
>     at com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.
> executeWithPossibleReAuthentication(OpExecutorImpl.java:937)
>
>     at com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.execute(
> OpExecutorImpl.java:155)
>
>     at com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.execute(
> OpExecutorImpl.java:110)
>
>     at com.gemstone.gemfire.cache.client.internal.PoolImpl.
> execute(PoolImpl.java:700)
>
>     at com.gemstone.gemfire.cache.client.internal.PutOp.execute(
> PutOp.java:102)
>
>     at com.gemstone.gemfire.cache.client.internal.ServerRegionProxy.put(
> ServerRegionProxy.java:175)
>
>     at com.gemstone.gemfire.internal.cache.LocalRegion.serverPut(
> LocalRegion.java:3173)
>
>     at com.gemstone.gemfire.internal.cache.LocalRegion.
> cacheWriteBeforePut(LocalRegion.java:3300)
>
>     at com.gemstone.gemfire.internal.cache.ProxyRegionMap.basicPut(
> ProxyRegionMap.java:230)
>
>     at com.gemstone.gemfire.internal.cache.LocalRegion.virtualPut(
> LocalRegion.java:5955)
>
>     at com.gemstone.gemfire.internal.cache.LocalRegionDataView.
> putEntry(LocalRegionDataView.java:132)
>
>     at com.gemstone.gemfire.internal.cache.LocalRegion.basicPut(
> LocalRegion.java:5350)
>
>     at com.gemstone.gemfire.internal.cache.LocalRegion.
> validatedPut(LocalRegion.java:1668)
>
>     at com.gemstone.gemfire.internal.cache.LocalRegion.put(
> LocalRegion.java:1655)
>
>     at com.gemstone.gemfire.internal.cache.AbstractRegion.put(
> AbstractRegion.java:288)
>
>     at io.pivotal.gemfire.gpdb.SITSample.testMultiRegion(
> SITSample.java:104)
>
> Caused by: com.gemstone.gemfire.cache.RegionDestroyedException: Server
> connection from
> [identity(gpdb(28401:loner):45180:20c75e59,connection=1; port=45180]:
> Region named /SITMultiServerMultiRegion2 was not found during put
> request
>
>     at com.gemstone.gemfire.internal.cache.tier.sockets.BaseCommand.
> writeRegionDestroyedEx(BaseCommand.java:642)
>
>     at com.gemstone.gemfire.internal.cache.tier.sockets.command.
> Put65.cmdExecute(Put65.java:195)
>
>     at com.gemstone.gemfire.internal.cache.tier.sockets.
> BaseCommand.execute(BaseCommand.java:146)
>
>     at com.gemstone.gemfire.internal.cache.tier.sockets.
> ServerConnection.doNormalMsg(ServerConnection.java:783)
>
>     at com.gemstone.gemfire.internal.cache.tier.sockets.
> ServerConnection.doOneMessage(ServerConnection.java:913)
>
>     at com.gemstone.gemfire.internal.cache.tier.sockets.
> ServerConnection.run(ServerConnection.java:1180)
>
>     at java.util.concurrent.ThreadPoolExecutor.runWorker(
> ThreadPoolExecutor.java:1142)
>
>     at java.util.concurrent.ThreadPoolExecutor$Worker.run(
> ThreadPoolExecutor.java:617)
>
>     at com.gemstone.gemfire.internal.cache.tier.sockets.
> AcceptorImpl$1$1.run(AcceptorImpl.java:555)
>
>     at java.lang.Thread.run(Thread.java:745)
>
> ​
>
> Thanks,
>
> Goutam Tadi.
>
> --
> Regards,
> *Goutam Tadi.*
>