accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vi...@apache.org
Subject svn commit: r1391344 [2/2] - in /accumulo/branches/ACCUMULO-259: ./ core/ server/ server/src/main/java/org/apache/accumulo/server/client/ server/src/main/java/org/apache/accumulo/server/master/ server/src/main/java/org/apache/accumulo/server/master/tab...
Date Fri, 28 Sep 2012 07:26:00 GMT
Modified: accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/Validate.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/Validate.java?rev=1391344&r1=1391343&r2=1391344&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/Validate.java
(original)
+++ accumulo/branches/ACCUMULO-259/server/src/main/java/org/apache/accumulo/server/test/randomwalk/security/Validate.java
Fri Sep 28 07:25:59 2012
@@ -39,13 +39,13 @@ public class Validate extends Test {
   public static void validate(State state, Logger log) throws Exception {
     Connector conn = state.getConnector();
     
-    boolean tableExists = WalkingSecurity.get(state).getTableExists();
-    boolean cloudTableExists = conn.tableOperations().list().contains(WalkingSecurity.get(state).getTableName());
+    boolean tableExists = SecurityHelper.getTableExists(state);
+    boolean cloudTableExists = conn.tableOperations().list().contains(SecurityHelper.getTableName(state));
     if (tableExists != cloudTableExists)
       throw new AccumuloException("Table existance out of sync");
     
-    boolean tableUserExists = WalkingSecurity.get(state).userExists(WalkingSecurity.get(state).getTabUserName());
-    boolean cloudTableUserExists = conn.securityOperations().listUsers().contains(WalkingSecurity.get(state).getTabUserName());
+    boolean tableUserExists = SecurityHelper.getTabUserExists(state);
+    boolean cloudTableUserExists = conn.securityOperations().listUsers().contains(SecurityHelper.getTabUserName(state));
     if (tableUserExists != cloudTableUserExists)
       throw new AccumuloException("Table User existance out of sync");
     
@@ -55,16 +55,17 @@ public class Validate extends Test {
     props.setProperty("target", "table");
     Authenticate.authenticate(conn, state, props);
     
-    for (String user : new String[] {WalkingSecurity.get(state).getSysUserName(), WalkingSecurity.get(state).getTabUserName()})
{
+    boolean tabUserExists = SecurityHelper.getTabUserExists(state);
+    for (String user : new String[] {SecurityHelper.getSysUserName(state), SecurityHelper.getTabUserName(state)})
{
       for (SystemPermission sp : SystemPermission.values()) {
-        boolean hasSp = WalkingSecurity.get(state).hasSystemPermission(user, sp);
+        boolean hasSp = SecurityHelper.getSysPerm(state, user, sp);
         boolean accuHasSp;
         try {
           accuHasSp = conn.securityOperations().hasSystemPermission(user, sp);
           log.debug("Just checked to see if user " + user + " has system perm " + sp.name()
+ " with answer " + accuHasSp);
         } catch (AccumuloSecurityException ae) {
           if (ae.getErrorCode().equals(SecurityErrorCode.USER_DOESNT_EXIST)) {
-            if (tableUserExists)
+            if (tabUserExists)
               throw new AccumuloException("Got user DNE error when they should", ae);
             else
               continue;
@@ -76,14 +77,14 @@ public class Validate extends Test {
       }
       
       for (TablePermission tp : TablePermission.values()) {
-        boolean hasTp = WalkingSecurity.get(state).hasTablePermission(user, WalkingSecurity.get(state).getTableName(),
tp);
+        boolean hasTp = SecurityHelper.getTabPerm(state, user, tp);
         boolean accuHasTp;
         try {
-          accuHasTp = conn.securityOperations().hasTablePermission(user, WalkingSecurity.get(state).getTableName(),
tp);
+          accuHasTp = conn.securityOperations().hasTablePermission(user, SecurityHelper.getTableName(state),
tp);
           log.debug("Just checked to see if user " + user + " has table perm " + tp.name()
+ " with answer " + accuHasTp);
         } catch (AccumuloSecurityException ae) {
           if (ae.getErrorCode().equals(SecurityErrorCode.USER_DOESNT_EXIST)) {
-            if (tableUserExists)
+            if (tabUserExists)
               throw new AccumuloException("Got user DNE error when they should", ae);
             else
               continue;
@@ -101,13 +102,13 @@ public class Validate extends Test {
       
     }
     
-    Authorizations auths = WalkingSecurity.get(state).getUserAuthorizations(WalkingSecurity.get(state).getTabAuthInfo());
+    Authorizations auths = SecurityHelper.getUserAuths(state, SecurityHelper.getTabUserName(state));
     Authorizations accuAuths;
     try {
-      accuAuths = conn.securityOperations().getUserAuthorizations(WalkingSecurity.get(state).getTabUserName());
+      accuAuths = conn.securityOperations().getUserAuthorizations(SecurityHelper.getTabUserName(state));
     } catch (AccumuloSecurityException ae) {
       if (ae.getErrorCode().equals(SecurityErrorCode.USER_DOESNT_EXIST)) {
-        if (tableUserExists)
+        if (tabUserExists)
           throw new AccumuloException("Table user didn't exist when they should.", ae);
         else
           return;

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=1391344&r1=1391343&r2=1391344&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
Fri Sep 28 07:25:59 2012
@@ -50,8 +50,8 @@ import org.apache.accumulo.server.conf.S
 import org.apache.accumulo.server.constraints.MetadataConstraints;
 import org.apache.accumulo.server.iterators.MetadataBulkLoadFilter;
 import org.apache.accumulo.server.master.state.tables.TableManager;
-import org.apache.accumulo.server.security.AuditedSecurityOperation;
 import org.apache.accumulo.server.security.SecurityConstants;
+import org.apache.accumulo.server.security.SecurityOperationImpl;
 import org.apache.accumulo.server.security.SecurityUtil;
 import org.apache.accumulo.server.tabletserver.TabletTime;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
@@ -412,19 +412,11 @@ public class Initialize {
   }
   
   private static void initSecurity(String iid, byte[] rootpass) throws AccumuloSecurityException,
ThriftSecurityException {
-    AuditedSecurityOperation.getInstance(iid).initializeSecurity(SecurityConstants.getSystemCredentials(),
ROOT_USER, rootpass);
+    SecurityOperationImpl.getInstance(iid).initializeSecurity(SecurityConstants.getSystemCredentials(),
ROOT_USER, rootpass);
   }
   
   protected static void initMetadataConfig() throws IOException {
     try {
-      Configuration conf = CachedConfiguration.getInstance();
-      int max = conf.getInt("dfs.replication.max", 512);
-      // Hadoop 0.23 switched the min value configuration name
-      int min = Math.max(conf.getInt("dfs.replication.min", 1), conf.getInt("dfs.namenode.replication.min",
1));
-      if (max < 5)
-        setMetadataReplication(max, "max");
-      if (min > 5)
-        setMetadataReplication(min, "min");
       for (Entry<String,String> entry : initialMetadataConf.entrySet())
         if (!TablePropUtil.setTableProperty(Constants.METADATA_TABLE_ID, entry.getKey(),
entry.getValue()))
           throw new IOException("Cannot create per-table property " + entry.getKey());
@@ -434,18 +426,6 @@ public class Initialize {
     }
   }
   
-  private static void setMetadataReplication(int replication, String reason) throws IOException
{
-    String rep = getConsoleReader().readLine(
-        "Your HDFS replication " + reason
-            + " is not compatible with our default !METADATA replication of 5. What do you
want to set your !METADATA replication to? (" + replication + ") ");
-    if (rep == null || rep.length() == 0)
-      rep = Integer.toString(replication);
-    else
-      // Lets make sure it's a number
-      Integer.parseInt(rep);
-    initialMetadataConf.put(Property.TABLE_FILE_REPLICATION.getKey(), rep);
-  }
-
   public static boolean isInitialized(FileSystem fs) throws IOException {
     return (fs.exists(ServerConstants.getInstanceIdLocation()) || fs.exists(ServerConstants.getDataVersionLocation()));
   }

Propchange: accumulo/branches/ACCUMULO-259/src/
------------------------------------------------------------------------------
  Reverse-merged /accumulo/trunk/src:r1362561-1363473
  Reverse-merged /accumulo/branches/1.4/src/src:r1363430



Mime
View raw message