You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2013/04/07 16:53:49 UTC

svn commit: r1465405 - /activemq/activemq-apollo/trunk/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/LevelDBClient.scala

Author: chirino
Date: Sun Apr  7 14:53:49 2013
New Revision: 1465405

URL: http://svn.apache.org/r1465405
Log:
Potential fix for APLO-293: Since the CURRENT and MANIFEST files might not be append only doing a hard link was not right since they might get updated via the hardlink after the snapshot occurs.

Modified:
    activemq/activemq-apollo/trunk/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/LevelDBClient.scala

Modified: activemq/activemq-apollo/trunk/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/LevelDBClient.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/LevelDBClient.scala?rev=1465405&r1=1465404&r2=1465405&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/LevelDBClient.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/LevelDBClient.scala Sun Apr  7 14:53:49 2013
@@ -682,10 +682,16 @@ class LevelDBClient(store: LevelDBStore)
 
     try {
 
-      // Hard link all the index files.
-      dirty_index_file.list_files.foreach {
-        file =>
-          link(file, tmp_dir / file.getName)
+      // Copy/Hard link all the index files.
+      for( file <- dirty_index_file.list_files ) {
+        val name: String = file.getName
+        if( name == "CURRENT" || name.startsWith("MANIFEST-") ) {
+          /// These might not be append only files, so avoid hard linking just to be safe.
+          copyLinkStrategy(file, tmp_dir / name)
+        } else {
+          // These are append only files, safe to hard line.
+          link(file, tmp_dir / name)
+        }
       }
 
       // Rename to signal that the snapshot is complete.