cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1026415 - in /cassandra/trunk/src/java/org/apache/cassandra: cli/CliClient.java db/RangeSliceCommand.java db/ReadResponse.java db/SystemTable.java
Date Fri, 22 Oct 2010 17:26:44 GMT
Author: jbellis
Date: Fri Oct 22 17:26:43 2010
New Revision: 1026415

URL: http://svn.apache.org/viewvc?rev=1026415&view=rev
Log:
fix use of .array() in isBootstrapped.  clarify others.  patch by jbellis

Modified:
    cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java
    cassandra/trunk/src/java/org/apache/cassandra/db/RangeSliceCommand.java
    cassandra/trunk/src/java/org/apache/cassandra/db/ReadResponse.java
    cassandra/trunk/src/java/org/apache/cassandra/db/SystemTable.java

Modified: cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java?rev=1026415&r1=1026414&r2=1026415&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/cli/CliClient.java Fri Oct 22 17:26:43 2010
@@ -1949,7 +1949,7 @@ public class CliClient 
         for (KeySlice ks : slices)
         {
             css_.out.printf("-------------------\n");
-            css_.out.printf("RowKey: %s\n", new String(ks.key.array(),ks.key.position(),ks.key.remaining(),
Charsets.UTF_8));
+            css_.out.printf("RowKey: %s\n", ByteBufferUtil.string(ks.key, Charsets.UTF_8));
 
             Iterator<ColumnOrSuperColumn> iterator = ks.getColumnsIterator();
 

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/RangeSliceCommand.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/RangeSliceCommand.java?rev=1026415&r1=1026414&r2=1026415&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/RangeSliceCommand.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/RangeSliceCommand.java Fri Oct 22 17:26:43
2010
@@ -120,9 +120,10 @@ class RangeSliceCommandSerializer implem
     {
         dos.writeUTF(sliceCommand.keyspace);
         dos.writeUTF(sliceCommand.column_family);
-        dos.writeInt(sliceCommand.super_column == null ? 0 : sliceCommand.super_column.remaining());
-        if (sliceCommand.super_column != null)
-            dos.write(sliceCommand.super_column.array(),sliceCommand.super_column.position()+sliceCommand.super_column.arrayOffset(),sliceCommand.super_column.remaining());
+        ByteBuffer sc = sliceCommand.super_column;
+        dos.writeInt(sc == null ? 0 : sc.remaining());
+        if (sc != null)
+            dos.write(sc.array(), sc.position() + sc.arrayOffset(), sc.remaining());
 
         TSerializer ser = new TSerializer(new TBinaryProtocol.Factory());
         FBUtilities.serialize(ser, sliceCommand.predicate, dos);

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/ReadResponse.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/ReadResponse.java?rev=1026415&r1=1026414&r2=1026415&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/ReadResponse.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/ReadResponse.java Fri Oct 22 17:26:43
2010
@@ -88,7 +88,7 @@ class ReadResponseSerializer implements 
 	public void serialize(ReadResponse rm, DataOutputStream dos) throws IOException
 	{
         dos.writeInt(rm.digest().remaining());
-        dos.write(rm.digest().array(),rm.digest().position()+rm.digest().arrayOffset(),rm.digest().remaining());
+        dos.write(rm.digest().array(), rm.digest().position() + rm.digest().arrayOffset(),
rm.digest().remaining());
         dos.writeBoolean(rm.isDigestQuery());
         
         if( !rm.isDigestQuery() && rm.row() != null )

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/SystemTable.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/SystemTable.java?rev=1026415&r1=1026414&r2=1026415&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/SystemTable.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/SystemTable.java Fri Oct 22 17:26:43
2010
@@ -178,9 +178,9 @@ public class SystemTable
             {
                 try
                 {
-                    byte[] addr = new byte[column.value().remaining()];
-                    System.arraycopy(column.value().array(), column.value().position()+column.value().arrayOffset(),
addr, 0, column.value().remaining());
-                    
+                    ByteBuffer v = column.value();
+                    byte[] addr = new byte[v.remaining()];
+                    System.arraycopy(v.array(), v.position() + v.arrayOffset(), addr, 0,
v.remaining());
                     tokenMap.put(p.getTokenFactory().fromByteArray(column.name()), InetAddress.getByAddress(addr));
                 }
                 catch (UnknownHostException e)
@@ -304,8 +304,10 @@ public class SystemTable
                                                         new QueryPath(STATUS_CF),
                                                         BOOTSTRAP);
         ColumnFamily cf = table.getColumnFamilyStore(STATUS_CF).getColumnFamily(filter);
+        if (cf == null)
+            return false;
         IColumn c = cf.getColumn(BOOTSTRAP);
-        return cf != null && c.value().array()[c.value().position()+c.value().arrayOffset()]
== 1;
+        return c.value().get(0) == 1;
     }
 
     public static void setBootstrapped(boolean isBootstrapped)



Mime
View raw message