-
1. Re: Falg to purge cacheloader data upon restart
manik May 30, 2006 10:50 AM (in response to ben.wang)And an added purge() method on the cache loader interface? Or a simple call to remove("/"), I suppose...
-
2. Re: Falg to purge cacheloader data upon restart
belaban May 30, 2006 1:17 PM (in response to ben.wang)why doesn't remove("/") work here ?
-
3. Re: Falg to purge cacheloader data upon restart
manik May 30, 2006 1:46 PM (in response to ben.wang)remove("/") would work. Just thinking long and hard about adding a purgeOnStartup option, which does beat the whole purpose of a cache loader. I guess it is needed in the described use case though.
-
4. Re: Falg to purge cacheloader data upon restart
brian.stansberry May 30, 2006 2:21 PM (in response to ben.wang)If the use case is to "purge older than X on startup", then doesn't a new method require specifiying X? And cache loaders would have to timestamp their data?
-
5. Re: Falg to purge cacheloader data upon restart
manik May 30, 2006 2:39 PM (in response to ben.wang)Is it that (which will be much more complex) or to bring down a node in the cluster, set the flag to true, and bring it back up again to wipe all old data? And then change the flag to true to restore normal behaviour?
-
6. Re: Flag to purge cacheloader data upon restart
manik May 30, 2006 2:48 PM (in response to ben.wang)I have a preliminary (and very simplistic) impl of this in place - see if it works for you.
<!-- we can now have multiple cache loaders, which get chained --> <cacheloader> <class>org.jboss.cache.loader.FileCacheLoader</class> <!-- same as the old CacheLoaderConfig attribute --> <properties> location=/tmp/node1 </properties> <!-- whether the cache loader writes are asynchronous --> <async>false</async> <!-- only one cache loader in the chain may set fetchPersistentState to true. An exception is thrown if more than one cache loader sets this to true. --> <fetchPersistentState>true</fetchPersistentState> <!-- determines whether this cache loader ignores writes - defaults to false. --> <ignoreModifications>false</ignoreModifications> <!-- if set to true, purges the contents of this cache loader when the cache starts up. Defaults to false. --> <purgeOnStartup>false</purgeOnStartup> </cacheloader>
-
7. Re: Flag to purge cacheloader data upon restart
galder.zamarreno May 30, 2006 3:41 PM (in response to ben.wang)This would be quite useful as an JMX operation, but having it configurable
could be a bit risky. People could use it once and then forget to to switch it
back off and then reporting that no data is persisted.
Besides, they would have to stop Cache, execute it with purge on, stop it
again, and then, change configuration back again and restart it. -
8. Re: Flag to purge cacheloader data upon restart
brian.stansberry May 30, 2006 3:55 PM (in response to ben.wang)Yes, that's why I think that to be useful the value of this flag needs to be a maxAge rather than a boolean.
-
9. Re: Flag to purge cacheloader data upon restart
ben.wang May 30, 2006 11:34 PM (in response to ben.wang)I will try it out!
Ideally, a maxAge setting is the best way to go. You only purge items that are older than X. But this adds complexity becuase of additional timestamp. So the next best thing is then to do it manually. -
10. Re: Flag to purge cacheloader data upon restart
manik May 31, 2006 3:51 AM (in response to ben.wang)I actually do like Galder's suggestion about making this a JMX operation though - being able to purge the cache loader
a) without the need to restart the app server
b) without risk of forgetting to switch this off
c) cleaner cache loader configuration
Would an approach like this work for the use case? -
11. Re: Flag to purge cacheloader data upon restart
ben.wang May 31, 2006 4:28 AM (in response to ben.wang)If it is easier to implement, yes, it will work.
-
12. Re: Flag to purge cacheloader data upon restart
manik May 31, 2006 4:38 AM (in response to ben.wang)It is not necessarily easier to implement (given that the alternative is already implemented), but just a cleaner mechanism. Saves a server restart too.
Thoughts? -
13. Re: Flag to purge cacheloader data upon restart
manik May 31, 2006 9:03 AM (in response to ben.wang)Ok, HEAD now has an MBean operation to purge the cache loaders. The config file option still is there as well. Both methods for purging the cache loaders will be there in 1.4.0.BETA2.
We'll look at pulling one of these out before releasing a CR. -
14. Re: Flag to purge cacheloader data upon restart
belaban Jun 1, 2006 3:53 AM (in response to ben.wang)Maybe I'm a bit slow, but I don't get the use case. Why do you want to purge at startup ?
Anyway: +1 on making this a JMX op, -1 on adding yet another attribute.