accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1376579 - in /accumulo/branches/ACCUMULO-722/1.5: ./ core/ core/src/main/java/org/apache/accumulo/core/file/rfile/ core/src/test/java/org/apache/accumulo/core/file/rfile/ server/ server/src/main/java/org/apache/accumulo/server/util/ src/
Date Thu, 23 Aug 2012 16:32:44 GMT
Author: ecn
Date: Thu Aug 23 16:32:43 2012
New Revision: 1376579

URL: http://svn.apache.org/viewvc?rev=1376579&view=rev
Log:
ACCUMULO-722 merge fix to RFile from trunk

Added:
    accumulo/branches/ACCUMULO-722/1.5/core/src/test/java/org/apache/accumulo/core/file/rfile/RelativeKeyTest.java
      - copied unchanged from r1376577, accumulo/trunk/core/src/test/java/org/apache/accumulo/core/file/rfile/RelativeKeyTest.java
Modified:
    accumulo/branches/ACCUMULO-722/1.5/   (props changed)
    accumulo/branches/ACCUMULO-722/1.5/core/   (props changed)
    accumulo/branches/ACCUMULO-722/1.5/core/src/main/java/org/apache/accumulo/core/file/rfile/RelativeKey.java
    accumulo/branches/ACCUMULO-722/1.5/server/   (props changed)
    accumulo/branches/ACCUMULO-722/1.5/server/src/main/java/org/apache/accumulo/server/util/Initialize.java
    accumulo/branches/ACCUMULO-722/1.5/src/   (props changed)

Propchange: accumulo/branches/ACCUMULO-722/1.5/
------------------------------------------------------------------------------
  Merged /accumulo/trunk:r1376577

Propchange: accumulo/branches/ACCUMULO-722/1.5/core/
------------------------------------------------------------------------------
  Merged /accumulo/trunk/core:r1376577

Modified: accumulo/branches/ACCUMULO-722/1.5/core/src/main/java/org/apache/accumulo/core/file/rfile/RelativeKey.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-722/1.5/core/src/main/java/org/apache/accumulo/core/file/rfile/RelativeKey.java?rev=1376579&r1=1376578&r2=1376579&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-722/1.5/core/src/main/java/org/apache/accumulo/core/file/rfile/RelativeKey.java
(original)
+++ accumulo/branches/ACCUMULO-722/1.5/core/src/main/java/org/apache/accumulo/core/file/rfile/RelativeKey.java
Thu Aug 23 16:32:43 2012
@@ -47,7 +47,7 @@ public class RelativeKey implements Writ
   private static final byte CV_SAME = 0x08;
   private static final byte TS_SAME = 0x10;
   private static final byte DELETED = 0x20;
-  
+
   private static HashMap<Text,Integer> colFams = new HashMap<Text,Integer>();
   
   private static long bytesWritten = 0;
@@ -361,15 +361,37 @@ public class RelativeKey implements Writ
     read(in, mbseq, len);
   }
   
+  /**
+   * Determines what next array size should be by rounding up to next power of two.
+   * 
+   */
+  static int nextArraySize(int i) {
+    if (i < 0)
+      throw new IllegalArgumentException();
+    
+    if (i > (1 << 30))
+      return Integer.MAX_VALUE; // this is the next power of 2 minus one... a special case
+
+    if (i == 0) {
+      return 1;
+    }
+    
+    // round up to next power of two
+    int ret = i;
+    ret--;
+    ret |= ret >> 1;
+    ret |= ret >> 2;
+    ret |= ret >> 4;
+    ret |= ret >> 8;
+    ret |= ret >> 16;
+    ret++;
+    
+    return ret;
+  }
+
   private void read(DataInput in, MByteSequence mbseq, int len) throws IOException {
     if (mbseq.getBackingArray().length < len) {
-      int newLen = mbseq.getBackingArray().length;
-      
-      while (newLen < len) {
-        newLen = newLen * 2;
-      }
-      
-      mbseq.setArray(new byte[newLen]);
+      mbseq.setArray(new byte[nextArraySize(len)]);
     }
     
     in.readFully(mbseq.getBackingArray(), 0, len);

Propchange: accumulo/branches/ACCUMULO-722/1.5/server/
------------------------------------------------------------------------------
  Merged /accumulo/trunk/server:r1376577

Modified: accumulo/branches/ACCUMULO-722/1.5/server/src/main/java/org/apache/accumulo/server/util/Initialize.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-722/1.5/server/src/main/java/org/apache/accumulo/server/util/Initialize.java?rev=1376579&r1=1376578&r2=1376579&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-722/1.5/server/src/main/java/org/apache/accumulo/server/util/Initialize.java
(original)
+++ accumulo/branches/ACCUMULO-722/1.5/server/src/main/java/org/apache/accumulo/server/util/Initialize.java
Thu Aug 23 16:32:43 2012
@@ -417,7 +417,7 @@ public class Initialize {
     for (String tableId  :"0,1,2".split(",")) {
       String configPath = zkInstanceRoot + Constants.ZTABLES + "/" + tableId + Constants.ZTABLE_CONF
+ "/";
       ZooReaderWriter.getInstance().putPersistentData(configPath + Property.TABLE_MAJC_RATIO.getKey(),
"1".getBytes(), NodeExistsPolicy.FAIL);
-      //ZooReaderWriter.getInstance().putPersistentData(configPath + Property.TABLE_BLOCKCACHE_ENABLED,
"true".getBytes(), NodeExistsPolicy.FAIL);
+      ZooReaderWriter.getInstance().putPersistentData(configPath + Property.TABLE_BLOCKCACHE_ENABLED,
"true".getBytes(), NodeExistsPolicy.FAIL);
     }
     ZooReaderWriter zoo = ZooReaderWriter.getInstance();
     zoo.putPersistentData(zkInstanceRoot + Constants.ZTSERVERS, new byte[0], NodeExistsPolicy.FAIL);

Propchange: accumulo/branches/ACCUMULO-722/1.5/src/
------------------------------------------------------------------------------
  Merged /accumulo/trunk/src:r1376577



Mime
View raw message