Apache Geode CHANGELOG

Querying a Specific Member

When a region is specified with both REPLICATE and REPLICATE_PROXY region shortcuts on the server, a query could return a different result depending on the member on which it is executed.

Here is an example to illustrate this:

gfsh>connect --locator "localhost[64570]"
Connecting to Locator at [host=localhost, port=64570] ..
Connecting to Manager at [host=localhost, port=20571] ..
Successfully connected to: [host=localhost, port=20571]

gfsh>describe region --name "portfolio"
Name            : portfolio
Data Policy     : replicate
Hosting Members : server-2

Non-Default Attributes Shared By Hosting Members

Type   | Name        | Value
------ | ----------- | ---------------
Region | data-policy | REPLICATE
       | size        | 10
       | scope       | distributed-ack

Name             : portfolio
Data Policy      : empty
Accessor Members : server-1

Non-Default Attributes Shared By Accessor Members

Type   | Name        | Value
------ | ----------- | ---------------
Region | data-policy | EMPTY
       | size        | 0
       | scope       | distributed-ack

In this example, if the query is executed on a member with REPLICATE_PROXY, the result will be 0, as it will be a member without hosting data. To cope with this issue, you can specify the --member option forcing the query to be run on a member hosting the data.

gfsh>query --query="select ID, status from /portfolio where ID < 2"
Result : true
Limit : 100
Rows  : 0

gfsh>query --query="select ID, status from /portfolio where ID < 2" --member="server-2"
Result : true
Limit  : 100
Rows   : 2

ID | status
–- | --------
0  | active
1  | inactive (edited)