cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1040186 - in /cassandra/branches/cassandra-0.7: ./ src/java/org/apache/cassandra/cli/ src/java/org/apache/cassandra/streaming/ src/java/org/apache/cassandra/tools/
Date Mon, 29 Nov 2010 16:50:03 GMT
Author: jbellis
Date: Mon Nov 29 16:50:03 2010
New Revision: 1040186

URL: http://svn.apache.org/viewvc?rev=1040186&view=rev
Log:
use cross-platform newlines
patch by Dave Brosius; reviewed by jbellis for CASSANDRA-1786

Modified:
    cassandra/branches/cassandra-0.7/CHANGES.txt
    cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/cli/CliClient.java
    cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/cli/CliUserHelp.java
    cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/streaming/StreamingService.java
    cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/tools/NodeCmd.java

Modified: cassandra/branches/cassandra-0.7/CHANGES.txt
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/CHANGES.txt?rev=1040186&r1=1040185&r2=1040186&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/CHANGES.txt (original)
+++ cassandra/branches/cassandra-0.7/CHANGES.txt Mon Nov 29 16:50:03 2010
@@ -16,6 +16,7 @@ dev
  * use local classloader to check for version.properties (CASSANDRA-1778)
  * Validate that column names in column_metadata are valid for the
    defined comparator, and decode properly in cli (CASSANDRA-1773)
+ * use cross-platform newlines in cli (CASSANDRA-1786)
 
 
 0.7.0-rc1

Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/cli/CliClient.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/cli/CliClient.java?rev=1040186&r1=1040185&r2=1040186&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/cli/CliClient.java (original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/cli/CliClient.java Mon
Nov 29 16:50:03 2010
@@ -241,7 +241,7 @@ public class CliClient extends CliUserHe
         SlicePredicate predicate = new SlicePredicate().setColumn_names(null).setSlice_range(range);
 
         int count = thriftClient.get_count(ByteBuffer.wrap(key.getBytes(Charsets.UTF_8)),
colParent, predicate, ConsistencyLevel.ONE);
-        sessionState.out.printf("%d columns\n", count);
+        sessionState.out.printf("%d columns%n", count);
     }
     
     private void executeDelete(Tree statement) 
@@ -319,7 +319,7 @@ public class CliClient extends CliUserHe
                 for (Column col : superColumn.getColumns())
                 {
                     validator = getValidatorForValue(cfDef, col.getName());
-                    sessionState.out.printf("\n     (column=%s, value=%s, timestamp=%d)",
formatSubcolumnName(keyspace, columnFamily, col),
+                    sessionState.out.printf("%n     (column=%s, value=%s, timestamp=%d)",
formatSubcolumnName(keyspace, columnFamily, col),
                                     validator.getString(col.value), col.timestamp);
                 }
                 
@@ -329,7 +329,7 @@ public class CliClient extends CliUserHe
             {
                 Column column = cosc.column;
                 validator = getValidatorForValue(cfDef, column.getName());
-                sessionState.out.printf("=> (column=%s, value=%s, timestamp=%d)\n", formatColumnName(keyspace,
columnFamily, column),
+                sessionState.out.printf("=> (column=%s, value=%s, timestamp=%d)%n", formatColumnName(keyspace,
columnFamily, column),
                                 validator.getString(column.value), column.timestamp);
             }
         }
@@ -453,7 +453,7 @@ public class CliClient extends CliUserHe
         }
 
         // print results
-        sessionState.out.printf("=> (column=%s, value=%s, timestamp=%d)\n",
+        sessionState.out.printf("=> (column=%s, value=%s, timestamp=%d)%n",
                                 formatColumnName(keySpace, columnFamily, column), valueAsString,
column.timestamp);
     }
 
@@ -1203,21 +1203,21 @@ public class CliClient extends CliUserHe
             for (CfDef cf_def : ks_def.cf_defs)
             {
                 isSuper = cf_def.column_type.equals("Super");
-                sessionState.out.printf("    ColumnFamily: %s%s\n", cf_def.name, isSuper
? " (Super)" : "");
+                sessionState.out.printf("    ColumnFamily: %s%s%n", cf_def.name, isSuper
? " (Super)" : "");
 
                 if (cf_def.comment != null && !cf_def.comment.isEmpty())
                 {
-                    sessionState.out.printf("    \"%s\"\n", cf_def.comment);
+                    sessionState.out.printf("    \"%s\"%n", cf_def.comment);
                 }
                 
-                sessionState.out.printf("      Columns sorted by: %s%s\n", cf_def.comparator_type,
cf_def.column_type.equals("Super") ? "/" + cf_def.subcomparator_type : "");
-                sessionState.out.printf("      Row cache size / save period: %s/%s\n", cf_def.row_cache_size,
cf_def.row_cache_save_period_in_seconds);
-                sessionState.out.printf("      Key cache size / save period: %s/%s\n", cf_def.key_cache_size,
cf_def.key_cache_save_period_in_seconds);
-                sessionState.out.printf("      Memtable thresholds: %s/%s/%s\n",
+                sessionState.out.printf("      Columns sorted by: %s%s%n", cf_def.comparator_type,
cf_def.column_type.equals("Super") ? "/" + cf_def.subcomparator_type : "");
+                sessionState.out.printf("      Row cache size / save period: %s/%s%n", cf_def.row_cache_size,
cf_def.row_cache_save_period_in_seconds);
+                sessionState.out.printf("      Key cache size / save period: %s/%s%n", cf_def.key_cache_size,
cf_def.key_cache_save_period_in_seconds);
+                sessionState.out.printf("      Memtable thresholds: %s/%s/%s%n",
                                 cf_def.memtable_operations_in_millions, cf_def.memtable_throughput_in_mb,
cf_def.memtable_flush_after_mins);
-                sessionState.out.printf("      GC grace seconds: %s\n", cf_def.gc_grace_seconds);
-                sessionState.out.printf("      Compaction min/max thresholds: %s/%s\n", cf_def.min_compaction_threshold,
cf_def.max_compaction_threshold);
-                sessionState.out.printf("      Read repair chance: %s\n", cf_def.read_repair_chance);
+                sessionState.out.printf("      GC grace seconds: %s%n", cf_def.gc_grace_seconds);
+                sessionState.out.printf("      Compaction min/max thresholds: %s/%s%n", cf_def.min_compaction_threshold,
cf_def.max_compaction_threshold);
+                sessionState.out.printf("      Read repair chance: %s%n", cf_def.read_repair_chance);
 
                 if (cf_def.getColumn_metadataSize() != 0)
                 {
@@ -1793,8 +1793,8 @@ public class CliClient extends CliUserHe
         {
             String keyName = (keyComparator == null) ? ByteBufferUtil.string(ks.key, Charsets.UTF_8)
: keyComparator.getString(ks.key);
 
-            sessionState.out.printf("-------------------\n");
-            sessionState.out.printf("RowKey: %s\n", keyName);
+            sessionState.out.printf("-------------------%n");
+            sessionState.out.printf("RowKey: %s%n", keyName);
             Iterator<ColumnOrSuperColumn> iterator = ks.getColumnsIterator();
 
             while (iterator.hasNext())
@@ -1806,7 +1806,7 @@ public class CliClient extends CliUserHe
                     Column col = columnOrSuperColumn.column;
                     validator = getValidatorForValue(columnFamilyDef, col.getName());
 
-                    sessionState.out.printf("=> (column=%s, value=%s, timestamp=%d)\n",
+                    sessionState.out.printf("=> (column=%s, value=%s, timestamp=%d)%n",
                                     formatColumnName(keySpace, columnFamilyName, col), validator.getString(col.value),
col.timestamp);
                 }
                 else if (columnOrSuperColumn.super_column != null)
@@ -1818,7 +1818,7 @@ public class CliClient extends CliUserHe
                     {
                         validator = getValidatorForValue(columnFamilyDef, col.getName());
 
-                        sessionState.out.printf("\n     (column=%s, value=%s, timestamp=%d)",
+                        sessionState.out.printf("%n     (column=%s, value=%s, timestamp=%d)",
                                         formatSubcolumnName(keySpace, columnFamilyName, col),
validator.getString(col.value), col.timestamp);
                     }
 
@@ -1827,7 +1827,7 @@ public class CliClient extends CliUserHe
             }
         }
 
-        sessionState.out.printf("\n%d Row%s Returned.\n", slices.size(), (slices.size() >
1 ? "s" : ""));
+        sessionState.out.printf("%n%d Row%s Returned.%n", slices.size(), (slices.size() >
1 ? "s" : ""));
     }
 
     // returnsub-columnmn name in human-readable format

Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/cli/CliUserHelp.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/cli/CliUserHelp.java?rev=1040186&r1=1040185&r2=1040186&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/cli/CliUserHelp.java (original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/cli/CliUserHelp.java Mon
Nov 29 16:50:03 2010
@@ -172,7 +172,7 @@ public class CliUserHelp {
                 state.out.println("attributes. Note that you must be using a keyspace.\n");
                 state.out.println("valid attributes are:");
                 for (ColumnFamilyArgument argument : ColumnFamilyArgument.values())
-                    state.out.printf("    - %s: %s\n", argument.toString().toLowerCase(),
argumentExplanations.get(argument));
+                    state.out.printf("    - %s: %s%n", argument.toString().toLowerCase(),
argumentExplanations.get(argument));
                 state.out.println("    - column_metadata: Metadata which describes columns
of column family.");
                 state.out.println("        Supported format is [{ k:v, k:v, ... }, { ...
}, ...]");
                 state.out.println("        Valid attributes: column_name, validation_class
(see comparator),");
@@ -197,7 +197,7 @@ public class CliUserHelp {
                 {
                     if (argument == ColumnFamilyArgument.COMPARATOR || argument == ColumnFamilyArgument.SUBCOMPARATOR)
                         continue;
-                    state.out.printf("    - %s: %s\n", argument.toString().toLowerCase(),
argumentExplanations.get(argument));
+                    state.out.printf("    - %s: %s%n", argument.toString().toLowerCase(),
argumentExplanations.get(argument));
                 }
                 state.out.println("    - column_metadata: Metadata which describes columns
of column family.");
                 state.out.println("        Supported format is [{ k:v, k:v, ... }, { ...
}, ...]");

Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/streaming/StreamingService.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/streaming/StreamingService.java?rev=1040186&r1=1040185&r2=1040186&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/streaming/StreamingService.java
(original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/streaming/StreamingService.java
Mon Nov 29 16:50:03 2010
@@ -56,19 +56,19 @@ public class StreamingService implements
         sb.append("Receiving from:\n");
         for (InetAddress source : StreamInSession.getSources())
         {
-            sb.append(String.format(" %s:\n", source.getHostAddress()));
+            sb.append(String.format(" %s:%n", source.getHostAddress()));
             for (PendingFile pf : StreamInSession.getIncomingFiles(source))
             {
-                sb.append(String.format("  %s\n", pf.toString()));
+                sb.append(String.format("  %s%n", pf.toString()));
             }
         }
-        sb.append("Sending to:\n");
+        sb.append("Sending to:%n");
         for (InetAddress dest : StreamOutSession.getDestinations())
         {
-            sb.append(String.format(" %s:\n", dest.getHostAddress()));
+            sb.append(String.format(" %s:%n", dest.getHostAddress()));
             for (PendingFile pf : StreamOutSession.getOutgoingFiles(dest))
             {
-                sb.append(String.format("  %s\n", pf.toString()));
+                sb.append(String.format("  %s%n", pf.toString()));
             }
         }
         return sb.toString();

Modified: cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/tools/NodeCmd.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/tools/NodeCmd.java?rev=1040186&r1=1040185&r2=1040186&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/tools/NodeCmd.java (original)
+++ cassandra/branches/cassandra-0.7/src/java/org/apache/cassandra/tools/NodeCmd.java Mon
Nov 29 16:50:03 2010
@@ -97,11 +97,11 @@ public class NodeCmd {
         Collection<String> leavingNodes = probe.getLeavingNodes();
         Map<String, String> loadMap = probe.getLoadMap();
 
-        outs.printf("%-16s%-7s%-8s%-16s%-8s%-44s\n", "Address", "Status", "State", "Load",
"Owns", "Token");
+        outs.printf("%-16s%-7s%-8s%-16s%-8s%-44s%n", "Address", "Status", "State", "Load",
"Owns", "Token");
         // show pre-wrap token twice so you can always read a node's range as
         // (previous line token, current line token]
         if (sortedTokens.size() > 1)
-            outs.printf("%-16s%-7s%-8s%-16s%-8s%-44s\n", "", "", "", "", "", sortedTokens.get(sortedTokens.size()
- 1));
+            outs.printf("%-16s%-7s%-8s%-16s%-8s%-44s%n", "", "", "", "", "", sortedTokens.get(sortedTokens.size()
- 1));
 
         // Calculate per-token ownership of the ring
         Map<Token, Float> ownerships = probe.getOwnership();
@@ -123,13 +123,13 @@ public class NodeCmd {
                           ? loadMap.get(primaryEndpoint)
                           : "?";
             String owns = new DecimalFormat("##0.00%").format(ownerships.get(token));
-            outs.printf("%-16s%-7s%-8s%-16s%-8s%-44s\n", primaryEndpoint, status, state,
load, owns, token);
+            outs.printf("%-16s%-7s%-8s%-16s%-8s%-44s%n", primaryEndpoint, status, state,
load, owns, token);
         }
     }
 
     public void printThreadPoolStats(PrintStream outs)
     {
-        outs.printf("%-25s%10s%10s%15s\n", "Pool Name", "Active", "Pending", "Completed");
+        outs.printf("%-25s%10s%10s%15s%n", "Pool Name", "Active", "Pending", "Completed");
 
         Iterator<Map.Entry<String, IExecutorMBean>> threads = probe.getThreadPoolMBeanProxies();
         while (threads.hasNext())
@@ -137,7 +137,7 @@ public class NodeCmd {
             Entry<String, IExecutorMBean> thread = threads.next();
             String poolName = thread.getKey();
             IExecutorMBean threadPoolProxy = thread.getValue();
-            outs.printf("%-25s%10s%10s%15s\n",
+            outs.printf("%-25s%10s%10s%15s%n",
                         poolName, threadPoolProxy.getActiveCount(), threadPoolProxy.getPendingTasks(),
threadPoolProxy.getCompletedTasks());
         }
     }
@@ -150,18 +150,18 @@ public class NodeCmd {
     public void printInfo(PrintStream outs)
     {
         outs.println(probe.getToken());
-        outs.printf("%-17s: %s\n", "Load", probe.getLoadString());
-        outs.printf("%-17s: %s\n", "Generation No", probe.getCurrentGenerationNumber());
+        outs.printf("%-17s: %s%n", "Load", probe.getLoadString());
+        outs.printf("%-17s: %s%n", "Generation No", probe.getCurrentGenerationNumber());
         
         // Uptime
         long secondsUp = probe.getUptime() / 1000;
-        outs.printf("%-17s: %d\n", "Uptime (seconds)", secondsUp);
+        outs.printf("%-17s: %d%n", "Uptime (seconds)", secondsUp);
 
         // Memory usage
         MemoryUsage heapUsage = probe.getHeapMemoryUsage();
         double memUsed = (double)heapUsage.getUsed() / (1024 * 1024);
         double memMax = (double)heapUsage.getMax() / (1024 * 1024);
-        outs.printf("%-17s: %.2f / %.2f\n", "Heap Memory (MB)", memUsed, memMax);
+        outs.printf("%-17s: %.2f / %.2f%n", "Heap Memory (MB)", memUsed, memMax);
     }
 
     public void printReleaseVersion(PrintStream outs)
@@ -171,7 +171,7 @@ public class NodeCmd {
 
     public void printNetworkStats(final InetAddress addr, PrintStream outs)
     {
-        outs.printf("Mode: %s\n", probe.getOperationMode());
+        outs.printf("Mode: %s%n", probe.getOperationMode());
         Set<InetAddress> hosts = addr == null ? probe.getStreamDestinations() : new
HashSet<InetAddress>(){{add(addr);}};
         if (hosts.size() == 0)
             outs.println("Not sending any streams.");
@@ -182,18 +182,18 @@ public class NodeCmd {
                 List<String> files = probe.getFilesDestinedFor(host);
                 if (files.size() > 0)
                 {
-                    outs.printf("Streaming to: %s\n", host);
+                    outs.printf("Streaming to: %s%n", host);
                     for (String file : files)
-                        outs.printf("   %s\n", file);
+                        outs.printf("   %s%n", file);
                 }
                 else
                 {
-                    outs.printf(" Nothing streaming to %s\n", host);
+                    outs.printf(" Nothing streaming to %s%n", host);
                 }
             }
             catch (IOException ex)
             {
-                outs.printf("   Error retrieving file data for %s\n", host);
+                outs.printf("   Error retrieving file data for %s%n", host);
             }
         }
 
@@ -207,18 +207,18 @@ public class NodeCmd {
                 List<String> files = probe.getIncomingFiles(host);
                 if (files.size() > 0)
                 {
-                    outs.printf("Streaming from: %s\n", host);
+                    outs.printf("Streaming from: %s%n", host);
                     for (String file : files)
-                        outs.printf("   %s\n", file);
+                        outs.printf("   %s%n", file);
                 }
                 else
                 {
-                    outs.printf(" Nothing streaming from %s\n", host);
+                    outs.printf(" Nothing streaming from %s%n", host);
                 }
             }
             catch (IOException ex)
             {
-                outs.printf("   Error retrieving file data for %s\n", host);
+                outs.printf("   Error retrieving file data for %s%n", host);
             }
         }
 
@@ -226,7 +226,7 @@ public class NodeCmd {
         outs.printf("%-25s", "Pool Name");
         outs.printf("%10s", "Active");
         outs.printf("%10s", "Pending");
-        outs.printf("%15s\n", "Completed");
+        outs.printf("%15s%n", "Completed");
 
         int pending;
         long completed;
@@ -237,7 +237,7 @@ public class NodeCmd {
         completed = 0;
         for (long n : ms.getCommandCompletedTasks().values())
             completed += n;
-        outs.printf("%-25s%10s%10s%15s\n", "Commands", "n/a", pending, completed);
+        outs.printf("%-25s%10s%10s%15s%n", "Commands", "n/a", pending, completed);
 
         pending = 0;
         for (int n : ms.getResponsePendingTasks().values())
@@ -245,7 +245,7 @@ public class NodeCmd {
         completed = 0;
         for (long n : ms.getResponseCompletedTasks().values())
             completed += n;
-        outs.printf("%-25s%10s%10s%15s\n", "Responses", "n/a", pending, completed);
+        outs.printf("%-25s%10s%10s%15s%n", "Responses", "n/a", pending, completed);
     }
     
     public void printColumnFamilyStats(PrintStream outs)



Mime
View raw message