cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r798979 - in /incubator/cassandra/trunk/src/java/org/apache/cassandra: cql/compiler/sem/ cql/driver/ db/ dht/ io/ net/ net/io/ service/ utils/
Date Wed, 29 Jul 2009 17:00:19 GMT
Author: jbellis
Date: Wed Jul 29 17:00:18 2009
New Revision: 798979

URL: http://svn.apache.org/viewvc?rev=798979&view=rev
Log:
add more if-isDebugEnabled lines to reduce overhead when logging at INFO or higher.  patch
by Michael Greene; reviewed by jbellis for CASSANDRA-174

Modified:
    incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/compiler/sem/SemanticPhase.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/driver/CqlDriver.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/BinaryVerbHandler.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/LoadVerbHandler.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ReadRepairVerbHandler.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Table.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/dht/BootStrapper.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/dht/BootstrapMetadataVerbHandler.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/dht/LeaveJoinProtocolImpl.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/io/SSTableReader.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/net/MessagingService.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/net/TcpConnection.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/net/io/ContentStreamState.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/service/CassandraDaemon.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/service/CassandraServer.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/service/WriteResponseResolver.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/FBUtilities.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/GuidGenerator.java

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/compiler/sem/SemanticPhase.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/compiler/sem/SemanticPhase.java?rev=798979&r1=798978&r2=798979&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/compiler/sem/SemanticPhase.java
(original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/compiler/sem/SemanticPhase.java
Wed Jul 29 17:00:18 2009
@@ -64,7 +64,8 @@
     {
         Plan plan = null;
 
-        logger_.debug("AST: " + ast.toStringTree());
+        if (logger_.isDebugEnabled())
+            logger_.debug("AST: " + ast.toStringTree());
 
         switch (ast.getType())
         {

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/driver/CqlDriver.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/driver/CqlDriver.java?rev=798979&r1=798978&r2=798979&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/driver/CqlDriver.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/cql/driver/CqlDriver.java Wed
Jul 29 17:00:18 2009
@@ -37,11 +37,13 @@
 
         try
         {
-            logger_.debug("Compiling CQL query ...");
+            if (logger_.isDebugEnabled())
+                logger_.debug("Compiling CQL query ...");
             Plan plan = compiler.compileQuery(query);
             if (plan != null)
             {
-                logger_.debug("Executing CQL query ...");            
+                if (logger_.isDebugEnabled())
+                    logger_.debug("Executing CQL query ...");            
                 return plan.execute();
             }
         }

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/BinaryVerbHandler.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/BinaryVerbHandler.java?rev=798979&r1=798978&r2=798979&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/BinaryVerbHandler.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/BinaryVerbHandler.java Wed
Jul 29 17:00:18 2009
@@ -58,7 +58,8 @@
 	    }        
 	    catch ( Exception e )
 	    {
-	        logger_.debug(LogUtil.throwableToString(e));            
+	        if (logger_.isDebugEnabled())
+                logger_.debug(LogUtil.throwableToString(e));            
 	    }        
     }
 

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java?rev=798979&r1=798978&r2=798979&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamilyStore.java Wed
Jul 29 17:00:18 2009
@@ -1089,9 +1089,9 @@
         if (logger_.isDebugEnabled())
         {
             logger_.debug("Total time taken for range split   ..." + (System.currentTimeMillis()
- startTime));
-          logger_.debug("Total bytes Read for range split  ..." + totalBytesRead);
-        logger_.debug("Total bytes written for range split  ..."
-                      + totalBytesWritten + "   Total keys read ..." + totalkeysRead);
+            logger_.debug("Total bytes Read for range split  ..." + totalBytesRead);
+            logger_.debug("Total bytes written for range split  ..."
+                          + totalBytesWritten + "   Total keys read ..." + totalkeysRead);
         }
         return result;
     }

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/LoadVerbHandler.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/LoadVerbHandler.java?rev=798979&r1=798978&r2=798979&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/LoadVerbHandler.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/LoadVerbHandler.java Wed Jul
29 17:00:18 2009
@@ -58,11 +58,13 @@
                 sb.append(endPoint);
 				MessagingService.getMessagingInstance().sendOneWay(messageInternal, endPoint);
 			}
-            logger_.debug("Sent data to " + sb.toString());            
+            if (logger_.isDebugEnabled())
+                logger_.debug("Sent data to " + sb.toString());
         }        
         catch ( Exception e )
         {
-            logger_.debug(LogUtil.throwableToString(e));            
+            if (logger_.isDebugEnabled())
+                logger_.debug(LogUtil.throwableToString(e));            
         }        
     }
 

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ReadRepairVerbHandler.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ReadRepairVerbHandler.java?rev=798979&r1=798978&r2=798979&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ReadRepairVerbHandler.java
(original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ReadRepairVerbHandler.java
Wed Jul 29 17:00:18 2009
@@ -52,7 +52,8 @@
         }
         catch ( IOException e )
         {
-            logger_.debug(LogUtil.throwableToString(e));            
+            if (logger_.isDebugEnabled())
+                logger_.debug(LogUtil.throwableToString(e));            
         }        
     }
 }

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Table.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Table.java?rev=798979&r1=798978&r2=798979&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Table.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Table.java Wed Jul 29 17:00:18
2009
@@ -190,7 +190,7 @@
                 */                
                 SSTableReader sstable = SSTableReader.open(streamContext.getTargetFile());
                 if (logger_.isDebugEnabled())
-                logger_.debug("Merging the counting bloom filter in the sampler ...");  
             
+                  logger_.debug("Merging the counting bloom filter in the sampler ...");
               
                 String[] peices = FBUtilities.strip(fileName, "-");
                 Table.open(peices[0]).getColumnFamilyStore(peices[1]).addToList(sstable);
               
             }
@@ -248,7 +248,7 @@
                 StreamContextManager.registerStreamCompletionHandler(message.getFrom().getHost(),
new Table.BootstrapCompletionHandler());
                 /* Send a bootstrap initiation done message to execute on default stage.
*/
                 if (logger_.isDebugEnabled())
-                logger_.debug("Sending a bootstrap initiate done message ...");         
      
