Updated Branches:
  refs/heads/trunk f3b1a2cbc -> 22be25b89

initialize memoryAllocator in client mode as well
patch by yukim; reviewed by jbellis for CASSANDRA-5542


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/22be25b8
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/22be25b8
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/22be25b8

Branch: refs/heads/trunk
Commit: 22be25b89c22f3a77a73b20ce1b819b257914d20
Parents: f3b1a2c
Author: Jonathan Ellis <[email protected]>
Authored: Wed May 29 15:13:21 2013 -0500
Committer: Jonathan Ellis <[email protected]>
Committed: Wed May 29 15:13:21 2013 -0500

----------------------------------------------------------------------
 .../cassandra/config/DatabaseDescriptor.java       |   36 ++++++++-------
 1 files changed, 19 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/22be25b8/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java 
b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
index 7a13d13..4d6abae 100644
--- a/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
+++ b/src/java/org/apache/cassandra/config/DatabaseDescriptor.java
@@ -88,29 +88,31 @@ public class DatabaseDescriptor
         // In client mode, we use a default configuration. Note that the 
fields of this class will be
         // left unconfigured however (the partitioner or localDC will be null 
for instance) so this
         // should be used with care.
-        if (Config.isClientMode())
-        {
-            conf = new Config();
-        }
-        else
+        try
         {
-            try
+            if (Config.isClientMode())
             {
-                applyConfig(loadConfig());
-            }
-            catch (ConfigurationException e)
-            {
-                logger.error("Fatal configuration error", e);
-                System.err.println(e.getMessage() + "\nFatal configuration 
error; unable to start server. See log for stacktrace.");
-                System.exit(1);
+                conf = new Config();
+                // at least we have to set memoryAllocator to open SSTable in 
client mode
+                memoryAllocator = 
FBUtilities.newOffHeapAllocator(conf.memory_allocator);
             }
-            catch (Exception e)
+            else
             {
-                logger.error("Fatal error during configuration loading", e);
-                System.err.println(e.getMessage() + "\nFatal error during 
configuration loading; unable to start server. See log for stacktrace.");
-                System.exit(1);
+                applyConfig(loadConfig());
             }
         }
+        catch (ConfigurationException e)
+        {
+            logger.error("Fatal configuration error", e);
+            System.err.println(e.getMessage() + "\nFatal configuration error; 
unable to start. See log for stacktrace.");
+            System.exit(1);
+        }
+        catch (Exception e)
+        {
+            logger.error("Fatal error during configuration loading", e);
+            System.err.println(e.getMessage() + "\nFatal error during 
configuration loading; unable to start. See log for stacktrace.");
+            System.exit(1);
+        }
     }
 
     @VisibleForTesting

Reply via email to