You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by vkulichenko <va...@gmail.com> on 2015/11/23 20:27:48 UTC
Re: remove cache on high-speed
Hi,
Can you please properly subscribe to the mailing list so that community
receives email notifications? Follow the instructions here:
http://apache-ignite-users.70518.x6.nabble.com/mailing_list/MailingListOptions.jtp?forum=1
wychoi wrote
> hi
> In multiple cluster nodes environment
>
> I removed the cache on high-speed (1 ms),
>
> Then killed one of the cluster nodes(server), and then node(server) launch
> again
>
> Several caches are not deleted survives again
> and retain cache in cacheMetricsMxBean of visualvm
>
> ignite have any problems ?
>
> code -------------------
>
> cache.remove(key);
> cache.clear(key);
I'm not sure I understand what you're trying to achieve. First of all, it
doesn't make much sense to do remove operation and then clear for the same
key, because entry is already removed by the first one. Actually, these
methods have much in common and both remove the entry from the cache. The
difference is that remove() is additionally enlisted in the transaction (if
there is any) and also delegates to the persistence store.
Can you please describe your use case? Also what metric on MX bean are you
looking at?
-Val
--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/remove-cache-on-high-speed-tp2039p2041.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.
Re: remove cache on high-speed
Posted by Denis Magda <dm...@gridgain.com>.
Hi,
I'm a bit confuse. You say that cache.size() evaluates to 0 but how do
you find out that there are some entries left in the cache?
Sorry, if I didn't get this from your latest responses.
In any case I don't think continuous queries influences on what you're
observing.
To make things easier please provide a complete example that we can run
on our side. You can share it over GitHub or some other way.
--
Denis
On 11/25/2015 12:03 PM, wychoi wrote:
> I have applied cache.remove() only
>
> confirm cache.size(CachePeekMode.ALL); ==> 0
>
> but a few cache revive
>
> I use ContinuousQuery for getting cache
> Is there relationship because using the Continuous Query?
>
>
> ContinuousQuery<AffinityKey, XObject> query = new ContinuousQuery<>();
> query.setLocal(true);
> query.setTimeInterval(300);
> query.setPageSize(512);
>
> SqlQuery sqlQuery = new SqlQuery<AffinityKey, XObject>(XObject.class,
> "sequence > 1");
> sqlQuery.setLocal(true);
> sqlQuery.setPageSize(512);
>
> query.setInitialQuery(sqlQuery);
>
> query.setLocalListener(new CacheEntryUpdatedListener<AffinityKey, XObject>()
> {
> @Override
> public void onUpdated(Iterable<CacheEntryEvent<? extends AffinityKey, ?
> extends XObject>> events) {
>
> for (CacheEntryEvent<? extends AffinityKey, ? extends XObject> entry :
> events) {
>
> Long key = (Long)entry.getKey().key();
> int part = (int)entry.getKey().affinityKey();
> XObject wrap = entry.getValue();
> // put data for other source
> }
> }
> }
>
> QueryCursor<Cache.Entry<AffinityKey, XObject>> cur = cache.query(query);
> for (Cache.Entry<AffinityKey, XObject> entry : cur) {
>
> Long key = (Long) entry.getKey().key();
> int part = (int)entry.getKey().affinityKey();
> XObject wrap = entry.getValue();
> // put data for other source
>
> }
>
>
>
> --
> View this message in context: http://apache-ignite-users.70518.x6.nabble.com/remove-cache-on-high-speed-tp2039p2055.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
Re: remove cache on high-speed
Posted by wychoi <wy...@bistel.co.kr>.
I have applied cache.remove() only
confirm cache.size(CachePeekMode.ALL); ==> 0
but a few cache revive
I use ContinuousQuery for getting cache
Is there relationship because using the Continuous Query?
ContinuousQuery<AffinityKey, XObject> query = new ContinuousQuery<>();
query.setLocal(true);
query.setTimeInterval(300);
query.setPageSize(512);
SqlQuery sqlQuery = new SqlQuery<AffinityKey, XObject>(XObject.class,
"sequence > 1");
sqlQuery.setLocal(true);
sqlQuery.setPageSize(512);
query.setInitialQuery(sqlQuery);
query.setLocalListener(new CacheEntryUpdatedListener<AffinityKey, XObject>()
{
@Override
public void onUpdated(Iterable<CacheEntryEvent<? extends AffinityKey, ?
extends XObject>> events) {
for (CacheEntryEvent<? extends AffinityKey, ? extends XObject> entry :
events) {
Long key = (Long)entry.getKey().key();
int part = (int)entry.getKey().affinityKey();
XObject wrap = entry.getValue();
// put data for other source
}
}
}
QueryCursor<Cache.Entry<AffinityKey, XObject>> cur = cache.query(query);
for (Cache.Entry<AffinityKey, XObject> entry : cur) {
Long key = (Long) entry.getKey().key();
int part = (int)entry.getKey().affinityKey();
XObject wrap = entry.getValue();
// put data for other source
}
--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/remove-cache-on-high-speed-tp2039p2055.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.
Re: remove cache on high-speed
Posted by Denis Magda <dm...@gridgain.com>.
Please make sure that "cache.size(CachePeek.ALL)" returns 0 when you
consider that the cache is empty.
I have a feeling that your logic has not removed something. Use
"cache.iterator()" to find the entries that are not removed.
BTW, there is no need to call "cache.remove()" and "cache.clear()" right
after that. Just use one method.
--
Denis
On 11/24/2015 10:34 AM, wychoi wrote:
> hi
> ongoing stop/start of some server node after the whole cache clearing
> All caches have been removed. (cache -scan -c=CACHE_NAME) : confirm empty
>
> But remain few cache in cacheMetricsMxBean of visualvm
>
> Then i see that some entities got resurrected
>
> this is code snipet
>
> public boolean remove(String cacheName, Long key, Integer part) throws
> IgniteException {
>
> Ignite ignite = Ignition.ignite();
>
> AffinityKey affKey = new AffinityKey(key, part);
>
> IgniteCache<AffinityKey, XObject> cache = ignite.cache(cacheName);
>
> result = cache.remove(affKey);
>
> cache.clear(affKey);
>
> return result;
> }
>
>
>
> --
> View this message in context: http://apache-ignite-users.70518.x6.nabble.com/remove-cache-on-high-speed-tp2039p2044.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
Re: remove cache on high-speed
Posted by wychoi <wy...@bistel.co.kr>.
hi
ongoing stop/start of some server node after the whole cache clearing
All caches have been removed. (cache -scan -c=CACHE_NAME) : confirm empty
But remain few cache in cacheMetricsMxBean of visualvm
Then i see that some entities got resurrected
this is code snipet
public boolean remove(String cacheName, Long key, Integer part) throws
IgniteException {
Ignite ignite = Ignition.ignite();
AffinityKey affKey = new AffinityKey(key, part);
IgniteCache<AffinityKey, XObject> cache = ignite.cache(cacheName);
result = cache.remove(affKey);
cache.clear(affKey);
return result;
}
--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/remove-cache-on-high-speed-tp2039p2044.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.
Re: remove cache on high-speed
Posted by Denis Magda <dm...@gridgain.com>.
Hi,
Do you mean that after the whole cache clearing (no entities left at
all) and ongoing restart of some server node you see that some entities
got resurrected?
If this is your case then please provide us with a reproducible example.
Regards,
Denis
On 11/24/2015 6:02 AM, wychoi wrote:
> CacheConfiguration<AffinityKey, XObject> cfg = new
> CacheConfiguration<>("CACHE_NAME");
> cfg.setIndexedTypes(AffinityKey.class, XObject.class);
> cfg.setCacheMode(CacheMode.PARTITIONED);
> cfg.setName("CACHE_NAME");
> cfg5.setBackups(1);
>
> ignite.getOrCreateCache(cfg);
>
>
> 1. i used the above cache Configuration .
> 2. put message of 50,000 counts in cache.
> 3. remove cache 300 counts per one second
> 4. All caches have been controlled. (cache -scan -c=CACHE_NAME) : confirm
> empty
> 5. However, if we stop and restart the server node after
> 6. Some of the cache survives again.
>
>
> in conclusion , Perhaps it is estimated that the remote node's cache cleanup
> unsafe.
>
>
>
> --
> View this message in context: http://apache-ignite-users.70518.x6.nabble.com/remove-cache-on-high-speed-tp2039p2042.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
Re: remove cache on high-speed
Posted by wychoi <wy...@bistel.co.kr>.
CacheConfiguration<AffinityKey, XObject> cfg = new
CacheConfiguration<>("CACHE_NAME");
cfg.setIndexedTypes(AffinityKey.class, XObject.class);
cfg.setCacheMode(CacheMode.PARTITIONED);
cfg.setName("CACHE_NAME");
cfg5.setBackups(1);
ignite.getOrCreateCache(cfg);
1. i used the above cache Configuration .
2. put message of 50,000 counts in cache.
3. remove cache 300 counts per one second
4. All caches have been controlled. (cache -scan -c=CACHE_NAME) : confirm
empty
5. However, if we stop and restart the server node after
6. Some of the cache survives again.
in conclusion , Perhaps it is estimated that the remote node's cache cleanup
unsafe.
--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/remove-cache-on-high-speed-tp2039p2042.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.