Uploaded image for project: 'Spring Data GemFire'
  1. Spring Data GemFire
  2. SGF-393

Region scope not properly set for replicated region, prevents client CQ from registering properly

    XMLWordPrintable

Details

    Description

      Configuring simple locator and cache server node with replicated region, using default scope for data policy on region, when client registers with server to create client side region, a CQ created to monitor behavior on region fails to register due to "unsupported" data policy of region. However, the default scope for REPLICATE region should be DISTRIBUTED_ACK. If the scope is set in the spring config for the region with scope="DISTRIBUTED_ACK", then there is no error.

      c:\Esteban\locator-missing-jar-problem>set CLASSPATH=C:\Users\ujyt\sts\epm-common\target\epm-common-15.30.0-SNAPSHOT.jar
      ;C:\Users\ujyt\.m2\repository\commons-lang\commons-lang\2.5\commons-lang-2.5.jar;%GEMFIRE%\lib\spring-core-3.2.12.RELEAS
      E.jar;%GEMFIRE%\lib\spring-data-gemfire-1.5.1.RELEASE.jar;%GEMFIRE%\lib\spring-context-3.2.12.RELEASE.jar;%GEMFIRE%\lib\
      spring-context-support-3.2.12.RELEASE.jar;%GEMFIRE%\lib\spring-beans-3.2.12.RELEASE.jar;%GEMFIRE%\lib\spring-expression-
      3.2.12.RELEASE.jar;%GEMFIRE%\lib\spring-data-commons-1.9.1.RELEASE.jar;%GEMFIRE%\lib\spring-tx-3.2.12.RELEASE.jar
      
      c:\Esteban\locator-missing-jar-problem>gfsh
          _________________________     __
         / _____/ ______/ ______/ /____/ /
        / /  __/ /___  /_____  / _____  /
       / /__/ / ____/  _____/ / /    / /
      /______/_/      /______/_/    /_/    v8.1.0
      
      Monitor and Manage GemFire
      gfsh>start locator --name=loc1 --port=41111 --properties-file=locator-gemfire.properties --include-system-classpath --J=
      -Dgemfire.OSProcess.ENABLE_OUTPUT_REDIRECTION=true
      Starting a GemFire Locator in C:\Esteban\locator-missing-jar-problem\loc1...
      ...............................
      Locator in C:\Esteban\locator-missing-jar-problem\loc1 on T43994.abc123.com[41111] as loc1 is currently online.
      Process ID: 10768
      Uptime: 15 seconds
      GemFire Version: 8.1.0
      Java Version: 1.7.0_51
      Log File: C:\Esteban\locator-missing-jar-problem\loc1\loc1.log
      JVM Arguments: -DgemfirePropertyFile=C:\Esteban\locator-missing-jar-problem\locator-gemfire.properties -Dgemfire.enable-
      cluster-configuration=true -Dgemfire.load-cluster-configuration-from-dir=false -Dgemfire.OSProcess.ENABLE_OUTPUT_REDIREC
      TION=true -Dgemfire.launcher.registerSignalHandlers=true -Djava.awt.headless=true -Dsun.rmi.dgc.server.gcInterval=922337
      2036854775806
      Class-Path: C:\GemFire\Pivotal_GemFire_810_b50625_Windows\lib\gemfire.jar;;C:\GemFire\Pivotal_GemFire_810_b50625_Windows
      \lib\gfsh-dependencies.jar;C:\GemFire\Pivotal_GemFire_810_b50625_Windows\lib\gemfire.jar;C:\GemFire\Pivotal_GemFire_810_
      b50625_Windows\lib\antlr.jar;C:\GemFire\Pivotal_GemFire_810_b50625_Windows\lib\gfsh-dependencies.jar;C:\GemFire\Pivotal_
      GemFire_810_b50625_Windows\lib\pulse-dependencies.jar;C:\GemFire\Pivotal_GemFire_810_b50625_Windows\lib\vault-api.jar;C:
      \GemFire\Pivotal_GemFire_810_b50625_Windows\lib\vault-impl.jar;C:\GemFire\Pivotal_GemFire_810_b50625_Windows\lib\epm-sec
      urity.jar;C:\GemFire\Pivotal_GemFire_810_b50625_Windows\lib\gem-security-ees.jar;C:\Users\ujyt\sts\epm-common\target\epm
      -common-15.30.0-SNAPSHOT.jar;C:\Users\ujyt\.m2\repository\commons-lang\commons-lang\2.5\commons-lang-2.5.jar;C:\GemFire\
      Pivotal_GemFire_810_b50625_Windows\lib\spring-core-3.2.12.RELEASE.jar;C:\GemFire\Pivotal_GemFire_810_b50625_Windows\lib\
      spring-data-gemfire-1.5.1.RELEASE.jar;C:\GemFire\Pivotal_GemFire_810_b50625_Windows\lib\spring-context-3.2.12.RELEASE.ja
      r;C:\GemFire\Pivotal_GemFire_810_b50625_Windows\lib\spring-context-support-3.2.12.RELEASE.jar;C:\GemFire\Pivotal_GemFire
      _810_b50625_Windows\lib\spring-beans-3.2.12.RELEASE.jar;C:\GemFire\Pivotal_GemFire_810_b50625_Windows\lib\spring-express
      ion-3.2.12.RELEASE.jar;C:\GemFire\Pivotal_GemFire_810_b50625_Windows\lib\spring-data-commons-1.9.1.RELEASE.jar;C:\jdk1.7
      .0\lib\tools.jar;C:\GemFire\Pivotal_GemFire_810_b50625_Windows\lib\locator-dependencies.jar
      
      Successfully connected to: [host=T43994.abc123.com, port=1099]
      
      Cluster configuration service is up and running.
      
      
      gfsh>start server --name=server1 --server-port=41116 --initial-heap=100m --max-heap=500m --properties-file=gemfire.prope
      rties --include-system-classpath --J=-Dgemfire.OSProcess.ENABLE_OUTPUT_REDIRECTION=true --spring-xml-location=file:/C:\E
      steban\locator-missing-jar-problem\spring-config.xml
      Starting a GemFire Server in C:\Esteban\locator-missing-jar-problem\server1...
      .......
      Server in C:\Esteban\locator-missing-jar-problem\server1 on T43994.abc123.com[40404] as server1 is currently online.
      Process ID: 8232
      Uptime: 3 seconds
      GemFire Version: 8.1.0
      Java Version: 1.7.0_51
      Log File: C:\Esteban\locator-missing-jar-problem\server1\server1.log
      JVM Arguments: -DgemfirePropertyFile=C:\Esteban\locator-missing-jar-problem\gemfire.properties -Dgemfire.use-cluster-con
      figuration=true -Dgemfire.OSProcess.ENABLE_OUTPUT_REDIRECTION=true -XX:OnOutOfMemoryError=taskkill /F /PID %p -Xms100m -
      Xmx500m -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=60 -Dgemfire.launcher.registerSignalHandlers=true -Dj
      ava.awt.headless=true -Dsun.rmi.dgc.server.gcInterval=9223372036854775806
      Class-Path: C:\GemFire\Pivotal_GemFire_810_b50625_Windows\lib\gemfire.jar;;C:\GemFire\Pivotal_GemFire_810_b50625_Windows
      \lib\gfsh-dependencies.jar;C:\GemFire\Pivotal_GemFire_810_b50625_Windows\lib\gemfire.jar;C:\GemFire\Pivotal_GemFire_810_
      b50625_Windows\lib\antlr.jar;C:\GemFire\Pivotal_GemFire_810_b50625_Windows\lib\gfsh-dependencies.jar;C:\GemFire\Pivotal_
      GemFire_810_b50625_Windows\lib\pulse-dependencies.jar;C:\GemFire\Pivotal_GemFire_810_b50625_Windows\lib\vault-api.jar;C:
      \GemFire\Pivotal_GemFire_810_b50625_Windows\lib\vault-impl.jar;C:\GemFire\Pivotal_GemFire_810_b50625_Windows\lib\epm-sec
      urity.jar;C:\GemFire\Pivotal_GemFire_810_b50625_Windows\lib\gem-security-ees.jar;C:\Users\ujyt\sts\epm-common\target\epm
      -common-15.30.0-SNAPSHOT.jar;C:\Users\ujyt\.m2\repository\commons-lang\commons-lang\2.5\commons-lang-2.5.jar;C:\GemFire\
      Pivotal_GemFire_810_b50625_Windows\lib\spring-core-3.2.12.RELEASE.jar;C:\GemFire\Pivotal_GemFire_810_b50625_Windows\lib\
      spring-data-gemfire-1.5.1.RELEASE.jar;C:\GemFire\Pivotal_GemFire_810_b50625_Windows\lib\spring-context-3.2.12.RELEASE.ja
      r;C:\GemFire\Pivotal_GemFire_810_b50625_Windows\lib\spring-context-support-3.2.12.RELEASE.jar;C:\GemFire\Pivotal_GemFire
      _810_b50625_Windows\lib\spring-beans-3.2.12.RELEASE.jar;C:\GemFire\Pivotal_GemFire_810_b50625_Windows\lib\spring-express
      ion-3.2.12.RELEASE.jar;C:\GemFire\Pivotal_GemFire_810_b50625_Windows\lib\spring-data-commons-1.9.1.RELEASE.jar;C:\GemFir
      e\Pivotal_GemFire_810_b50625_Windows\lib\spring-tx-3.2.12.RELEASE.jar;C:\jdk1.7.0\lib\tools.jar;C:\GemFire\Pivotal_GemFi
      re_810_b50625_Windows\lib\server-dependencies.jar;C:\GemFire\Pivotal_GemFire_810_b50625_Windows\lib\spring-aop-3.2.11.RE
      LEASE.jar;C:\GemFire\Pivotal_GemFire_810_b50625_Windows\lib\spring-beans-3.2.11.RELEASE.jar;C:\GemFire\Pivotal_GemFire_8
      10_b50625_Windows\lib\spring-context-3.2.11.RELEASE.jar;C:\GemFire\Pivotal_GemFire_810_b50625_Windows\lib\spring-context
      -support-3.2.11.RELEASE.jar;C:\GemFire\Pivotal_GemFire_810_b50625_Windows\lib\spring-expression-3.2.11.RELEASE.jar;C:\Ge
      mFire\Pivotal_GemFire_810_b50625_Windows\lib\spring-tx-3.2.11.RELEASE.jar;C:\GemFire\Pivotal_GemFire_810_b50625_Windows\
      lib\spring-data-commons-1.9.0.RELEASE.jar;C:\GemFire\Pivotal_GemFire_810_b50625_Windows\lib\spring-data-gemfire-1.5.1.BU
      ILD-SNAPSHOT.jar
      
      gfsh>list members
       Name   | Id
      ------- | -------------------------------------------
      server1 | 10.2.8.71(server1:8232)<v1>:27966
      loc1    | 10.2.8.71(loc1:10768:locator)<ec><v0>:37611
      
      gfsh>list regions
      List of regions
      ---------------
      exampleRegion
      
      gfsh>show metrics
      
      Cluster-wide Metrics
      
      Category  |        Metric         | Value
      --------- | --------------------- | -----
      cluster   | totalHeapSize         | 7733
      cache     | totalRegionEntryCount | 0
                | totalRegionCount      | 1
                | totalMissCount        | 0
                | totalHitCount         | 3
      diskstore | totalDiskUsage        | 0
                | diskReadsRate         | 0
                | diskWritesRate        | 0
                | flushTimeAvgLatency   | 0
                | totalBackupInProgress | 0
      query     | activeCQCount         | 0
                | queryRequestRate      | 0
      
      
      Exception on server side

      10:34:48.431 [main] INFO c.v.g.GemfireClientApplicationLoader - Sample region /exampleRegion initialized
      Exception in thread "main" com.gemstone.gemfire.cache.query.CqException: Failed to execute the CQ. CqName: ees-cq-test, Query String is: SELECT * FROM /exampleRegion r where r.startsWith('2012'), Error from last server: remote server on T43994(ClientWorkerSTS-GemfireClient:loner):1143:c4bb278f:ClientWorkerSTS-GemfireClient: The replicated region /exampleRegion specified in CQ creation does not have scope supported by CQ. The CQ supported scopes are DISTRIBUTED_ACK and GLOBAL.
      at com.gemstone.gemfire.cache.query.internal.CqQueryImpl.executeCqOnRedundantsAndPrimary(CqQueryImpl.java:1198)
      at com.gemstone.gemfire.cache.query.internal.CqQueryImpl.executeWithInitialResults(CqQueryImpl.java:1046)
      at com.abc123.gemfire.GemfireClientApplicationLoader.initializeCache(GemfireClientApplicationLoader.java:62)
      at com.abc123.gemfire.GemfireClientApplicationLoader.main(GemfireClientApplicationLoader.java:30)
      Caused by: com.gemstone.gemfire.cache.client.ServerOperationException: remote server on T43994(ClientWorkerSTS-GemfireClient:loner):1143:c4bb278f:ClientWorkerSTS-GemfireClient: The replicated region /exampleRegion specified in CQ creation does not have scope supported by CQ. The CQ supported scopes are DISTRIBUTED_ACK and GLOBAL.
      at com.gemstone.gemfire.cache.client.internal.AbstractOp.processChunkedResponse(AbstractOp.java:336)
      at com.gemstone.gemfire.cache.client.internal.QueryOp$QueryOpImpl.processResponse(QueryOp.java:165)
      at com.gemstone.gemfire.cache.client.internal.AbstractOp.processResponse(AbstractOp.java:215)
      at com.gemstone.gemfire.cache.client.internal.AbstractOp.attemptReadResponse(AbstractOp.java:153)
      at com.gemstone.gemfire.cache.client.internal.AbstractOp.attempt(AbstractOp.java:369)
      at com.gemstone.gemfire.cache.client.internal.ConnectionImpl.execute(ConnectionImpl.java:270)
      at com.gemstone.gemfire.cache.client.internal.QueueConnectionImpl.execute(QueueConnectionImpl.java:158)
      at com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.executeWithPossibleReAuthentication(OpExecutorImpl.java:930)
      at com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.executeOnQueuesAndReturnPrimaryResult(OpExecutorImpl.java:544)
      at com.gemstone.gemfire.cache.client.internal.PoolImpl.executeOnQueuesAndReturnPrimaryResult(PoolImpl.java:765)
      at com.gemstone.gemfire.cache.client.internal.CreateCQWithIROp.execute(CreateCQWithIROp.java:35)
      at com.gemstone.gemfire.cache.client.internal.ServerCQProxy.createWithIR(ServerCQProxy.java:77)
      at com.gemstone.gemfire.cache.query.internal.CqQueryImpl.executeCqOnRedundantsAndPrimary(CqQueryImpl.java:1168)
      ... 3 more

      locator-gemfire.properties
      mcast-port=0
      log-level=config
      enable-network-partition-detection=true
      
      gemfire.properties
      locators=localhost[41111]
      mcast-port=0
      log-level=config
      
      spring-config.xml
      <?xml version="1.0" encoding="UTF-8"?>
      <beans xmlns="http://www.springframework.org/schema/beans"
         xmlns:gfe="http://www.springframework.org/schema/gemfire" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:context="http://www.springframework.org/schema/context"
         xsi:schemaLocation="
                 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
                 http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
                 http://www.springframework.org/schema/gemfire http://www.springframework.org/schema/gemfire/spring-gemfire.xsd">
      
      
         <gfe:cache-server port="40404" socket-buffer-size="65536"/>
         <gfe:cache copy-on-read="false"/>
         <gfe:replicated-region id="exampleRegion" name="exampleRegion">
             
         </gfe:replicated-region>
      
      </beans>
      

      And the client code looks like

      GemfireClientApplicationLoader.java
      package com.abc123.gemfire;
      
      import org.slf4j.Logger;
      import org.slf4j.LoggerFactory;
      
      import com.gemstone.gemfire.cache.Region;
      import com.gemstone.gemfire.cache.client.ClientCache;
      import com.gemstone.gemfire.cache.client.ClientCacheFactory;
      import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
      import com.gemstone.gemfire.cache.query.CqAttributes;
      import com.gemstone.gemfire.cache.query.CqAttributesFactory;
      import com.gemstone.gemfire.cache.query.CqListener;
      import com.gemstone.gemfire.cache.query.CqQuery;
      import com.gemstone.gemfire.cache.query.CqResults;
      import com.gemstone.gemfire.cache.query.QueryService;
      import com.vanguard.gemfire.listener.SimpleCacheListener;
      import com.vanguard.gemfire.listener.SimpleCqListener;
      
      public class GemfireClientApplicationLoader {
             
              private static final Logger logger = LoggerFactory.getLogger(GemfireClientApplicationLoader.class);
             
              private ClientCache cache;
             
              private Region<String, String> sampleRegion;
             
              public static void main(String[] args) throws Exception {
                     
                      GemfireClientApplicationLoader loader = new GemfireClientApplicationLoader();
                      loader.initializeCache();
                      loader.getFilteredEntries();
                      loader.closeCache();
              }
      
              private void initializeCache() throws Exception {
                      cache = new ClientCacheFactory()
                              .set("name", "ClientWorkerSTS-GemfireClient")
                              .addPoolLocator("localhost", 41111)
                              .setPoolSubscriptionEnabled(true)
                              .setPoolSubscriptionRedundancy(1)
                              .set("security-username", "root")
                              .set("security-password", "root")
                              .set("log-level", "config").create();
                     
                      final SimpleCacheListener<String, String> listener = new SimpleCacheListener<>();
                     
                      sampleRegion = cache.<String, String>createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY)
                              .addCacheListener(listener)
                              .create("exampleRegion");
                      logger.info(String.format("Sample region %s initialized", sampleRegion.getFullPath()));
                      sampleRegion.registerInterestRegex(".*");
                     
                      QueryService queryService = cache.getQueryService();
                      CqAttributesFactory cqaf = new CqAttributesFactory();
                      cqaf.initCqListeners(new CqListener[] { new SimpleCqListener("ClientWorkerSTS") });
                      CqAttributes cqattrs = cqaf.create();
                     
                      String cqquery = "SELECT * FROM /exampleRegion r where r.startsWith('2012')";
                      CqQuery newCq = queryService.newCq("ees-cq-test", cqquery, cqattrs);
                      CqResults<Object> matches = newCq.executeWithInitialResults();
                     
                      logger.info(String.format("Found matching entries: %s", org.springframework.util.StringUtils.collectionToDelimitedString(matches.asList(), ",")));
              }
      
              private void closeCache() {
                      cache.close();                
              }
      
              private void getFilteredEntries() throws Exception {
                      logger.info("Getting entries ....");
              }
      }
      

      Let me know if you need any other info.
      Thanks
      Esteban

      Attachments

        1. Address.java
          4 kB
        2. cache-cqs.xml
          0.6 kB
        3. ClientCacheWithCqsTest.java
          4 kB
        4. ClientCacheWithCqsTest-context.xml
          2 kB
        5. NativePeerCacheApp.java
          11 kB

        Activity

          People

            jblum John Blum
            st96d045 Esteban Serrano
            Trevor Marshall Trevor Marshall
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: