You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Shashank Gupta (JIRA)" <ji...@apache.org> on 2013/04/09 12:12:15 UTC
[jira] [Created] (JCR-3563) Shared File DataStore: Potential data
loss risk in FileDataStore's GC
Shashank Gupta created JCR-3563:
-----------------------------------
Summary: Shared File DataStore: Potential data loss risk in FileDataStore's GC
Key: JCR-3563
URL: https://issues.apache.org/jira/browse/JCR-3563
Project: Jackrabbit Content Repository
Issue Type: Bug
Components: jackrabbit-core
Affects Versions: 2.6
Reporter: Shashank Gupta
To preserve disk space in your environment is to share the CRX datastore directory over a network share between multiple (non -clustered) installations of CRX.[1]. [1] also mentions the procedure to run GC for these farm installations.
FileDataStore#deleteOlderRecursive(File file, long min) [2] has potential data loss risk if 2nd installation(other than on which [2] is running) add files between (A) and (B) mentioned below
[1]http://helpx.adobe.com/crx/kb/HowToCombineTheDatastoreToPreserveDiskSpace.html
[2]
private int deleteOlderRecursive(File file, long min) {
int count = 0;
if (file.isFile() && file.exists() && file.canWrite()) {
synchronized (this) {
long lastModified;
try {
(A) lastModified = getLastModified(file);
} catch (DataStoreException e) {
log.warn("Failed to read modification date; file not deleted", e);
// don't delete the file, since the lastModified date is uncertain
lastModified = min;
}
(B) if (lastModified < min) {
DataIdentifier id = new DataIdentifier(file.getName());
if (!inUse.containsKey(id)) {
if (log.isInfoEnabled()) {
log.info("Deleting old file " + file.getAbsolutePath() +
" modified: " + new Timestamp(lastModified).toString() +
" length: " + file.length());
}
if (!file.delete()) {
log.warn("Failed to delete old file " + file.getAbsolutePath());
}
count++;
}
}
}
} else if (file.isDirectory()) {
File[] list = file.listFiles();
if (list != null) {
for (File f: list) {
count += deleteOlderRecursive(f, min);
}
}
// JCR-1396: FileDataStore Garbage Collector and empty directories
// Automatic removal of empty directories (but not the root!)
synchronized (this) {
if (file != directory) {
list = file.listFiles();
if (list != null && list.length == 0) {
file.delete();
}
}
}
}
return count;
}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira