You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by vi...@apache.org on 2012/11/01 17:29:09 UTC

svn commit: r1404662 [3/3] - in /accumulo/branches/ACCUMULO-259: ./ assemble/ core/ core/src/main/java/org/apache/accumulo/core/client/admin/ core/src/main/java/org/apache/accumulo/core/client/mapreduce/ core/src/main/java/org/apache/accumulo/core/clie...

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/WalkingSecurity.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/WalkingSecurity.java?rev=1404662&r1=1404661&r2=1404662&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/WalkingSecurity.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/WalkingSecurity.java Thu Nov  1 16:29:05 2012
@@ -24,9 +24,7 @@ import java.util.Map;
 import java.util.Set;
 import java.util.TreeSet;
 
-import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
-import org.apache.accumulo.core.client.Connector;
 import org.apache.accumulo.core.client.TableNotFoundException;
 import org.apache.accumulo.core.security.Authorizations;
 import org.apache.accumulo.core.security.SystemPermission;
@@ -45,7 +43,7 @@ import org.apache.log4j.Logger;
  * 
  */
 public class WalkingSecurity extends SecurityOperation implements Authorizor, Authenticator, PermissionHandler {
-  State state= null;
+  State state = null;
   protected final static Logger log = Logger.getLogger(WalkingSecurity.class);
   
   private static final String tableName = "secTableName";
@@ -60,13 +58,13 @@ public class WalkingSecurity extends Sec
   private static final String authsMap = "authorizationsCountMap";
   private static final String lastKey = "lastMutationKey";
   private static final String filesystem = "securityFileSystem";
-
+  
   private static WalkingSecurity instance = null;
   
   public WalkingSecurity(Authorizor author, Authenticator authent, PermissionHandler pm, String instanceId) {
     super(author, authent, pm, instanceId);
   }
-
+  
   public WalkingSecurity(State state2) {
     super(state2.getInstance().getInstanceID());
     this.state = state2;
@@ -74,17 +72,17 @@ public class WalkingSecurity extends Sec
     authenticator = this;
     permHandle = this;
   }
-
+  
   public static WalkingSecurity get(State state) {
     if (instance == null || instance.state != state) {
       instance = new WalkingSecurity(state);
       state.set(tableExists, Boolean.toString(false));
       state.set(authsMap, new HashMap<String,Integer>());
     }
-
+    
     return instance;
   }
-
+  
   @Override
   public void initialize(String instanceId) {
     throw new UnsupportedOperationException("nope");
@@ -104,7 +102,7 @@ public class WalkingSecurity extends Sec
   public boolean validSecurityHandlers(Authorizor one, PermissionHandler two) {
     return this.getClass().equals(one.getClass()) && this.getClass().equals(two.getClass());
   }
-
+  
   @Override
   public void initializeSecurity(String rootuser) throws AccumuloSecurityException {
     throw new UnsupportedOperationException("nope");
@@ -134,12 +132,16 @@ public class WalkingSecurity extends Sec
     }
     return userList;
   }
-
+  
   @Override
   public boolean authenticateUser(String user, ByteBuffer password, String instanceId) {
-    return Arrays.equals((byte[]) state.get(user + userPass), password.array());
+    byte[] pass = (byte[]) state.get(user + userPass);
+    boolean ret = Arrays.equals(pass, password.array());
+    if (!ret)
+      log.debug("auTHENTIcAtION IssuE- " + user + " user's password is not " + new String(password.array()) + " to the state, it is " + new String(pass));
+    return ret;
   }
-
+  
   @Override
   public void createUser(String user, byte[] pass) throws AccumuloSecurityException {
     state.set(user + userExists, Boolean.toString(true));
@@ -149,24 +151,17 @@ public class WalkingSecurity extends Sec
   @Override
   public void dropUser(String user) throws AccumuloSecurityException {
     state.set(user + userExists, Boolean.toString(false));
-    for (SystemPermission sp : SystemPermission.values()) {
-      revokeSystemPermission(user, sp);
-    }
-    if (getTableExists())
-      try{
-        for (TablePermission tp : TablePermission.values())
-          revokeTablePermission(user, getTableName(), tp);
-      } catch (TableNotFoundException tnfe) {
-        log.error("This really shouldn't happen", tnfe);
-      }
+    cleanUser(user);
+    if (user.equals(getTabUserName()))
+      state.set("table" + connector, null);
   }
-
+  
   @Override
   public void changePassword(String user, byte[] pass) throws AccumuloSecurityException {
     state.set(user + userPass, pass);
     state.set(user + userPass + "time", System.currentTimeMillis());
   }
-
+  
   @Override
   public boolean userExists(String user) {
     return Boolean.parseBoolean(state.getString(user + userExists));
@@ -174,9 +169,11 @@ public class WalkingSecurity extends Sec
   
   @Override
   public boolean hasSystemPermission(String user, SystemPermission permission) throws AccumuloSecurityException {
-    return Boolean.parseBoolean(state.getString("Sys" + userName + permission.name()));
+    boolean res = Boolean.parseBoolean(state.getString("Sys" + user + permission.name()));
+    log.debug("Sys"+user+permission.name() + " is the key; user " + user + " for " + permission + " is " + res);
+    return res;
   }
-
+  
   @Override
   public boolean hasCachedSystemPermission(String user, SystemPermission permission) throws AccumuloSecurityException {
     return hasSystemPermission(user, permission);
@@ -184,7 +181,7 @@ public class WalkingSecurity extends Sec
   
   @Override
   public boolean hasTablePermission(String user, String table, TablePermission permission) throws AccumuloSecurityException, TableNotFoundException {
-    return Boolean.parseBoolean(state.getString("Tab" + table + userName + permission.name()));
+    return Boolean.parseBoolean(state.getString("Tab" + table + user + permission.name()));
   }
   
   @Override
@@ -209,6 +206,7 @@ public class WalkingSecurity extends Sec
   
   private static void setSysPerm(State state, String userName, SystemPermission tp, boolean value) {
     log.debug((value ? "Gave" : "Took") + " the system permission " + tp.name() + (value ? " to" : " from") + " user " + userName);
+    log.debug("Seriously, Sys" + userName+tp.name() + " is being set to " + Boolean.toString(value));
     state.set("Sys" + userName + tp.name(), Boolean.toString(value));
   }
   
@@ -218,7 +216,7 @@ public class WalkingSecurity extends Sec
     if (tp.equals(TablePermission.READ) || tp.equals(TablePermission.WRITE))
       state.set("Tab" + table + userName + tp.name() + "time", System.currentTimeMillis());
   }
-
+  
   @Override
   public void revokeTablePermission(String user, String table, TablePermission permission) throws AccumuloSecurityException, TableNotFoundException {
     setTabPerm(state, user, permission, table, false);
@@ -236,10 +234,11 @@ public class WalkingSecurity extends Sec
   
   @Override
   public void cleanUser(String user) throws AccumuloSecurityException {
-    for (TablePermission tp : TablePermission.values())
-      try {
-        revokeTablePermission(user, null, tp);
-      } catch (TableNotFoundException e) {}
+    if (getTableExists())      
+      for (TablePermission tp : TablePermission.values())
+        try {
+          revokeTablePermission(user, getTableName(), tp);
+        } catch (TableNotFoundException e) {}
     for (SystemPermission sp : SystemPermission.values())
       revokeSystemPermission(user, sp);
   }
@@ -256,7 +255,7 @@ public class WalkingSecurity extends Sec
   public String getSysUserName() {
     return state.getString("system" + userName);
   }
-
+  
   public void setTabUserName(String name) {
     state.set("table" + userName, name);
   }
@@ -264,33 +263,11 @@ public class WalkingSecurity extends Sec
   public void setSysUserName(String name) {
     state.set("system" + userName, name);
   }
-
-  public Connector getSystemConnector() throws AccumuloException, AccumuloSecurityException {
-    Connector toRet = (Connector) state.get("system" + connector);
-    if (toRet == null) {
-      toRet = state.getInstance().getConnector(getSysAuthInfo());
-      state.set("system" + connector, toRet);
-    }
-    return toRet;
-  }
-
-  public void setSystemConnector(Connector conn) throws AccumuloException, AccumuloSecurityException {
-    state.set("system" + connector, conn);
-  }
-
-  public Connector getTableConnector() throws AccumuloException, AccumuloSecurityException {
-    Connector toRet = (Connector) state.get("table" + connector);
-    if (toRet == null) {
-      toRet = state.getInstance().getConnector(getTabAuthInfo());
-      state.set("table" + connector, toRet);
-    }
-    return toRet;
-  }
-
+    
   public String getTableName() {
     return state.getString(tableName);
   }
-
+  
   public boolean getTableExists() {
     return Boolean.parseBoolean(state.getString(tableExists));
   }
@@ -302,11 +279,11 @@ public class WalkingSecurity extends Sec
   public AuthInfo getTabAuthInfo() {
     return new AuthInfo(getTabUserName(), ByteBuffer.wrap(getTabPassword()), state.getInstance().getInstanceID());
   }
-
+  
   public byte[] getUserPassword(String user) {
     return (byte[]) state.get(user + userPass);
   }
-
+  
   public byte[] getSysPassword() {
     return (byte[]) state.get(getSysUserName() + userPass);
   }
@@ -314,9 +291,9 @@ public class WalkingSecurity extends Sec
   public byte[] getTabPassword() {
     return (byte[]) state.get(getTabUserName() + userPass);
   }
-
+  
   public boolean userPassTransient(String user) {
-    return System.currentTimeMillis() - state.getInteger(user + userPass + "time") < 1000;
+    return System.currentTimeMillis() - state.getLong(user + userPass + "time") < 1000;
   }
   
   public void setTableName(String tName) {
@@ -332,10 +309,10 @@ public class WalkingSecurity extends Sec
   public String[] getAuthsArray() {
     return new String[] {"Fishsticks", "PotatoSkins", "Ribs", "Asparagus", "Paper", "Towels", "Lint", "Brush", "Celery"};
   }
-
+  
   public boolean inAmbiguousZone(String userName, TablePermission tp) {
     if (tp.equals(TablePermission.READ) || tp.equals(TablePermission.WRITE)) {
-      Long setTime = (Long) state.get("Tab" + userName + tp.name() + "time");
+      Long setTime = state.getLong("Tab" + userName + tp.name() + "time");
       if (System.currentTimeMillis() < (setTime + 1000))
         return true;
     }
@@ -346,11 +323,11 @@ public class WalkingSecurity extends Sec
   public Map<String,Integer> getAuthsMap() {
     return (Map<String,Integer>) state.get(authsMap);
   }
-
+  
   public String getLastKey() {
     return state.getString(lastKey);
   }
-
+  
   public void increaseAuthMap(String s, int increment) {
     Integer curVal = getAuthsMap().get(s);
     if (curVal == null) {
@@ -359,7 +336,7 @@ public class WalkingSecurity extends Sec
     }
     curVal += increment;
   }
-
+  
   public FileSystem getFs() {
     FileSystem fs = null;
     try {

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/test/randomwalk/sequential/BatchVerify.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/test/randomwalk/sequential/BatchVerify.java?rev=1404662&r1=1404661&r2=1404662&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/test/randomwalk/sequential/BatchVerify.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/test/randomwalk/sequential/BatchVerify.java Thu Nov  1 16:29:05 2012
@@ -41,9 +41,9 @@ public class BatchVerify extends Test {
     
     Random rand = new Random();
     
-    int numWrites = state.getInteger("numWrites");
+    long numWrites = state.getLong("numWrites");
     int maxVerify = Integer.parseInt(props.getProperty("maxVerify", "2000"));
-    int numVerify = rand.nextInt(maxVerify - 1) + 1;
+    long numVerify = rand.nextInt(maxVerify - 1) + 1;
     
     if (numVerify > (numWrites / 4)) {
       numVerify = numWrites / 4;
@@ -56,8 +56,8 @@ public class BatchVerify extends Test {
       int count = 0;
       List<Range> ranges = new ArrayList<Range>();
       while (count < numVerify) {
-        int rangeStart = rand.nextInt(numWrites);
-        int rangeEnd = rangeStart + 99;
+        long rangeStart = rand.nextInt((int) numWrites);
+        long rangeEnd = rangeStart + 99;
         if (rangeEnd > (numWrites - 1)) {
           rangeEnd = numWrites - 1;
         }

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/test/randomwalk/sequential/Commit.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/test/randomwalk/sequential/Commit.java?rev=1404662&r1=1404661&r2=1404662&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/test/randomwalk/sequential/Commit.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/test/randomwalk/sequential/Commit.java Thu Nov  1 16:29:05 2012
@@ -28,7 +28,7 @@ public class Commit extends Test {
     
     state.getMultiTableBatchWriter().flush();
     
-    log.debug("Committed " + state.getInteger("numWrites") + " writes.  Total writes: " + state.getInteger("totalWrites"));
+    log.debug("Committed " + state.getLong("numWrites") + " writes.  Total writes: " + state.getLong("totalWrites"));
     state.set("numWrites", new Integer(0));
   }
   

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/test/randomwalk/sequential/Write.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/test/randomwalk/sequential/Write.java?rev=1404662&r1=1404661&r2=1404662&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/test/randomwalk/sequential/Write.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/test/randomwalk/sequential/Write.java Thu Nov  1 16:29:05 2012
@@ -32,9 +32,9 @@ public class Write extends Test {
     
     BatchWriter bw = state.getMultiTableBatchWriter().getBatchWriter(state.getString("seqTableName"));
     
-    state.set("numWrites", state.getInteger("numWrites") + 1);
+    state.set("numWrites", state.getLong("numWrites") + 1);
     
-    Integer totalWrites = state.getInteger("totalWrites") + 1;
+    Long totalWrites = state.getLong("totalWrites") + 1;
     if ((totalWrites % 10000) == 0) {
       log.debug("Total writes: " + totalWrites);
     }

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/trace/TraceServer.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/trace/TraceServer.java?rev=1404662&r1=1404661&r2=1404662&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/trace/TraceServer.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/trace/TraceServer.java Thu Nov  1 16:29:05 2012
@@ -19,6 +19,7 @@ package org.apache.accumulo.server.trace
 import java.net.InetSocketAddress;
 import java.net.ServerSocket;
 import java.nio.channels.ServerSocketChannel;
+import java.nio.charset.Charset;
 import java.util.TimerTask;
 import java.util.concurrent.TimeUnit;
 
@@ -76,6 +77,8 @@ public class TraceServer implements Watc
   private Connector connector;
   final String table;
 
+  private static final Charset utf8 = Charset.forName("UTF8");
+
   private static void put(Mutation m, String cf, String cq, byte[] bytes, int len) {
     m.put(new Text(cf), new Text(cq), new Value(bytes, 0, len));
   }
@@ -121,7 +124,7 @@ public class TraceServer implements Watc
       Mutation spanMutation = new Mutation(new Text(idString));
       Mutation indexMutation = new Mutation(new Text("idx:" + s.svc + ":" + startString));
       long diff = s.stop - s.start;
-      indexMutation.put(new Text(s.description), new Text(s.sender), new Value((idString + ":" + Long.toHexString(diff)).getBytes()));
+      indexMutation.put(new Text(s.description), new Text(s.sender), new Value((idString + ":" + Long.toHexString(diff)).getBytes(utf8)));
       ByteArrayTransport transport = new ByteArrayTransport();
       TCompactProtocol protocol = new TCompactProtocol(transport);
       s.write(protocol);
@@ -157,7 +160,7 @@ public class TraceServer implements Watc
     table = conf.get(Property.TRACE_TABLE);
     while (true) {
       try {
-        connector = serverConfiguration.getInstance().getConnector(conf.get(Property.TRACE_USER), conf.get(Property.TRACE_PASSWORD).getBytes());
+        connector = serverConfiguration.getInstance().getConnector(conf.get(Property.TRACE_USER), conf.get(Property.TRACE_PASSWORD).getBytes(utf8));
         if (!connector.tableOperations().exists(table)) {
           connector.tableOperations().create(table);
         }
@@ -221,7 +224,7 @@ public class TraceServer implements Watc
   private void registerInZooKeeper(String name) throws Exception {
     String root = ZooUtil.getRoot(serverConfiguration.getInstance()) + Constants.ZTRACERS;
     IZooReaderWriter zoo = ZooReaderWriter.getInstance();
-    String path = zoo.putEphemeralSequential(root + "/trace-", name.getBytes());
+    String path = zoo.putEphemeralSequential(root + "/trace-", name.getBytes(utf8));
     zoo.exists(path, this);
   }
   

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/AddFilesWithMissingEntries.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/AddFilesWithMissingEntries.java?rev=1404662&r1=1404661&r2=1404662&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/AddFilesWithMissingEntries.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/AddFilesWithMissingEntries.java Thu Nov  1 16:29:05 2012
@@ -16,6 +16,7 @@
  */
 package org.apache.accumulo.server.util;
 
+import java.nio.charset.Charset;
 import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Map.Entry;
@@ -47,6 +48,8 @@ public class AddFilesWithMissingEntries 
   
   static final Logger log = Logger.getLogger(AddFilesWithMissingEntries.class);
   static boolean update = false;
+
+  private static final Charset utf8 = Charset.forName("UTF8");
   
   /**
    * @param args
@@ -118,7 +121,7 @@ public class AddFilesWithMissingEntries 
         String size = Long.toString(file.getLen());
         String entries = "1"; // lie
         String value = size + "," + entries;
-        m.put(Constants.METADATA_DATAFILE_COLUMN_FAMILY, new Text(filename), new Value(value.getBytes()));
+        m.put(Constants.METADATA_DATAFILE_COLUMN_FAMILY, new Text(filename), new Value(value.getBytes(utf8)));
         if (update) {
           writer.getBatchWriter(Constants.METADATA_TABLE_NAME).addMutation(m);
         }

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/Admin.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/Admin.java?rev=1404662&r1=1404661&r2=1404662&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/Admin.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/Admin.java Thu Nov  1 16:29:05 2012
@@ -21,6 +21,7 @@ import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.net.InetSocketAddress;
 import java.nio.ByteBuffer;
+import java.nio.charset.Charset;
 
 import jline.ConsoleReader;
 
@@ -47,6 +48,8 @@ public class Admin {
   public static void main(String[] args) {
     boolean everything;
     
+    final Charset utf8 = Charset.forName("UTF8");
+    
     CommandLine cl = null;
     Options opts = new Options();
     opts.addOption("u", true, "optional administrator user name");
@@ -64,7 +67,7 @@ public class Admin {
       args = cl.getArgs();
       
       user = cl.hasOption("u") ? cl.getOptionValue("u") : "root";
-      pass = cl.hasOption("p") ? cl.getOptionValue("p").getBytes() : null;
+      pass = cl.hasOption("p") ? cl.getOptionValue("p").getBytes(utf8) : null;
       force = cl.hasOption("f");
       
       if (!((cl.getArgs().length == 1 && (args[0].equalsIgnoreCase("stopMaster") || args[0].equalsIgnoreCase("stopAll"))) || (cl.getArgs().length == 2 && args[0]
@@ -98,7 +101,7 @@ public class Admin {
         } else {
           if (pass == null) {
             try {
-              pass = new ConsoleReader().readLine("Enter current password for '" + user + "': ", '*').getBytes();
+              pass = new ConsoleReader().readLine("Enter current password for '" + user + "': ", '*').getBytes(utf8);
             } catch (IOException ioe) {
               log.error("Password not specified and unable to prompt: " + ioe);
               System.exit(4);

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/ChangeSecret.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/ChangeSecret.java?rev=1404662&r1=1404661&r2=1404662&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/ChangeSecret.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/ChangeSecret.java Thu Nov  1 16:29:05 2012
@@ -17,6 +17,7 @@
 package org.apache.accumulo.server.util;
 
 import java.io.IOException;
+import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.UUID;
@@ -38,6 +39,8 @@ import org.apache.zookeeper.data.ACL;
 import org.apache.zookeeper.data.Stat;
 
 public class ChangeSecret {
+
+  private static final Charset utf8 = Charset.forName("UTF8");
   
   public static void main(String[] args) throws Exception {
     String oldPass = null;
@@ -130,7 +133,7 @@ public class ChangeSecret {
     });
     String path = "/accumulo/instances/" + inst.getInstanceName();
     orig.recursiveDelete(path, NodeMissingPolicy.SKIP);
-    new_.putPersistentData(path, newInstanceId.getBytes(), NodeExistsPolicy.OVERWRITE);
+    new_.putPersistentData(path, newInstanceId.getBytes(utf8), NodeExistsPolicy.OVERWRITE);
     return newInstanceId;
   }
   

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/CheckForMetadataProblems.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/CheckForMetadataProblems.java?rev=1404662&r1=1404661&r2=1404662&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/CheckForMetadataProblems.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/CheckForMetadataProblems.java Thu Nov  1 16:29:05 2012
@@ -17,6 +17,7 @@
 package org.apache.accumulo.server.util;
 
 import java.nio.ByteBuffer;
+import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -216,7 +217,8 @@ public class CheckForMetadataProblems {
   }
   
   public static void main(String[] args) throws Exception {
-    args = processOptions(args);
+   final Charset utf8 = Charset.forName("UTF8");
+   args = processOptions(args);
     
     FileSystem fs = FileSystem.get(CachedConfiguration.getInstance());
     Instance instance = HdfsZooInstance.getInstance();
@@ -224,7 +226,7 @@ public class CheckForMetadataProblems {
 
     if (args.length == 2) {
       user = args[0];
-      pass = args[1].getBytes();
+      pass = args[1].getBytes(utf8);
       checkMetadataTableEntries(conf, fs, offline, fix);
     } else if (args.length == 0 && offline) {
       checkMetadataTableEntries(conf, fs, offline, fix);

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/CleanZookeeper.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/CleanZookeeper.java?rev=1404662&r1=1404661&r2=1404662&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/CleanZookeeper.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/CleanZookeeper.java Thu Nov  1 16:29:05 2012
@@ -17,6 +17,7 @@
 package org.apache.accumulo.server.util;
 
 import java.io.IOException;
+import java.nio.charset.Charset;
 
 import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.fate.zookeeper.IZooReaderWriter;
@@ -37,6 +38,9 @@ public class CleanZookeeper {
    *           error connecting to accumulo or zookeeper
    */
   public static void main(String[] args) throws IOException {
+
+    final Charset utf8 = Charset.forName("UTF8");
+	  
     if (args.length < 1) {
       System.err.println("Usage: " + CleanZookeeper.class.getName() + " hostname[:port] [auth]");
       System.exit(1);
@@ -44,7 +48,7 @@ public class CleanZookeeper {
     String root = Constants.ZROOT;
     IZooReaderWriter zk = ZooReaderWriter.getInstance();
     if (args.length == 2) {
-      zk.getZooKeeper().addAuthInfo("digest", args[1].getBytes());
+      zk.getZooKeeper().addAuthInfo("digest", args[1].getBytes(utf8));
     }
     
     try {

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/Initialize.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/Initialize.java?rev=1404662&r1=1404661&r2=1404662&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/Initialize.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/Initialize.java Thu Nov  1 16:29:05 2012
@@ -18,6 +18,7 @@ package org.apache.accumulo.server.util;
 
 import java.io.FileNotFoundException;
 import java.io.IOException;
+import java.nio.charset.Charset;
 import java.util.HashMap;
 import java.util.Locale;
 import java.util.Map.Entry;
@@ -109,6 +110,8 @@ public class Initialize {
     initialMetadataConf.put(Property.TABLE_INDEXCACHE_ENABLED.getKey(), "true");
     initialMetadataConf.put(Property.TABLE_BLOCKCACHE_ENABLED.getKey(), "true");
   }
+
+  private static final Charset utf8 = Charset.forName("UTF8");
   
   public static boolean doInit(Configuration conf, FileSystem fs) throws IOException {
     if (!ServerConfiguration.getSiteConfiguration().get(Property.INSTANCE_DFS_URI).equals(""))
@@ -264,7 +267,7 @@ public class Initialize {
       
       // root's directory
       Key rootDirKey = new Key(rootExtent, Constants.METADATA_DIRECTORY_COLUMN.getColumnFamily(), Constants.METADATA_DIRECTORY_COLUMN.getColumnQualifier(), 0);
-      mfw.append(rootDirKey, new Value("/root_tablet".getBytes()));
+      mfw.append(rootDirKey, new Value("/root_tablet".getBytes(utf8)));
       
       // root's prev row
       Key rootPrevRowKey = new Key(rootExtent, Constants.METADATA_PREV_ROW_COLUMN.getColumnFamily(), Constants.METADATA_PREV_ROW_COLUMN.getColumnQualifier(), 0);
@@ -275,11 +278,11 @@ public class Initialize {
       
       // table tablet's directory
       Key tableDirKey = new Key(tableExtent, Constants.METADATA_DIRECTORY_COLUMN.getColumnFamily(), Constants.METADATA_DIRECTORY_COLUMN.getColumnQualifier(), 0);
-      mfw.append(tableDirKey, new Value(Constants.TABLE_TABLET_LOCATION.getBytes()));
+      mfw.append(tableDirKey, new Value(Constants.TABLE_TABLET_LOCATION.getBytes(utf8)));
       
       // table tablet time
       Key tableTimeKey = new Key(tableExtent, Constants.METADATA_TIME_COLUMN.getColumnFamily(), Constants.METADATA_TIME_COLUMN.getColumnQualifier(), 0);
-      mfw.append(tableTimeKey, new Value((TabletTime.LOGICAL_TIME_ID + "0").getBytes()));
+      mfw.append(tableTimeKey, new Value((TabletTime.LOGICAL_TIME_ID + "0").getBytes(utf8)));
       
       // table tablet's prevrow
       Key tablePrevRowKey = new Key(tableExtent, Constants.METADATA_PREV_ROW_COLUMN.getColumnFamily(), Constants.METADATA_PREV_ROW_COLUMN.getColumnQualifier(),
@@ -292,11 +295,11 @@ public class Initialize {
       // default's directory
       Key defaultDirKey = new Key(defaultExtent, Constants.METADATA_DIRECTORY_COLUMN.getColumnFamily(),
           Constants.METADATA_DIRECTORY_COLUMN.getColumnQualifier(), 0);
-      mfw.append(defaultDirKey, new Value(Constants.DEFAULT_TABLET_LOCATION.getBytes()));
+      mfw.append(defaultDirKey, new Value(Constants.DEFAULT_TABLET_LOCATION.getBytes(utf8)));
       
       // default's time
       Key defaultTimeKey = new Key(defaultExtent, Constants.METADATA_TIME_COLUMN.getColumnFamily(), Constants.METADATA_TIME_COLUMN.getColumnQualifier(), 0);
-      mfw.append(defaultTimeKey, new Value((TabletTime.LOGICAL_TIME_ID + "0").getBytes()));
+      mfw.append(defaultTimeKey, new Value((TabletTime.LOGICAL_TIME_ID + "0").getBytes(utf8)));
       
       // default's prevrow
       Key defaultPrevRowKey = new Key(defaultExtent, Constants.METADATA_PREV_ROW_COLUMN.getColumnFamily(),
@@ -345,7 +348,7 @@ public class Initialize {
     // setup instance name
     if (clearInstanceName)
       zoo.recursiveDelete(instanceNamePath, NodeMissingPolicy.SKIP);
-    zoo.putPersistentData(instanceNamePath, uuid.getBytes(), NodeExistsPolicy.FAIL);
+    zoo.putPersistentData(instanceNamePath, uuid.getBytes(utf8), NodeExistsPolicy.FAIL);
     
     // setup the instance
     String zkInstanceRoot = Constants.ZROOT + "/" + uuid;
@@ -359,7 +362,7 @@ public class Initialize {
     zoo.putPersistentData(zkInstanceRoot + Constants.ZTRACERS, new byte[0], NodeExistsPolicy.FAIL);
     zoo.putPersistentData(zkInstanceRoot + Constants.ZMASTERS, new byte[0], NodeExistsPolicy.FAIL);
     zoo.putPersistentData(zkInstanceRoot + Constants.ZMASTER_LOCK, new byte[0], NodeExistsPolicy.FAIL);
-    zoo.putPersistentData(zkInstanceRoot + Constants.ZMASTER_GOAL_STATE, MasterGoalState.NORMAL.toString().getBytes(), NodeExistsPolicy.FAIL);
+    zoo.putPersistentData(zkInstanceRoot + Constants.ZMASTER_GOAL_STATE, MasterGoalState.NORMAL.toString().getBytes(utf8), NodeExistsPolicy.FAIL);
     zoo.putPersistentData(zkInstanceRoot + Constants.ZGC, new byte[0], NodeExistsPolicy.FAIL);
     zoo.putPersistentData(zkInstanceRoot + Constants.ZGC_LOCK, new byte[0], NodeExistsPolicy.FAIL);
     zoo.putPersistentData(zkInstanceRoot + Constants.ZCONFIG, new byte[0], NodeExistsPolicy.FAIL);
@@ -403,7 +406,7 @@ public class Initialize {
   
   private static byte[] getRootPassword() throws IOException {
     if (cliPassword != null) {
-      return cliPassword.getBytes();
+      return cliPassword.getBytes(utf8);
     }
     String rootpass;
     String confirmpass;
@@ -417,7 +420,7 @@ public class Initialize {
       if (!rootpass.equals(confirmpass))
         log.error("Passwords do not match");
     } while (!rootpass.equals(confirmpass));
-    return rootpass.getBytes();
+    return rootpass.getBytes(utf8);
   }
   
   private static void initSecurity(String iid, byte[] rootpass) throws AccumuloSecurityException, ThriftSecurityException {

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/LocalityCheck.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/LocalityCheck.java?rev=1404662&r1=1404661&r2=1404662&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/LocalityCheck.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/LocalityCheck.java Thu Nov  1 16:29:05 2012
@@ -17,6 +17,7 @@
 package org.apache.accumulo.server.util;
 
 import java.net.InetSocketAddress;
+import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Map;
@@ -37,6 +38,8 @@ import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 
 public class LocalityCheck {
+
+  private static final Charset utf8 = Charset.forName("UTF8");
   
   public int run(String[] args) throws Exception {
     if (args.length < 4) {
@@ -45,7 +48,7 @@ public class LocalityCheck {
     }
     ZooKeeperInstance instance = new ZooKeeperInstance(args[0], args[1]);
     FileSystem fs = FileSystem.get(CachedConfiguration.getInstance());
-    Connector connector = instance.getConnector(args[2], args[3].getBytes());
+    Connector connector = instance.getConnector(args[2], args[3].getBytes(utf8));
     Scanner scanner = connector.createScanner(Constants.METADATA_TABLE_NAME, Constants.NO_AUTHS);
     scanner.fetchColumnFamily(Constants.METADATA_CURRENT_LOCATION_COLUMN_FAMILY);
     scanner.fetchColumnFamily(Constants.METADATA_DATAFILE_COLUMN_FAMILY);

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/MetadataTable.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/MetadataTable.java?rev=1404662&r1=1404661&r2=1404662&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/MetadataTable.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/MetadataTable.java Thu Nov  1 16:29:05 2012
@@ -20,6 +20,7 @@
 package org.apache.accumulo.server.util;
 
 import java.io.IOException;
+import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -98,6 +99,8 @@ public class MetadataTable extends org.a
   private static final Logger log = Logger.getLogger(MetadataTable.class);
   
   private static final int SAVE_ROOT_TABLET_RETRIES = 3;
+
+  private static final Charset utf8 = Charset.forName("UTF8");
   
   private MetadataTable() {
     
@@ -113,7 +116,7 @@ public class MetadataTable extends org.a
   }
   
   public static void putLockID(ZooLock zooLock, Mutation m) {
-    Constants.METADATA_LOCK_COLUMN.put(m, new Value(zooLock.getLockID().serialize(ZooUtil.getRoot(HdfsZooInstance.getInstance()) + "/").getBytes()));
+    Constants.METADATA_LOCK_COLUMN.put(m, new Value(zooLock.getLockID().serialize(ZooUtil.getRoot(HdfsZooInstance.getInstance()) + "/").getBytes(utf8)));
   }
   
   public static void update(AuthInfo credentials, Mutation m) {
@@ -192,7 +195,7 @@ public class MetadataTable extends org.a
     
     if (dfv.getNumEntries() > 0) {
       m.put(Constants.METADATA_DATAFILE_COLUMN_FAMILY, new Text(path), new Value(dfv.encode()));
-      Constants.METADATA_TIME_COLUMN.put(m, new Value(time.getBytes()));
+      Constants.METADATA_TIME_COLUMN.put(m, new Value(time.getBytes(utf8)));
       // stuff in this location
       TServerInstance self = getTServerInstance(address, zooLock);
       self.putLastLocation(m);
@@ -207,12 +210,12 @@ public class MetadataTable extends org.a
     }
     
     for (String scanFile : filesInUseByScans)
-      m.put(Constants.METADATA_SCANFILE_COLUMN_FAMILY, new Text(scanFile), new Value("".getBytes()));
+      m.put(Constants.METADATA_SCANFILE_COLUMN_FAMILY, new Text(scanFile), new Value("".getBytes(utf8)));
     
     if (mergeFile != null)
       m.putDelete(Constants.METADATA_DATAFILE_COLUMN_FAMILY, new Text(mergeFile));
     
-    Constants.METADATA_FLUSH_COLUMN.put(m, new Value((flushId + "").getBytes()));
+    Constants.METADATA_FLUSH_COLUMN.put(m, new Value((flushId + "").getBytes(utf8)));
     
     update(credentials, zooLock, m);
     
@@ -234,7 +237,7 @@ public class MetadataTable extends org.a
   public static void updateTabletFlushID(KeyExtent extent, long flushID, AuthInfo credentials, ZooLock zooLock) {
     if (!extent.isRootTablet()) {
       Mutation m = new Mutation(extent.getMetadataEntry());
-      Constants.METADATA_FLUSH_COLUMN.put(m, new Value((flushID + "").getBytes()));
+      Constants.METADATA_FLUSH_COLUMN.put(m, new Value((flushID + "").getBytes(utf8)));
       update(credentials, zooLock, m);
     }
   }
@@ -242,29 +245,29 @@ public class MetadataTable extends org.a
   public static void updateTabletCompactID(KeyExtent extent, long compactID, AuthInfo credentials, ZooLock zooLock) {
     if (!extent.isRootTablet()) {
       Mutation m = new Mutation(extent.getMetadataEntry());
-      Constants.METADATA_COMPACT_COLUMN.put(m, new Value((compactID + "").getBytes()));
+      Constants.METADATA_COMPACT_COLUMN.put(m, new Value((compactID + "").getBytes(utf8)));
       update(credentials, zooLock, m);
     }
   }
   
   public static void updateTabletDataFile(long tid, KeyExtent extent, Map<String,DataFileValue> estSizes, String time, AuthInfo credentials, ZooLock zooLock) {
     Mutation m = new Mutation(extent.getMetadataEntry());
-    byte[] tidBytes = Long.toString(tid).getBytes();
+    byte[] tidBytes = Long.toString(tid).getBytes(utf8);
     
     for (Entry<String,DataFileValue> entry : estSizes.entrySet()) {
       Text file = new Text(entry.getKey());
       m.put(Constants.METADATA_DATAFILE_COLUMN_FAMILY, file, new Value(entry.getValue().encode()));
       m.put(Constants.METADATA_BULKFILE_COLUMN_FAMILY, file, new Value(tidBytes));
     }
-    Constants.METADATA_TIME_COLUMN.put(m, new Value(time.getBytes()));
+    Constants.METADATA_TIME_COLUMN.put(m, new Value(time.getBytes(utf8)));
     update(credentials, zooLock, m);
   }
   
   public static void addTablet(KeyExtent extent, String path, AuthInfo credentials, char timeType, ZooLock lock) {
     Mutation m = extent.getPrevRowUpdateMutation();
     
-    Constants.METADATA_DIRECTORY_COLUMN.put(m, new Value(path.getBytes()));
-    Constants.METADATA_TIME_COLUMN.put(m, new Value((timeType + "0").getBytes()));
+    Constants.METADATA_DIRECTORY_COLUMN.put(m, new Value(path.getBytes(utf8)));
+    Constants.METADATA_TIME_COLUMN.put(m, new Value((timeType + "0").getBytes(utf8)));
     
     update(credentials, lock, m);
   }
@@ -344,7 +347,7 @@ public class MetadataTable extends org.a
       try {
         log.info("trying to write root tablet location to ZooKeeper as " + address);
         String zRootLocPath = ZooUtil.getRoot(HdfsZooInstance.getInstance()) + Constants.ZROOT_TABLET_LOCATION;
-        zoo.putPersistentData(zRootLocPath, address.getBytes(), NodeExistsPolicy.OVERWRITE);
+        zoo.putPersistentData(zRootLocPath, address.getBytes(utf8), NodeExistsPolicy.OVERWRITE);
         return true;
       } catch (Exception e) {
         log.error("Master: unable to save root tablet location in zookeeper. exception: " + e, e);
@@ -381,12 +384,12 @@ public class MetadataTable extends org.a
       Map<String,Long> bulkLoadedFiles, AuthInfo credentials, String time, long lastFlushID, long lastCompactID, ZooLock zooLock) {
     Mutation m = extent.getPrevRowUpdateMutation();
     
-    Constants.METADATA_DIRECTORY_COLUMN.put(m, new Value(path.getBytes()));
-    Constants.METADATA_TIME_COLUMN.put(m, new Value(time.getBytes()));
+    Constants.METADATA_DIRECTORY_COLUMN.put(m, new Value(path.getBytes(utf8)));
+    Constants.METADATA_TIME_COLUMN.put(m, new Value(time.getBytes(utf8)));
     if (lastFlushID > 0)
-      Constants.METADATA_FLUSH_COLUMN.put(m, new Value(("" + lastFlushID).getBytes()));
+      Constants.METADATA_FLUSH_COLUMN.put(m, new Value(("" + lastFlushID).getBytes(utf8)));
     if (lastCompactID > 0)
-      Constants.METADATA_COMPACT_COLUMN.put(m, new Value(("" + lastCompactID).getBytes()));
+      Constants.METADATA_COMPACT_COLUMN.put(m, new Value(("" + lastCompactID).getBytes(utf8)));
     
     if (location != null) {
       m.put(Constants.METADATA_CURRENT_LOCATION_COLUMN_FAMILY, location.asColumnQualifier(), location.asMutationValue());
@@ -398,7 +401,7 @@ public class MetadataTable extends org.a
     }
     
     for (Entry<String,Long> entry : bulkLoadedFiles.entrySet()) {
-      byte[] tidBytes = Long.toString(entry.getValue()).getBytes();
+      byte[] tidBytes = Long.toString(entry.getValue()).getBytes(utf8);
       m.put(Constants.METADATA_BULKFILE_COLUMN_FAMILY, new Text(entry.getKey()), new Value(tidBytes));
     }
 
@@ -408,7 +411,7 @@ public class MetadataTable extends org.a
   public static void splitTablet(KeyExtent extent, Text oldPrevEndRow, double splitRatio, AuthInfo credentials, ZooLock zooLock) {
     Mutation m = extent.getPrevRowUpdateMutation(); //
     
-    Constants.METADATA_SPLIT_RATIO_COLUMN.put(m, new Value(Double.toString(splitRatio).getBytes()));
+    Constants.METADATA_SPLIT_RATIO_COLUMN.put(m, new Value(Double.toString(splitRatio).getBytes(utf8)));
     
     Constants.METADATA_OLD_PREV_ROW_COLUMN.put(m, KeyExtent.encodePrevEndRow(oldPrevEndRow));
     Constants.METADATA_CHOPPED_COLUMN.putDelete(m);
@@ -458,13 +461,13 @@ public class MetadataTable extends org.a
       m.putDelete(Constants.METADATA_DATAFILE_COLUMN_FAMILY, new Text(pathToRemove));
     
     for (String scanFile : scanFiles)
-      m.put(Constants.METADATA_SCANFILE_COLUMN_FAMILY, new Text(scanFile), new Value("".getBytes()));
+      m.put(Constants.METADATA_SCANFILE_COLUMN_FAMILY, new Text(scanFile), new Value("".getBytes(utf8)));
     
     if (size.getNumEntries() > 0)
       m.put(Constants.METADATA_DATAFILE_COLUMN_FAMILY, new Text(path), new Value(size.encode()));
     
     if (compactionId != null)
-      Constants.METADATA_COMPACT_COLUMN.put(m, new Value(("" + compactionId).getBytes()));
+      Constants.METADATA_COMPACT_COLUMN.put(m, new Value(("" + compactionId).getBytes(utf8)));
     
     TServerInstance self = getTServerInstance(address, zooLock);
     self.putLastLocation(m);
@@ -791,7 +794,7 @@ public class MetadataTable extends org.a
     } else {
       String value = StringUtil.join(entry.logSet, ";") + "|" + entry.tabletId;
       Mutation m = new Mutation(entry.extent.getMetadataEntry());
-      m.put(Constants.METADATA_LOG_COLUMN_FAMILY, new Text(entry.server + "/" + entry.filename), new Value(value.getBytes()));
+      m.put(Constants.METADATA_LOG_COLUMN_FAMILY, new Text(entry.server + "/" + entry.filename), new Value(value.getBytes(utf8)));
       update(credentials, zooLock, m);
     }
   }
@@ -1105,7 +1108,7 @@ public class MetadataTable extends org.a
       } else {
         // write out marker that this tablet was successfully cloned
         Mutation m = new Mutation(cloneTablet.keySet().iterator().next().getRow());
-        m.put(Constants.METADATA_CLONED_COLUMN_FAMILY, new Text(""), new Value("OK".getBytes()));
+        m.put(Constants.METADATA_CLONED_COLUMN_FAMILY, new Text(""), new Value("OK".getBytes(utf8)));
         bw.addMutation(m);
       }
     }
@@ -1160,7 +1163,7 @@ public class MetadataTable extends org.a
       Key k = entry.getKey();
       Mutation m = new Mutation(k.getRow());
       m.putDelete(k.getColumnFamily(), k.getColumnQualifier());
-      Constants.METADATA_DIRECTORY_COLUMN.put(m, new Value(FastFormat.toZeroPaddedString(dirCount++, 8, 16, "/c-".getBytes())));
+      Constants.METADATA_DIRECTORY_COLUMN.put(m, new Value(FastFormat.toZeroPaddedString(dirCount++, 8, 16, "/c-".getBytes(utf8))));
       bw.addMutation(m);
     }
     
@@ -1170,7 +1173,7 @@ public class MetadataTable extends org.a
   
   public static void chopped(KeyExtent extent, ZooLock zooLock) {
     Mutation m = new Mutation(extent.getMetadataEntry());
-    Constants.METADATA_CHOPPED_COLUMN.put(m, new Value("chopped".getBytes()));
+    Constants.METADATA_CHOPPED_COLUMN.put(m, new Value("chopped".getBytes(utf8)));
     update(SecurityConstants.getSystemCredentials(), zooLock, m);
   }
   

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/RandomWriter.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/RandomWriter.java?rev=1404662&r1=1404661&r2=1404662&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/RandomWriter.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/RandomWriter.java Thu Nov  1 16:29:05 2012
@@ -16,6 +16,7 @@
  */
 package org.apache.accumulo.server.util;
 
+import java.nio.charset.Charset;
 import java.util.Iterator;
 import java.util.Random;
 
@@ -81,13 +82,14 @@ public class RandomWriter {
   
   public static void main(String[] args) throws MutationsRejectedException, AccumuloException, AccumuloSecurityException, TableNotFoundException {
     long start = System.currentTimeMillis();
+    final Charset utf8 = Charset.forName("UTF8");
     if (args.length != 3) {
       log.error("Usage: bin/accumulo " + RandomWriter.class.getName() + " <username> <password> <num_mutations_to_write>");
       return;
     }
     log.info("starting at " + start + " for user " + args[0]);
     try {
-      Connector connector = HdfsZooInstance.getInstance().getConnector(args[0], args[1].getBytes());
+      Connector connector = HdfsZooInstance.getInstance().getConnector(args[0], args[1].getBytes(utf8));
       BatchWriter bw = connector.createBatchWriter(table_name, new BatchWriterConfig());
       long num_mutations = Long.parseLong(args[2]);
       log.info("Writing " + num_mutations + " mutations...");

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/RemoveEntriesForMissingFiles.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/RemoveEntriesForMissingFiles.java?rev=1404662&r1=1404661&r2=1404662&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/RemoveEntriesForMissingFiles.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/RemoveEntriesForMissingFiles.java Thu Nov  1 16:29:05 2012
@@ -16,6 +16,7 @@
  */
 package org.apache.accumulo.server.util;
 
+import java.nio.charset.Charset;
 import java.util.Map.Entry;
 
 import org.apache.accumulo.core.Constants;
@@ -43,13 +44,14 @@ public class RemoveEntriesForMissingFile
   private static Logger log = Logger.getLogger(RemoveEntriesForMissingFiles.class);
   
   public static void main(String[] args) throws Exception {
+    final Charset utf8 = Charset.forName("UTF8");
     FileSystem fs = FileSystem.get(CachedConfiguration.getInstance());
     if (args.length < 4) {
       System.err.println("Usage: accumulo.server.util.RemoveEntriesForMissingFiles instance zookeepers username password [delete]");
       System.exit(1);
     }
     Instance instance = new ZooKeeperInstance(args[0], args[1]);
-    Connector connector = instance.getConnector(args[2], args[3].getBytes());
+    Connector connector = instance.getConnector(args[2], args[3].getBytes(utf8));
     Scanner metadata = connector.createScanner(Constants.METADATA_TABLE_NAME, Constants.NO_AUTHS);
     metadata.setBatchSize(1000 * 1000);
     metadata.setRange(Constants.METADATA_KEYSPACE);

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/RestoreZookeeper.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/RestoreZookeeper.java?rev=1404662&r1=1404661&r2=1404662&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/RestoreZookeeper.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/RestoreZookeeper.java Thu Nov  1 16:29:05 2012
@@ -18,6 +18,7 @@ package org.apache.accumulo.server.util;
 
 import java.io.FileInputStream;
 import java.io.InputStream;
+import java.nio.charset.Charset;
 import java.util.Stack;
 
 import javax.xml.parsers.SAXParser;
@@ -37,6 +38,8 @@ import org.xml.sax.SAXException;
 import org.xml.sax.helpers.DefaultHandler;
 
 public class RestoreZookeeper {
+
+  private static final Charset utf8 = Charset.forName("UTF8");
   
   private static class Restore extends DefaultHandler {
     ZooKeeper zk = null;
@@ -74,9 +77,9 @@ public class RestoreZookeeper {
     }
     
     private void create(String path, String value, String encoding) {
-      byte[] data = value.getBytes();
+      byte[] data = value.getBytes(utf8);
       if ("base64".equals(encoding))
-        data = Base64.decodeBase64(value.getBytes());
+        data = Base64.decodeBase64(value.getBytes(utf8));
       try {
         try {
           ZooUtil.putPersistentData(zk, path, data, overwrite ? NodeExistsPolicy.OVERWRITE : NodeExistsPolicy.FAIL);

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/SendLogToChainsaw.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/SendLogToChainsaw.java?rev=1404662&r1=1404661&r2=1404662&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/SendLogToChainsaw.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/SendLogToChainsaw.java Thu Nov  1 16:29:05 2012
@@ -25,6 +25,7 @@ import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.net.Socket;
 import java.net.URLEncoder;
+import java.nio.charset.Charset;
 import java.text.SimpleDateFormat;
 import java.util.Calendar;
 import java.util.Date;
@@ -70,6 +71,8 @@ public class SendLogToChainsaw extends X
   private LongRange dateFilter = null;
   
   private LevelRangeFilter levelFilter = null;
+
+  private static final Charset utf8 = Charset.forName("UTF8");
   
   public SendLogToChainsaw(String directory, String fileNameFilter, String host, int port, Date start, Date end, String regex, String level) throws Exception {
     
@@ -135,7 +138,7 @@ public class SendLogToChainsaw extends X
                 out = convertLine(line, threadName);
                 if (null != out) {
                   if (socket != null && socket.isConnected())
-                    socket.getOutputStream().write(out.getBytes());
+                    socket.getOutputStream().write(out.getBytes(utf8));
                   else
                     System.err.println("Unable to send data to transport");
                 }

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/SystemPropUtil.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/SystemPropUtil.java?rev=1404662&r1=1404661&r2=1404662&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/SystemPropUtil.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/SystemPropUtil.java Thu Nov  1 16:29:05 2012
@@ -16,6 +16,8 @@
  */
 package org.apache.accumulo.server.util;
 
+import java.nio.charset.Charset;
+
 import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.zookeeper.ZooUtil;
@@ -26,6 +28,9 @@ import org.apache.accumulo.server.zookee
 import org.apache.zookeeper.KeeperException;
 
 public class SystemPropUtil {
+
+  private static final Charset utf8 = Charset.forName("UTF8");
+	
   public static boolean setSystemProperty(String property, String value) throws KeeperException, InterruptedException {
     Property p = Property.getPropertyByKey(property);
     if ((p != null && !p.getType().isValidFormat(value)) || !Property.isValidZooPropertyKey(property))
@@ -33,7 +38,7 @@ public class SystemPropUtil {
     
     // create the zk node for this property and set it's data to the specified value
     String zPath = ZooUtil.getRoot(HdfsZooInstance.getInstance()) + Constants.ZCONFIG + "/" + property;
-    ZooReaderWriter.getInstance().putPersistentData(zPath, value.getBytes(), NodeExistsPolicy.OVERWRITE);
+    ZooReaderWriter.getInstance().putPersistentData(zPath, value.getBytes(utf8), NodeExistsPolicy.OVERWRITE);
     
     return true;
   }

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/TablePropUtil.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/TablePropUtil.java?rev=1404662&r1=1404661&r2=1404662&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/TablePropUtil.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/TablePropUtil.java Thu Nov  1 16:29:05 2012
@@ -16,6 +16,8 @@
  */
 package org.apache.accumulo.server.util;
 
+import java.nio.charset.Charset;
+
 import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.zookeeper.ZooUtil;
@@ -26,6 +28,9 @@ import org.apache.accumulo.server.zookee
 import org.apache.zookeeper.KeeperException;
 
 public class TablePropUtil {
+
+  private static final Charset utf8 = Charset.forName("UTF8");
+  
   public static boolean setTableProperty(String tableId, String property, String value) throws KeeperException, InterruptedException {
     if (!isPropertyValid(property, value))
       return false;
@@ -36,7 +41,7 @@ public class TablePropUtil {
     
     // create the zk node for this property and set it's data to the specified value
     String zPath = zkTablePath + "/" + property;
-    ZooReaderWriter.getInstance().putPersistentData(zPath, value.getBytes(), NodeExistsPolicy.OVERWRITE);
+    ZooReaderWriter.getInstance().putPersistentData(zPath, value.getBytes(utf8), NodeExistsPolicy.OVERWRITE);
     
     return true;
   }

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/VerifyTabletAssignments.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/VerifyTabletAssignments.java?rev=1404662&r1=1404661&r2=1404662&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/VerifyTabletAssignments.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/util/VerifyTabletAssignments.java Thu Nov  1 16:29:05 2012
@@ -18,6 +18,7 @@ package org.apache.accumulo.server.util;
 
 import java.io.PrintWriter;
 import java.nio.ByteBuffer;
+import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashSet;
@@ -70,6 +71,8 @@ import org.apache.thrift.TException;
 import org.apache.thrift.TServiceClient;
 
 public class VerifyTabletAssignments {
+
+  private static final Charset utf8 = Charset.forName("UTF8");
   
   public static void main(String[] args) throws Exception {
     Options opts = new Options();
@@ -129,7 +132,7 @@ public class VerifyTabletAssignments {
       System.exit(1);
     }
     
-    Connector conn = instance.getConnector(user, passw.getBytes());
+    Connector conn = instance.getConnector(user, passw.getBytes(utf8));
     ServerConfiguration conf = new ServerConfiguration(instance);
     for (String table : conn.tableOperations().list())
       checkTable(conf.getConfiguration(), user, passw, table, null, cl.hasOption(verboseOption.getOpt()));
@@ -149,7 +152,7 @@ public class VerifyTabletAssignments {
     SortedSet<KeyExtent> tablets = new TreeSet<KeyExtent>();
     
     MetadataTable.getEntries(HdfsZooInstance.getInstance(),
-        new AuthInfo(user, ByteBuffer.wrap(pass.getBytes()), HdfsZooInstance.getInstance().getInstanceID()), table, false, locations, tablets);
+        new AuthInfo(user, ByteBuffer.wrap(pass.getBytes(utf8)), HdfsZooInstance.getInstance().getInstanceID()), table, false, locations, tablets);
     
     final HashSet<KeyExtent> failures = new HashSet<KeyExtent>();
     
@@ -180,7 +183,7 @@ public class VerifyTabletAssignments {
         @Override
         public void run() {
           try {
-            checkTabletServer(conf, user, ByteBuffer.wrap(pass.getBytes()), entry, failures);
+            checkTabletServer(conf, user, ByteBuffer.wrap(pass.getBytes(utf8)), entry, failures);
           } catch (Exception e) {
             System.err.println("Failure on ts " + entry.getKey() + " " + e.getMessage());
             e.printStackTrace();

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooQueueLock.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooQueueLock.java?rev=1404662&r1=1404661&r2=1404662&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooQueueLock.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooQueueLock.java Thu Nov  1 16:29:05 2012
@@ -16,6 +16,7 @@
  */
 package org.apache.accumulo.server.zookeeper;
 
+import java.nio.charset.Charset;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.locks.Lock;
 
@@ -23,6 +24,8 @@ import org.apache.accumulo.fate.zookeepe
 import org.apache.zookeeper.KeeperException;
 
 public class ZooQueueLock extends org.apache.accumulo.fate.zookeeper.ZooQueueLock {
+
+  private static final Charset utf8 = Charset.forName("UTF8");
   
   public ZooQueueLock(String path, boolean ephemeral) throws KeeperException, InterruptedException {
     super(ZooReaderWriter.getRetryingInstance(), path, ephemeral);
@@ -30,8 +33,8 @@ public class ZooQueueLock extends org.ap
   
   public static void main(String args[]) throws InterruptedException, KeeperException {
     ZooQueueLock lock = new ZooQueueLock("/lock", true);
-    DistributedReadWriteLock rlocker = new DistributedReadWriteLock(lock, "reader".getBytes());
-    DistributedReadWriteLock wlocker = new DistributedReadWriteLock(lock, "wlocker".getBytes());
+    DistributedReadWriteLock rlocker = new DistributedReadWriteLock(lock, "reader".getBytes(utf8));
+    DistributedReadWriteLock wlocker = new DistributedReadWriteLock(lock, "wlocker".getBytes(utf8));
     Lock readLock = rlocker.readLock();
     readLock.lock();
     Lock readLock2 = rlocker.readLock();
@@ -44,7 +47,7 @@ public class ZooQueueLock extends org.ap
     writeLock.lock();
     if (readLock.tryLock(100, TimeUnit.MILLISECONDS))
       throw new RuntimeException("Read lock achieved during write lock!");
-    Lock writeLock2 = DistributedReadWriteLock.recoverLock(lock, "wlocker".getBytes());
+    Lock writeLock2 = DistributedReadWriteLock.recoverLock(lock, "wlocker".getBytes(utf8));
     writeLock2.unlock();
     readLock.lock();
     System.out.println("success");

Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooReaderWriter.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooReaderWriter.java?rev=1404662&r1=1404661&r2=1404662&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooReaderWriter.java (original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/zookeeper/ZooReaderWriter.java Thu Nov  1 16:29:05 2012
@@ -20,6 +20,7 @@ import java.lang.reflect.InvocationHandl
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
+import java.nio.charset.Charset;
 
 import org.apache.accumulo.core.conf.AccumuloConfiguration;
 import org.apache.accumulo.core.conf.Property;
@@ -34,9 +35,11 @@ public class ZooReaderWriter extends org
   private static final String USER = "accumulo";
   private static ZooReaderWriter instance = null;
   private static IZooReaderWriter retryingInstance = null;
+
+  private static final Charset utf8 = Charset.forName("UTF8");
   
   public ZooReaderWriter(String string, int timeInMillis, String secret) {
-    super(string, timeInMillis, SCHEME, (USER + ":" + secret).getBytes());
+    super(string, timeInMillis, SCHEME, (USER + ":" + secret).getBytes(utf8));
   }
   
   public static synchronized ZooReaderWriter getInstance() {

Propchange: accumulo/branches/ACCUMULO-259/src/
------------------------------------------------------------------------------
  Merged /accumulo/trunk/src:r1403486-1404657

Modified: accumulo/branches/ACCUMULO-259/test/system/randomwalk/conf/modules/Security.xml
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/test/system/randomwalk/conf/modules/Security.xml?rev=1404662&r1=1404661&r2=1404662&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/test/system/randomwalk/conf/modules/Security.xml (original)
+++ accumulo/branches/ACCUMULO-259/test/system/randomwalk/conf/modules/Security.xml Thu Nov  1 16:29:05 2012
@@ -148,7 +148,6 @@
 	<edge id="security.AlterTable" weight="10"/>
 	<edge id="SystemChangeSystemPass" weight="60"/>
 	<edge id="SystemChangeTablePass" weight="10"/>
-	<edge id="TableChangeTablePass" weight="10"/>
 	<edge id="AuthenticateSystemRight" weight="50"/>
 	<edge id="AuthenticateSystemWrong" weight="50"/>
 	<edge id="AuthenticateTableRight" weight="10"/>
@@ -157,7 +156,6 @@
 	<edge id="RandomAuths" weight="10"/>
 	<edge id="security.AlterSystemPerm" weight="60"/>
 	<edge id="security.AlterTablePerm" weight="10"/>
-	<edge id="security.TableOp" weight="10"/>
 </node>
 
 <node id="dummy.YesUserNoTable">
@@ -193,7 +191,6 @@
 	<edge id="security.AlterTable" weight="60"/>
 	<edge id="SystemChangeSystemPass" weight="60"/>
 	<edge id="SystemChangeTablePass" weight="10"/>
-	<edge id="TableChangeTablePass" weight="10"/>
 	<edge id="AuthenticateSystemRight" weight="50"/>
 	<edge id="AuthenticateSystemWrong" weight="50"/>
 	<edge id="AuthenticateTableRight" weight="10"/>
@@ -202,8 +199,6 @@
 	<edge id="RandomAuths" weight="10"/>
 	<edge id="security.AlterSystemPerm" weight="60"/>
 	<edge id="security.AlterTablePerm" weight="10"/>
-	<edge id="security.TableOp" weight="10"/>
-
 </node>
 
 <node id="dummy.YesUserYesTable">