jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shashank Gupta (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (JCR-3563) Shared File DataStore: Potential data loss risk in FileDataStore's GC
Date Thu, 11 Apr 2013 03:41:15 GMT

     [ https://issues.apache.org/jira/browse/JCR-3563?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Shashank Gupta updated JCR-3563:
--------------------------------

    Description: 
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] 
{code}
 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;
    }
{code}

  was:
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;
    }

    
> 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] 
> {code}
>  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;
>     }
> {code}

--
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

Mime
View raw message