[jira] [Commented] (GEODE-4088) add a dunit test to prove TX will have different behavior for region.keySet
[ https://issues.apache.org/jira/browse/GEODE-4088?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16295471#comment-16295471 ] ASF GitHub Bot commented on GEODE-4088: --- jhuynh1 closed pull request #1159: GEODE-4088: add a dunit test to show the client region keySet() in TX URL: https://github.com/apache/geode/pull/1159 This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > add a dunit test to prove TX will have different behavior for region.keySet > --- > > Key: GEODE-4088 > URL: https://issues.apache.org/jira/browse/GEODE-4088 > Project: Geode > Issue Type: Bug > Components: client/server >Reporter: xiaojian zhou >Assignee: xiaojian zhou > > Some code used region.keySet() at client side with policy NORMAL. It expected > to get local entries only. But in TX, it will actually iterate server > region's entries. > I introduced a dunit test to show the difference with and without TX. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (GEODE-4088) add a dunit test to prove TX will have different behavior for region.keySet
[ https://issues.apache.org/jira/browse/GEODE-4088?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16295473#comment-16295473 ] ASF subversion and git services commented on GEODE-4088: Commit 8d868303d9275d45eadd46325f9bdaa7e225ea8a in geode's branch refs/heads/develop from Xiaojian Zhou [ https://gitbox.apache.org/repos/asf?p=geode.git;h=8d86830 ] GEODE-4088: add a dunit test to show the client region keySet() in TX (#1159) > add a dunit test to prove TX will have different behavior for region.keySet > --- > > Key: GEODE-4088 > URL: https://issues.apache.org/jira/browse/GEODE-4088 > Project: Geode > Issue Type: Bug > Components: client/server >Reporter: xiaojian zhou >Assignee: xiaojian zhou > > Some code used region.keySet() at client side with policy NORMAL. It expected > to get local entries only. But in TX, it will actually iterate server > region's entries. > I introduced a dunit test to show the difference with and without TX. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (GEODE-4088) add a dunit test to prove TX will have different behavior for region.keySet
[ https://issues.apache.org/jira/browse/GEODE-4088?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16291414#comment-16291414 ] ASF GitHub Bot commented on GEODE-4088: --- pivotal-eshu commented on a change in pull request #1159: GEODE-4088: add a dunit test to show the client region keySet() in TX URL: https://github.com/apache/geode/pull/1159#discussion_r157036205 ## File path: geode-core/src/test/java/org/apache/geode/internal/cache/ClientServerTransactionDUnitTest.java ## @@ -892,6 +892,82 @@ public Object call() throws Exception { } } + @Test + public void keySetFromClientRegionWillGetKeysFromServerIfTX() throws Exception { +Host host = Host.getHost(0); +VM server = host.getVM(0); +VM client = host.getVM(1); +VM client2 = host.getVM(2); +int port1 = createRegionsAndStartServer(server, false); +createClientRegionAndPopulateData(client, port1, false); +createClientRegion(client2, port1, false); + +client2.invoke(new SerializableRunnable("verify client region with tx") { + public void run() throws Exception { +TXManagerImpl mgr = getGemfireCache().getTxManager(); +RegionorderRegion = getCache().getRegion(ORDER); +LocalRegion lr = (LocalRegion) orderRegion; +assertEquals(DataPolicy.NORMAL, orderRegion.getAttributes().getDataPolicy()); +CustId custId = new CustId(1); +OrderId orderId = new OrderId(1, custId); +Set setWithoutTX = orderRegion.keySet(); +Iterator iterWithoutTX = setWithoutTX.iterator(); +if (!iterWithoutTX.hasNext()) { + org.apache.geode.test.dunit.LogWriterUtils.getLogWriter().info("No keys in region"); +} else { + org.apache.geode.test.dunit.LogWriterUtils.getLogWriter() + .info("Region size:" + orderRegion.size()); +} +// without tx, the local region with NORMAL policy will get nothing from server Review comment: This comment is wrong. By default, region.keySet does not go to server without tx. You should use region.keySetOnServer to get server keys. The keySet with tx is behaved like keySetOnServer -- as all operations in a client transaction are performed on server. And those operations are applied to client cache (if it not empty) once commit is successful on the server. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > add a dunit test to prove TX will have different behavior for region.keySet > --- > > Key: GEODE-4088 > URL: https://issues.apache.org/jira/browse/GEODE-4088 > Project: Geode > Issue Type: Bug > Components: client/server >Reporter: xiaojian zhou >Assignee: xiaojian zhou > > Some code used region.keySet() at client side with policy NORMAL. It expected > to get local entries only. But in TX, it will actually iterate server > region's entries. > I introduced a dunit test to show the difference with and without TX. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (GEODE-4088) add a dunit test to prove TX will have different behavior for region.keySet
[ https://issues.apache.org/jira/browse/GEODE-4088?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16288464#comment-16288464 ] ASF GitHub Bot commented on GEODE-4088: --- gesterzhou opened a new pull request #1159: GEODE-4088: add a dunit test to show the client region keySet() in TX URL: https://github.com/apache/geode/pull/1159 @ladyVader Thank you for submitting a contribution to Apache Geode. In order to streamline the review of the contribution we ask you to ensure the following steps have been taken: ### For all changes: - [ ] Is there a JIRA ticket associated with this PR? Is it referenced in the commit message? - [ ] Has your PR been rebased against the latest commit within the target branch (typically `develop`)? - [ ] Is your initial contribution a single, squashed commit? - [ ] Does `gradlew build` run cleanly? - [ ] Have you written or updated unit tests to verify your changes? - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? ### Note: Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible. If you need help, please send an email to d...@geode.apache.org. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > add a dunit test to prove TX will have different behavior for region.keySet > --- > > Key: GEODE-4088 > URL: https://issues.apache.org/jira/browse/GEODE-4088 > Project: Geode > Issue Type: Bug > Components: client/server >Reporter: xiaojian zhou >Assignee: xiaojian zhou > Fix For: 1.4.0 > > > Some code used region.keySet() at client side with policy NORMAL. It expected > to get local entries only. But in TX, it will actually iterate server > region's entries. > I introduced a dunit test to show the difference with and without TX. -- This message was sent by Atlassian JIRA (v6.4.14#64029)