+                  logger_.debug("Sending a bootstrap initiate done message ...");
                 Message doneMessage = new Message( StorageService.getLocalStorageEndPoint(),
"", StorageService.bootStrapInitiateDoneVerbHandler_, new byte[0] );
                 MessagingService.getMessagingInstance().sendOneWay(doneMessage, message.getFrom());
             }

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/dht/BootStrapper.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/dht/BootStrapper.java?rev=798979&r1=798978&r2=798979&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/dht/BootStrapper.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/dht/BootStrapper.java Wed Jul
29 17:00:18 2009
@@ -65,7 +65,8 @@
     {
         try
         {
-            logger_.debug("Beginning bootstrap process for " + targets_ + " ...");      
                                                        
+            if (logger_.isDebugEnabled())
+              logger_.debug("Beginning bootstrap process for " + targets_ + " ...");    
                                                          
             /* copy the token to endpoint map */
             Map<Token, EndPoint> tokenToEndPointMap = tokenMetadata_.cloneTokenEndPointMap();
             /* remove the tokens associated with the endpoints being bootstrapped */    
           

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/dht/BootstrapMetadataVerbHandler.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/dht/BootstrapMetadataVerbHandler.java?rev=798979&r1=798978&r2=798979&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/dht/BootstrapMetadataVerbHandler.java
(original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/dht/BootstrapMetadataVerbHandler.java
Wed Jul 29 17:00:18 2009
@@ -61,7 +61,7 @@
             for ( BootstrapMetadata bsmd : bsMetadata )
             {
                 if (logger_.isDebugEnabled())
-                logger_.debug(bsmd.toString());                                      
+                  logger_.debug(bsmd.toString());                                      
             }
             
             for ( BootstrapMetadata bsmd : bsMetadata )
@@ -69,7 +69,7 @@
                 long startTime = System.currentTimeMillis();
                 doTransfer(bsmd.target_, bsmd.ranges_);     
                 if (logger_.isDebugEnabled())
-                logger_.debug("Time taken to boostrap " + 
+                  logger_.debug("Time taken to boostrap " + 
                         bsmd.target_ + 
                         " is " + 
                         (System.currentTimeMillis() - startTime) +
@@ -103,7 +103,7 @@
             sb.append(range.toString());
             sb.append(" ");            
             if (logger_.isDebugEnabled())
-            logger_.debug("Beginning transfer process to " + target + " for ranges " + sb.toString());
               
+              logger_.debug("Beginning transfer process to " + target + " for ranges " +
sb.toString());                
         }
       
         /*
@@ -166,7 +166,7 @@
               logger_.debug("Waiting for transfer to " + target + " to complete");
             StreamManager.instance(target).waitForStreamCompletion();
             if (logger_.isDebugEnabled())
-            logger_.debug("Done with transfer to " + target);  
+              logger_.debug("Done with transfer to " + target);  
         }
     }
 }

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/dht/LeaveJoinProtocolImpl.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/dht/LeaveJoinProtocolImpl.java?rev=798979&r1=798978&r2=798979&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/dht/LeaveJoinProtocolImpl.java
(original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/dht/LeaveJoinProtocolImpl.java
Wed Jul 29 17:00:18 2009
@@ -62,7 +62,8 @@
     {  
         try
         {
-            logger_.debug("Beginning leave/join process for ...");                      
                                        
+            if (logger_.isDebugEnabled())
+              logger_.debug("Beginning leave/join process for ...");                    
                                          
             /* copy the token to endpoint map */
             Map<Token, EndPoint> tokenToEndPointMap = tokenMetadata_.cloneTokenEndPointMap();
             /* copy the endpoint to token map */

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/io/SSTableReader.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/io/SSTableReader.java?rev=798979&r1=798978&r2=798979&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/io/SSTableReader.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/io/SSTableReader.java Wed Jul
29 17:00:18 2009
@@ -55,7 +55,8 @@
             assert sstable != null;
             int indexKeyCount = sstable.getIndexPositions().size();
             count = count + (indexKeyCount + 1) * INDEX_INTERVAL;
-            logger.debug("index size for bloom filter calc for file  : " + dataFileName +
"   : " + count);
+            if (logger.isDebugEnabled())
+                logger.debug("index size for bloom filter calc for file  : " + dataFileName
+ "   : " + count);
         }
 
         return count;
@@ -100,7 +101,8 @@
             {
                 sstable.keyCache = createKeyCache((int)((sstable.getIndexPositions().size()
+ 1) * INDEX_INTERVAL * cacheFraction));
             }
-            logger.debug("INDEX LOAD TIME for "  + dataFileName + ": " + (System.currentTimeMillis()
- start) + " ms.");
+            if (logger.isDebugEnabled())
+                logger.debug("INDEX LOAD TIME for "  + dataFileName + ": " + (System.currentTimeMillis()
- start) + " ms.");
 
             openedFiles.put(dataFileName, sstable);
         }

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/net/MessagingService.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/net/MessagingService.java?rev=798979&r1=798978&r2=798979&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/net/MessagingService.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/net/MessagingService.java Wed
Jul 29 17:00:18 2009
@@ -226,7 +226,8 @@
         }
         catch(Exception e)
         {
-            LogUtil.getLogger(MessagingService.class.getName()).debug(LogUtil.throwableToString(e));
+            if (logger_.isDebugEnabled())
+                logger_.debug(LogUtil.throwableToString(e));
         }
         return result;
     }

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/net/TcpConnection.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/net/TcpConnection.java?rev=798979&r1=798978&r2=798979&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/net/TcpConnection.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/net/TcpConnection.java Wed Jul
29 17:00:18 2009
@@ -236,7 +236,8 @@
                 
                 /* returns the number of bytes transferred from file to the socket */
                 long bytesTransferred = fc.transferTo(startPosition, limit, socketChannel_);
