[
https://issues.apache.org/jira/browse/GEODE-6220?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Udo Kohlmeyer updated GEODE-6220:
---------------------------------
Description:
Using client:
{code:java}
fun main(args: Array<String>) {
val cache = ClientCacheFactory()
.addPoolLocator("localhost", 10334)
.setPoolSubscriptionEnabled(true)
.setPoolSubscriptionRedundancy(0)
.create()
cache.copyOnRead = false
val regionFactory = cache.createClientRegionFactory<String,
TestObject>(ClientRegionShortcut.CACHING_PROXY)
regionFactory.addCacheListener(RegisterInterestCacheListener())
val region = regionFactory.create("TestRegion")
val testObject = TestObject("line1", "line2")
region["key1"] = testObject
println("Contains key locally: ${region.containsKey("key1")} and contains
key on server: ${region.containsKeyOnServer("key1")}")
val testObjectFromCache = region["key1"]
while (testObjectFromCache === region["key1"]) {
Thread.sleep(1000)
println(System.identityHashCode(region["key1"]))
}
println("BROKEN")
}
class RegisterInterestCacheListener : CacheListenerAdapter<String,
TestObject>() {
override fun afterCreate(event: EntryEvent<String, TestObject>) {
Thread().run { event.region.registerInterest(event.key,
InterestResultPolicy.NONE,false,true)}
}
override fun afterUpdate(event: EntryEvent<String, TestObject>) {
println("UPDATED: ${event.newValue}")
}
override fun afterInvalidate(event: EntryEvent<String, TestObject>) {
println("Invalidated: ${event.newValue}")
}
override fun afterDestroy(event: EntryEvent<String, TestObject>) {
println("Destroy: ${event.newValue}")
}
}
{code}
with server:
{code}
fun main(args: Array<String>) {
val cache = CacheFactory()
.set("start-locator", "localhost[10334]")
.set("mcast-port", "0")
.create()
cache.addCacheServer()?.also{
it.port = 0
it.bindAddress = "localhost"}!!.start()
val region = cache.createRegionFactory<String,
TestObject>(RegionShortcut.REPLICATE).create("TestRegion")
while(true)
{
Thread.sleep(5000)
}
}
{code}
When registering interest on a key, with `InterestResultPolicy` of `NONE`
causes the interest registration to invalidate the local copy of the client.
According to the documentation, `NONE` should just enable/disable the bulk
loading of data from the server when registering interest, NOT invalidate the
data on the client.
in the docs under *Client Interest Registration on the Server* #3 calls out
that `NONE` disables the bulk loading of data from the server
https://geode.apache.org/docs/guide/18/developing/events/how_client_server_distribution_works.html
The javadoc for the class is vague and not helpful
https://geode.apache.org/releases/latest/javadoc/org/apache/geode/cache/InterestResultPolicy.html
and the `Region Interface` specifies the following:
https://geode.apache.org/releases/latest/javadoc/org/apache/geode/cache/Region.html#registerInterest-K-org.apache.geode.cache.InterestResultPolicy-boolean-boolean-
{noformat}
policy - The interest result policy. This can be one of:
*****InterestResultPolicy.NONE - does not initialize the local cache******
InterestResultPolicy.KEYS - initializes the local cache with the keys
satisfying the request
InterestResultPolicy.KEYS_VALUES - initializes the local cache with the keys
and current values satisfying the request
{noformat}
The Expectation is that that the client gets stuck in loop printing out the
identity hashcode, because the local client entry is never updated and does not
receive any data from the servers.
{code}
val testObjectFromCache = region["key1"]
while (testObjectFromCache === region["key1"]) {
Thread.sleep(1000)
println(System.identityHashCode(region["key1"]))
}
{code}
was:
Using client:
{code:java}
fun main(args: Array<String>) {
val cache = ClientCacheFactory()
.addPoolLocator("localhost", 10334)
.setPoolSubscriptionEnabled(true)
.setPoolSubscriptionRedundancy(0)
.create()
cache.copyOnRead = false
val regionFactory = cache.createClientRegionFactory<String,
TestObject>(ClientRegionShortcut.CACHING_PROXY)
regionFactory.addCacheListener(RegisterInterestCacheListener())
val region = regionFactory.create("TestRegion")
val testObject = TestObject("line1", "line2")
region["key1"] = testObject
println("Contains key locally: ${region.containsKey("key1")} and contains
key on server: ${region.containsKeyOnServer("key1")}")
val testObjectFromCache = region["key1"]
while (testObjectFromCache === region["key1"]) {
Thread.sleep(1000)
println(System.identityHashCode(region["key1"]))
}
println("BROKEN")
}
class RegisterInterestCacheListener : CacheListenerAdapter<String,
TestObject>() {
override fun afterCreate(event: EntryEvent<String, TestObject>) {
Thread().run { event.region.registerInterest(event.key,
InterestResultPolicy.NONE,false,true)}
}
override fun afterUpdate(event: EntryEvent<String, TestObject>) {
println("UPDATED: ${event.newValue}")
}
override fun afterInvalidate(event: EntryEvent<String, TestObject>) {
println("Invalidated: ${event.newValue}")
}
override fun afterDestroy(event: EntryEvent<String, TestObject>) {
println("Destroy: ${event.newValue}")
}
}
{code}
with server:
{code}
fun main(args: Array<String>) {
val cache = CacheFactory()
.set("start-locator", "localhost[10334]")
.set("mcast-port", "0")
.create()
cache.addCacheServer()?.also{
it.port = 0
it.bindAddress = "localhost"}!!.start()
val region = cache.createRegionFactory<String,
TestObject>(RegionShortcut.REPLICATE).create("TestRegion")
while(true)
{
Thread.sleep(5000)
}
}
{code}
When registering interest on a key, with `InterestResultPolicy` of `NONE`
causes the interest registration to invalidate the local copy of the client.
According to the documentation, `NONE` should just enable/disable the bulk
loading of data from the server when registering interest, NOT invalidate the
data on the client.
in the docs under *Client Interest Registration on the Server* #3 calls out
that `NONE` disables the bulk loading of data from the server
https://geode.apache.org/docs/guide/18/developing/events/how_client_server_distribution_works.html
The javadoc for the class is vague and not helpful
https://geode.apache.org/releases/latest/javadoc/org/apache/geode/cache/InterestResultPolicy.html
and the `Region Interface` specifies the following:
https://geode.apache.org/releases/latest/javadoc/org/apache/geode/cache/Region.html#registerInterest-K-org.apache.geode.cache.InterestResultPolicy-boolean-boolean-
{noformat}
policy - The interest result policy. This can be one of:
*****InterestResultPolicy.NONE - does not initialize the local cache******
InterestResultPolicy.KEYS - initializes the local cache with the keys
satisfying the request
InterestResultPolicy.KEYS_VALUES - initializes the local cache with the keys
and current values satisfying the request
{noformat}
> Registering Interest on a key, causes the local entry to be
> invalidated/destroyed
> ---------------------------------------------------------------------------------
>
> Key: GEODE-6220
> URL: https://issues.apache.org/jira/browse/GEODE-6220
> Project: Geode
> Issue Type: Bug
> Components: client/server, regions
> Affects Versions: 1.1.0, 1.1.1, 1.2.0, 1.3.0, 1.2.1, 1.4.0, 1.5.0, 1.6.0,
> 1.7.0, 1.8.0
> Reporter: Udo Kohlmeyer
> Priority: Major
>
> Using client:
> {code:java}
> fun main(args: Array<String>) {
> val cache = ClientCacheFactory()
> .addPoolLocator("localhost", 10334)
> .setPoolSubscriptionEnabled(true)
> .setPoolSubscriptionRedundancy(0)
> .create()
> cache.copyOnRead = false
> val regionFactory = cache.createClientRegionFactory<String,
> TestObject>(ClientRegionShortcut.CACHING_PROXY)
> regionFactory.addCacheListener(RegisterInterestCacheListener())
> val region = regionFactory.create("TestRegion")
> val testObject = TestObject("line1", "line2")
> region["key1"] = testObject
> println("Contains key locally: ${region.containsKey("key1")} and contains
> key on server: ${region.containsKeyOnServer("key1")}")
> val testObjectFromCache = region["key1"]
> while (testObjectFromCache === region["key1"]) {
> Thread.sleep(1000)
> println(System.identityHashCode(region["key1"]))
> }
> println("BROKEN")
> }
> class RegisterInterestCacheListener : CacheListenerAdapter<String,
> TestObject>() {
> override fun afterCreate(event: EntryEvent<String, TestObject>) {
> Thread().run { event.region.registerInterest(event.key,
> InterestResultPolicy.NONE,false,true)}
> }
> override fun afterUpdate(event: EntryEvent<String, TestObject>) {
> println("UPDATED: ${event.newValue}")
> }
> override fun afterInvalidate(event: EntryEvent<String, TestObject>) {
> println("Invalidated: ${event.newValue}")
> }
> override fun afterDestroy(event: EntryEvent<String, TestObject>) {
> println("Destroy: ${event.newValue}")
> }
> }
> {code}
> with server:
> {code}
> fun main(args: Array<String>) {
> val cache = CacheFactory()
> .set("start-locator", "localhost[10334]")
> .set("mcast-port", "0")
> .create()
> cache.addCacheServer()?.also{
> it.port = 0
> it.bindAddress = "localhost"}!!.start()
> val region = cache.createRegionFactory<String,
> TestObject>(RegionShortcut.REPLICATE).create("TestRegion")
> while(true)
> {
> Thread.sleep(5000)
> }
> }
> {code}
> When registering interest on a key, with `InterestResultPolicy` of `NONE`
> causes the interest registration to invalidate the local copy of the client.
> According to the documentation, `NONE` should just enable/disable the bulk
> loading of data from the server when registering interest, NOT invalidate the
> data on the client.
> in the docs under *Client Interest Registration on the Server* #3 calls out
> that `NONE` disables the bulk loading of data from the server
> https://geode.apache.org/docs/guide/18/developing/events/how_client_server_distribution_works.html
> The javadoc for the class is vague and not helpful
> https://geode.apache.org/releases/latest/javadoc/org/apache/geode/cache/InterestResultPolicy.html
> and the `Region Interface` specifies the following:
> https://geode.apache.org/releases/latest/javadoc/org/apache/geode/cache/Region.html#registerInterest-K-org.apache.geode.cache.InterestResultPolicy-boolean-boolean-
> {noformat}
> policy - The interest result policy. This can be one of:
> *****InterestResultPolicy.NONE - does not initialize the local cache******
> InterestResultPolicy.KEYS - initializes the local cache with the keys
> satisfying the request
> InterestResultPolicy.KEYS_VALUES - initializes the local cache with the keys
> and current values satisfying the request
> {noformat}
> The Expectation is that that the client gets stuck in loop printing out the
> identity hashcode, because the local client entry is never updated and does
> not receive any data from the servers.
> {code}
> val testObjectFromCache = region["key1"]
> while (testObjectFromCache === region["key1"]) {
> Thread.sleep(1000)
> println(System.identityHashCode(region["key1"]))
> }
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)