
|
If you were logged in you would be able to see more operations.
|
|
|
|
Environment:
|
Win2K server, JRE 1.4.2_08
|
|
|
removeEntry() mehod is unable to delete disk cached file if cache is in full capacity and cache.persistence.overflow.only = true
The problem is from the following code in AbstractConcurrentReadCache, line 1734:
if (overflowPersistence && ((size() + 1) >= maxEntries)) {
persistStore(key, oldValue);
The problem in the code is that if your cache is reached the capacity, more items will overflow to disk, which is correct, but as long as the cache is in this full capacity state, you could never delete the file with flushEnty/removeEntry methods, the file is actually deleted and then re-created due to the above two lines of code.
This behavior is the same in version 2.1 and version 2.2.
Here is the properties of cache in the test:
cache.capacity=4
cache.unlimited.disk=true
cache.persistence.overflow.only=true
cache.persistence.class=com.opensymphony.oscache.plugins.diskpersistence.Ha shDiskPersistenceListener
cache.path=C:\\temp
cache.blocking=true
cache.memory=true
In the test, create 6 cache entires, loop them one by one, so that all 6 will saved to disk.
Then for a specific entry (say entry 2) call method flushEntry then removeEntry, the file is not deleted.
The following patch could fix this particular problem, but may need to test against other cases:
if (overflowPersistence && ((size() + 1) >= maxEntries)
&&
!((CacheEntry)oldValue).needsRefresh(CacheEntry.INDEFINITE_EXPIRY))
{
persistStore(key, oldValue);
}
|
|
Description
|
removeEntry() mehod is unable to delete disk cached file if cache is in full capacity and cache.persistence.overflow.only = true
The problem is from the following code in AbstractConcurrentReadCache, line 1734:
if (overflowPersistence && ((size() + 1) >= maxEntries)) {
persistStore(key, oldValue);
The problem in the code is that if your cache is reached the capacity, more items will overflow to disk, which is correct, but as long as the cache is in this full capacity state, you could never delete the file with flushEnty/removeEntry methods, the file is actually deleted and then re-created due to the above two lines of code.
This behavior is the same in version 2.1 and version 2.2.
Here is the properties of cache in the test:
cache.capacity=4
cache.unlimited.disk=true
cache.persistence.overflow.only=true
cache.persistence.class=com.opensymphony.oscache.plugins.diskpersistence.Ha shDiskPersistenceListener
cache.path=C:\\temp
cache.blocking=true
cache.memory=true
In the test, create 6 cache entires, loop them one by one, so that all 6 will saved to disk.
Then for a specific entry (say entry 2) call method flushEntry then removeEntry, the file is not deleted.
The following patch could fix this particular problem, but may need to test against other cases:
if (overflowPersistence && ((size() + 1) >= maxEntries)
&&
!((CacheEntry)oldValue).needsRefresh(CacheEntry.INDEFINITE_EXPIRY))
{
persistStore(key, oldValue);
}
|
Show » |
made changes - 18/Feb/06 06:31 AM
| Field |
Original Value |
New Value |
|
Assignee
|
|
Andres March
[ dres1011
]
|
|