-                logger_.debug("Bytes transferred " + bytesTransferred);                
+                if (logger_.isDebugEnabled())
+                    logger_.debug("Bytes transferred " + bytesTransferred);             
  
                 bytesWritten += bytesTransferred;
                 startPosition += bytesTransferred; 
                 /*

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/net/io/ContentStreamState.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/net/io/ContentStreamState.java?rev=798979&r1=798978&r2=798979&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/net/io/ContentStreamState.java
(original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/net/io/ContentStreamState.java
Wed Jul 29 17:00:18 2009
@@ -90,7 +90,8 @@
             }
             if ( bytesRead_ == streamContext_.getExpectedBytes() )
             {       
-                logger_.debug("Removing stream context " + streamContext_);             
   
+                if (logger_.isDebugEnabled())
+                    logger_.debug("Removing stream context " + streamContext_);         
       
                 handleStreamCompletion(remoteHost);                              
                 bytesRead_ = 0L;
                 fc_.close();

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/service/CassandraDaemon.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/service/CassandraDaemon.java?rev=798979&r1=798978&r2=798979&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/service/CassandraDaemon.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/service/CassandraDaemon.java Wed
Jul 29 17:00:18 2009
@@ -84,7 +84,8 @@
         Set<String> tables = DatabaseDescriptor.getTableToColumnFamilyMap().keySet();
         for (String table : tables)
         {
-            logger.debug("opening table " + table);
+            if (logger.isDebugEnabled())
+                logger.debug("opening table " + table);
             Table tbl = Table.open(table);
             tbl.onStart();
         }

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/service/CassandraServer.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/service/CassandraServer.java?rev=798979&r1=798978&r2=798979&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/service/CassandraServer.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/service/CassandraServer.java Wed
Jul 29 17:00:18 2009
@@ -161,7 +161,8 @@
     public List<Column> get_slice_by_names(String table, String key, ColumnParent column_parent,
List<byte[]> column_names, int consistency_level)
     throws InvalidRequestException, NotFoundException
     {
-        logger.debug("get_slice_by_names");
+        if (logger.isDebugEnabled())
+            logger.debug("get_slice_by_names");
         ThriftValidation.validateColumnParent(table, column_parent);
         return getSlice(new SliceByNamesReadCommand(table, key, column_parent, column_names),
consistency_level);
     }
@@ -169,7 +170,8 @@
     public List<Column> get_slice(String table, String key, ColumnParent column_parent,
byte[] start, byte[] finish, boolean is_ascending, int count, int consistency_level)
     throws InvalidRequestException, NotFoundException
     {
-        logger.debug("get_slice_from");
+        if (logger.isDebugEnabled())
+            logger.debug("get_slice_from");
         ThriftValidation.validateColumnParent(table, column_parent);
         // TODO support get_slice on super CFs
         if (count <= 0)
@@ -181,7 +183,8 @@
     public Column get_column(String table, String key, ColumnPath column_path, int consistency_level)
     throws InvalidRequestException, NotFoundException
     {
-        logger.debug("get_column");
+        if (logger.isDebugEnabled())
+            logger.debug("get_column");
         ThriftValidation.validateColumnPath(table, column_path);
 
         QueryPath path = new QueryPath(column_path.column_family, column_path.super_column);
@@ -222,7 +225,8 @@
     public int get_column_count(String table, String key, ColumnParent column_parent, int
consistency_level)
     throws InvalidRequestException
     {
-        logger.debug("get_column_count");
+        if (logger.isDebugEnabled())
+            logger.debug("get_column_count");
         // validateColumnParent assumes we require simple columns; g_c_c is the only
         // one of the columnParent-taking apis that can also work at the SC level.
         // so we roll a one-off validator here.
@@ -261,7 +265,8 @@
     public void insert(String table, String key, ColumnPath column_path, byte[] value, long
timestamp, int consistency_level)
     throws InvalidRequestException, UnavailableException
     {
-        logger.debug("insert");
+        if (logger.isDebugEnabled())
+            logger.debug("insert");
         ThriftValidation.validateKey(key);
         ThriftValidation.validateColumnPath(table, column_path);
 
@@ -280,7 +285,8 @@
     public void batch_insert(String table, BatchMutation batch_mutation, int consistency_level)
     throws InvalidRequestException, UnavailableException
     {
-        logger.debug("batch_insert");
+        if (logger.isDebugEnabled())
+            logger.debug("batch_insert");
         RowMutation rm = RowMutation.getRowMutation(table, batch_mutation);
         Set<String> cfNames = rm.columnFamilyNames();
         ThriftValidation.validateKeyCommand(rm.key(), rm.table(), cfNames.toArray(new String[cfNames.size()]));
@@ -291,7 +297,8 @@
     public void remove(String table, String key, ColumnPathOrParent column_path_or_parent,
long timestamp, int consistency_level)
     throws InvalidRequestException, UnavailableException
     {
-        logger.debug("remove");
+        if (logger.isDebugEnabled())
+            logger.debug("remove");
         ThriftValidation.validateColumnPathOrParent(table, column_path_or_parent);
         
         RowMutation rm = new RowMutation(table, key.trim());
@@ -315,7 +322,8 @@
     public List<SuperColumn> get_slice_super_by_names(String table, String key, String
column_family, List<byte[]> super_column_names, int consistency_level)
     throws InvalidRequestException
     {
-        logger.debug("get_slice_super_by_names");
+        if (logger.isDebugEnabled())
+            logger.debug("get_slice_super_by_names");
         ThriftValidation.validateColumnFamily(table, column_family);
 
         ColumnFamily cfamily = readColumnFamily(new SliceByNamesReadCommand(table, key, new
QueryPath(column_family), super_column_names), consistency_level);
@@ -358,7 +366,8 @@
     public List<SuperColumn> get_slice_super(String table, String key, String column_family,
byte[] start, byte[] finish, boolean is_ascending, int count, int consistency_level)
     throws InvalidRequestException
     {
-        logger.debug("get_slice_super");
+        if (logger.isDebugEnabled())
+            logger.debug("get_slice_super");
         if (!DatabaseDescriptor.getColumnFamilyType(table, column_family).equals("Super"))
             throw new InvalidRequestException("get_slice_super requires a super CF name");
         if (count <= 0)
@@ -377,7 +386,8 @@
     public SuperColumn get_super_column(String table, String key, SuperColumnPath super_column_path,
int consistency_level)
     throws InvalidRequestException, NotFoundException
     {
-        logger.debug("get_superColumn");
+        if (logger.isDebugEnabled())
+            logger.debug("get_superColumn");
         ThriftValidation.validateSuperColumnPath(table, super_column_path);
 
         ColumnFamily cfamily = readColumnFamily(new SliceByNamesReadCommand(table, key, new
QueryPath(super_column_path.column_family), Arrays.asList(super_column_path.super_column)),
consistency_level);
@@ -404,7 +414,8 @@
     public void batch_insert_super_column(String table, BatchMutationSuper batch_mutation_super,
int consistency_level)
     throws InvalidRequestException, UnavailableException
     {
-        logger.debug("batch_insert_SuperColumn");
+        if (logger.isDebugEnabled())
+            logger.debug("batch_insert_SuperColumn");
         RowMutation rm = RowMutation.getRowMutation(table, batch_mutation_super);
         Set<String> cfNames = rm.columnFamilyNames();
         ThriftValidation.validateKeyCommand(rm.key(), rm.table(), cfNames.toArray(new String[cfNames.size()]));
@@ -519,7 +530,8 @@
 
     public List<String> get_key_range(String tablename, String columnFamily, String
startWith, String stopAt, int maxResults) throws InvalidRequestException, TException
     {
-        logger.debug("get_key_range");
+        if (logger.isDebugEnabled())
+            logger.debug("get_key_range");
         ThriftValidation.validateCommand(tablename, columnFamily);
         if (!(StorageService.getPartitioner() instanceof OrderPreservingPartitioner))
         {

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java?rev=798979&r1=798978&r2=798979&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageProxy.java Wed
Jul 29 17:00:18 2009
@@ -187,7 +187,8 @@
                 throw new UnsupportedOperationException("invalid consistency level " + consistency_level);
             }
             QuorumResponseHandler<Boolean> quorumResponseHandler = new QuorumResponseHandler<Boolean>(blockFor,
new WriteResponseResolver());
-            logger.debug("insertBlocking writing key " + rm.key() + " to " + message.getMessageId()
+ "@[" + StringUtils.join(endpoints, ", ") + "]");
+            if (logger.isDebugEnabled())
+                logger.debug("insertBlocking writing key " + rm.key() + " to " + message.getMessageId()
+ "@[" + StringUtils.join(endpoints, ", ") + "]");
 
             MessagingService.getMessagingInstance().sendRR(message, endpoints, quorumResponseHandler);
             if (!quorumResponseHandler.get())
@@ -281,7 +282,8 @@
         EndPoint endPoint = StorageService.instance().findSuitableEndPoint(command.key);
         assert endPoint != null;
         Message message = command.makeReadMessage();
-        logger.debug("weakreadremote reading " + command + " from " + message.getMessageId()
+ "@" + endPoint);
+        if (logger.isDebugEnabled())
+            logger.debug("weakreadremote reading " + command + " from " + message.getMessageId()
+ "@" + endPoint);
         message.addHeader(ReadCommand.DO_REPAIR, ReadCommand.DO_REPAIR.getBytes());
         IAsyncResult iar = MessagingService.getMessagingInstance().sendRR(message, endPoint);
         byte[] body;
@@ -424,13 +426,15 @@
         */
         endPoints[0] = dataPoint;
         messages[0] = message;
