You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geode.apache.org by vas aj <va...@gmail.com> on 2020/07/26 21:33:22 UTC

Deleting key from region permanently

Hi team,

I have my region defined in cache.xml as follows:

<region name="customer" refid="PARTITION_REDUNDANT_PERSISTENT">
    <region-attributes disk-store-name="customer-disk-store-1"
statistics-enabled="true" disk-synchronous="false"/>
</region>

I use the below query to remove some customer Ids for 4 servers

ClientCache clientCache = new ClientCacheFactory().set("cache-xml-file",
"cache.xml").create();.

customerRegion = clientCache.getRegion("customer");
List<String> expiredCustomers =
          new ArrayList<>(
              customerRegion.query(
                  "select customerId from /customer where timeLeftToExpire
< "
                      + currentTimeInMillis
                      + "L"));

customerRegion.removeAll(expiredCustomers);

There are no errors. However when I run

query --query="select customerId from
/customer where customerId=CUSTOMER_ID_THAT_IS_DELETED"

I get a row. However, the expectation was ZERO.

What am I missing to delete the key permanently from the geode cluster ?

Regards,
Ajay Vasudevan

Re: Deleting key from region permanently

Posted by Udo Kohlmeyer <ud...@vmware.com>.
Hi there  Ajay,

To confirm,
You have a created a single `cache.xml` file that configures a region called `customer`.

You then create that region on the server-side of type “PARTITION_REDUNDANT_PERSISTENT”.

What is the configuration of the region on the client side? To clarify, you cannot use the same `cache.xml` file that you used to create the region on the server-side to create the region on the client-side.

Clients should only create regions of type “PROXY” or “CACHING_PROXY”. In addition, you would need to create a connection pool to connect to the locators/servers.

Please refer to the Geode In 5 Minutes<https://cwiki.apache.org/confluence/display/GEODE/Index#Index-Geodein5minutesGeodein5minutes> guide to see how to do this.

In the same client code, you can then also apply the same logic as you have described of how to delete data.

Hope this helps.

—Udo
On Jul 26, 2020, 2:33 PM -0700, vas aj <va...@gmail.com>, wrote:
Hi team,

I have my region defined in cache.xml as follows:

<region name="customer" refid="PARTITION_REDUNDANT_PERSISTENT">
    <region-attributes disk-store-name="customer-disk-store-1" statistics-enabled="true" disk-synchronous="false"/>
</region>

I use the below query to remove some customer Ids for 4 servers

ClientCache clientCache = new ClientCacheFactory().set("cache-xml-file", "cache.xml").create();.

customerRegion = clientCache.getRegion("customer");
List<String> expiredCustomers =
          new ArrayList<>(
              customerRegion.query(
                  "select customerId from /customer where timeLeftToExpire < "
                      + currentTimeInMillis
                      + "L"));

customerRegion.removeAll(expiredCustomers);

There are no errors. However when I run

query --query="select customerId from /customer where customerId=CUSTOMER_ID_THAT_IS_DELETED"

I get a row. However, the expectation was ZERO.

What am I missing to delete the key permanently from the geode cluster ?

Regards,
Ajay Vasudevan