-        logger.debug("strongread reading data for " + command + " from " + message.getMessageId()
+ "@" + dataPoint);
+        if (logger.isDebugEnabled())
+            logger.debug("strongread reading data for " + command + " from " + message.getMessageId()
+ "@" + dataPoint);
         for (int i = 1; i < endPoints.length; i++)
         {
             EndPoint digestPoint = endpointList.get(i - 1);
             endPoints[i] = digestPoint;
             messages[i] = messageDigestOnly;
-            logger.debug("strongread reading digest for " + command + " from " + messageDigestOnly.getMessageId()
+ "@" + digestPoint);
+            if (logger.isDebugEnabled())
+                logger.debug("strongread reading digest for " + command + " from " + messageDigestOnly.getMessageId()
+ "@" + digestPoint);
         }
 
         try
@@ -439,7 +443,8 @@
 
             long startTime2 = System.currentTimeMillis();
             row = quorumResponseHandler.get();
-            logger.debug("quorumResponseHandler: " + (System.currentTimeMillis() - startTime2)
+ " ms.");
+            if (logger.isDebugEnabled())
+                logger.debug("quorumResponseHandler: " + (System.currentTimeMillis() - startTime2)
+ " ms.");
         }
         catch (DigestMismatchException ex)
         {
@@ -607,7 +612,8 @@
     */
     private static Row weakReadLocal(ReadCommand command) throws IOException
     {
-        logger.debug("weakreadlocal reading " + command);
+        if (logger.isDebugEnabled())
+            logger.debug("weakreadlocal reading " + command);
         List<EndPoint> endpoints = StorageService.instance().getNLiveStorageEndPoint(command.key);
         /* Remove the local storage endpoint from the list. */
         endpoints.remove(StorageService.getLocalStorageEndPoint());

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java?rev=798979&r1=798978&r2=798979&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/service/StorageService.java Wed
Jul 29 17:00:18 2009
@@ -705,16 +705,16 @@
                 String tableName = tableDir.getName();
 
                 for (File file : tableDir.listFiles())
-        {
+                {
                     streamContexts.add(new StreamContextManager.StreamContext(file.getAbsolutePath(),
file.length(), tableName));
-            if (logger_.isDebugEnabled())
+                    if (logger_.isDebugEnabled())
                       logger_.debug("Stream context metadata " + streamContexts);
                 }
             }
         }
         
         if ( streamContexts.size() > 0 )
-    {
+        {
             EndPoint target = new EndPoint(host, DatabaseDescriptor.getStoragePort());
             /* Set up the stream manager with the files that need to streamed */
             StreamManager.instance(target).addFilesToStream((StreamContextManager.StreamContext[])
streamContexts.toArray());
@@ -728,14 +728,14 @@
               logger_.debug("Waiting for transfer to " + target + " to complete");
             StreamManager.instance(target).waitForStreamCompletion();
             if (logger_.isDebugEnabled())
-            logger_.debug("Done with transfer to " + target);  
+              logger_.debug("Done with transfer to " + target);  
         }
     }
 
     /**
      * Takes the snapshot for a given table.
      * 
-     * @param table the name of the table.
+     * @param tableName the name of the table.
      * @param tag   the tag given to the snapshot (null is permissible)
      */
     public void takeSnapshot(String tableName, String tag) throws IOException

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/service/WriteResponseResolver.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/service/WriteResponseResolver.java?rev=798979&r1=798978&r2=798979&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/service/WriteResponseResolver.java
(original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/service/WriteResponseResolver.java
Wed Jul 29 17:00:18 2009
@@ -60,7 +60,8 @@
             }
             boolean result = writeResponseMessage.isSuccess();
             if (!result) {
-				logger_.debug("Write at " + response.getFrom()
+				if (logger_.isDebugEnabled())
+                    logger_.debug("Write at " + response.getFrom()
 						+ " may have failed for the key " + writeResponseMessage.key());
 			}
 			returnValue |= result;

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/FBUtilities.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/FBUtilities.java?rev=798979&r1=798978&r2=798979&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/FBUtilities.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/FBUtilities.java Wed Jul
29 17:00:18 2009
@@ -253,7 +253,8 @@
     	}
     	catch (Exception e)
         {
-    		LogUtil.getLogger(FBUtilities.class.getName()).debug(LogUtil.throwableToString(e));
+    		if (logger_.isDebugEnabled())
+                logger_.debug(LogUtil.throwableToString(e));
     	}
     	return result;
 	}

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/GuidGenerator.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/GuidGenerator.java?rev=798979&r1=798978&r2=798979&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/GuidGenerator.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/utils/GuidGenerator.java Wed Jul
29 17:00:18 2009
@@ -18,6 +18,8 @@
 
 package org.apache.cassandra.utils;
 
+import org.apache.log4j.Logger;
+
 import java.util.*;
 import java.net.*;
 import java.security.*;
@@ -26,6 +28,7 @@
  */
 
 public class GuidGenerator {
+    private static Logger logger_ = Logger.getLogger(GuidGenerator.class);
     private static Random myRand;
     private static SecureRandom mySecureRand;
     private static String s_id;
@@ -42,7 +45,8 @@
             s_id = InetAddress.getLocalHost().toString();
         }
         catch (UnknownHostException e) {
-            LogUtil.getLogger(GuidGenerator.class.getName()).debug(LogUtil.throwableToString(e));
+            if (logger_.isDebugEnabled())
+                logger_.debug(LogUtil.throwableToString(e));
         }
 
         try {
@@ -50,7 +54,8 @@
             md5 = new SafeMessageDigest(myMd5);
         }
         catch (NoSuchAlgorithmException e) {
-            LogUtil.getLogger(GuidGenerator.class.getName()).debug(LogUtil.throwableToString(e));
+            if (logger_.isDebugEnabled())
+                logger_.debug(LogUtil.throwableToString(e));
         }
     }
 



Mime
View raw message