accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1383486 - in /accumulo/branches/ACCUMULO-722/1.5: ./ core/src/main/java/org/apache/accumulo/core/ core/src/main/java/org/apache/accumulo/core/data/ server/src/main/java/org/apache/accumulo/server/constraints/ server/src/main/java/org/apach...
Date Tue, 11 Sep 2012 17:28:52 GMT
Author: ecn
Date: Tue Sep 11 17:28:51 2012
New Revision: 1383486

URL: http://svn.apache.org/viewvc?rev=1383486&view=rev
Log:
ACCUMULO-722: make all the special tables start with an exclaimation mark

Modified:
    accumulo/branches/ACCUMULO-722/1.5/core/src/main/java/org/apache/accumulo/core/Constants.java
    accumulo/branches/ACCUMULO-722/1.5/core/src/main/java/org/apache/accumulo/core/data/KeyExtent.java
    accumulo/branches/ACCUMULO-722/1.5/pom.xml
    accumulo/branches/ACCUMULO-722/1.5/server/src/main/java/org/apache/accumulo/server/constraints/MetadataConstraints.java
    accumulo/branches/ACCUMULO-722/1.5/server/src/main/java/org/apache/accumulo/server/master/Master.java
    accumulo/branches/ACCUMULO-722/1.5/server/src/main/java/org/apache/accumulo/server/security/ZKAuthenticator.java
    accumulo/branches/ACCUMULO-722/1.5/server/src/main/java/org/apache/accumulo/server/util/Initialize.java
    accumulo/branches/ACCUMULO-722/1.5/server/src/test/java/org/apache/accumulo/server/constraints/MetadataConstraintsTest.java

Modified: accumulo/branches/ACCUMULO-722/1.5/core/src/main/java/org/apache/accumulo/core/Constants.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-722/1.5/core/src/main/java/org/apache/accumulo/core/Constants.java?rev=1383486&r1=1383485&r2=1383486&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-722/1.5/core/src/main/java/org/apache/accumulo/core/Constants.java
(original)
+++ accumulo/branches/ACCUMULO-722/1.5/core/src/main/java/org/apache/accumulo/core/Constants.java
Tue Sep 11 17:28:51 2012
@@ -37,7 +37,7 @@ public class Constants {
   public static final String ZINSTANCES = "/instances";
   
   public static final String ZTABLES = "/tables";
-  public static final byte[] ZTABLES_INITIAL_ID = new byte[] {'3'};
+  public static final byte[] ZTABLES_INITIAL_ID = new byte[] {'0'};
   public static final String ZTABLE_NAME = "/name";
   public static final String ZTABLE_CONF = "/conf";
   public static final String ZTABLE_STATE = "/state";

Modified: accumulo/branches/ACCUMULO-722/1.5/core/src/main/java/org/apache/accumulo/core/data/KeyExtent.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-722/1.5/core/src/main/java/org/apache/accumulo/core/data/KeyExtent.java?rev=1383486&r1=1383485&r2=1383486&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-722/1.5/core/src/main/java/org/apache/accumulo/core/data/KeyExtent.java
(original)
+++ accumulo/branches/ACCUMULO-722/1.5/core/src/main/java/org/apache/accumulo/core/data/KeyExtent.java
Tue Sep 11 17:28:51 2012
@@ -53,7 +53,7 @@ public class KeyExtent implements Writab
   private static WeakHashMap<Text,WeakReference<Text>> tableIds = new WeakHashMap<Text,WeakReference<Text>>();
   static private final Set<Text> METASET = new HashSet<Text>();
   static {
-    for (String id : "!0,0,1,2".split(","))
+    for (String id : "!0,!1,!2,!3".split(","))
       METASET.add(new Text(id));
   }
   

Modified: accumulo/branches/ACCUMULO-722/1.5/pom.xml
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-722/1.5/pom.xml?rev=1383486&r1=1383485&r2=1383486&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-722/1.5/pom.xml (original)
+++ accumulo/branches/ACCUMULO-722/1.5/pom.xml Tue Sep 11 17:28:51 2012
@@ -496,7 +496,7 @@
       <dependency>
         <groupId>org.mortbay.jetty</groupId>
         <artifactId>jetty</artifactId>
-        <version>[5.1,)</version>
+        <version>[5.1,7.0)</version>
         <scope>provided</scope>
       </dependency>
 

Modified: accumulo/branches/ACCUMULO-722/1.5/server/src/main/java/org/apache/accumulo/server/constraints/MetadataConstraints.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-722/1.5/server/src/main/java/org/apache/accumulo/server/constraints/MetadataConstraints.java?rev=1383486&r1=1383485&r2=1383486&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-722/1.5/server/src/main/java/org/apache/accumulo/server/constraints/MetadataConstraints.java
(original)
+++ accumulo/branches/ACCUMULO-722/1.5/server/src/main/java/org/apache/accumulo/server/constraints/MetadataConstraints.java
Tue Sep 11 17:28:51 2012
@@ -119,9 +119,8 @@ public class MetadataConstraints impleme
           violations.add((short) 4);
       }
     }
-    
     if (row.length > 0 && row[0] == '!') {
-      if (row.length < 3 || row[1] != '0' || (row[2] != '<' && row[2] != ';'))
{
+      if (row.length < 3 || row[1] < '0' || row[1] > '3' || (row[2] != '<' &&
row[2] != ';')) {
         if (violations == null)
           violations = new ArrayList<Short>();
         if (!violations.contains((short) 4))

Modified: accumulo/branches/ACCUMULO-722/1.5/server/src/main/java/org/apache/accumulo/server/master/Master.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-722/1.5/server/src/main/java/org/apache/accumulo/server/master/Master.java?rev=1383486&r1=1383485&r2=1383486&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-722/1.5/server/src/main/java/org/apache/accumulo/server/master/Master.java
(original)
+++ accumulo/branches/ACCUMULO-722/1.5/server/src/main/java/org/apache/accumulo/server/master/Master.java
Tue Sep 11 17:28:51 2012
@@ -391,7 +391,11 @@ public class Master implements LiveTServ
   }
   
   private int nonMetaDataTabletsAssignedOrHosted() {
-    return totalAssignedOrHosted() - assignedOrHosted(new Text(Constants.METADATA_TABLE_ID));
+    int metaTablets = assignedOrHosted(new Text(Constants.METADATA_TABLE_ID));
+    metaTablets += assignedOrHosted(new Text("!1"));
+    metaTablets += assignedOrHosted(new Text("!2"));
+    metaTablets += assignedOrHosted(new Text("!3"));
+    return totalAssignedOrHosted() - metaTablets;
   }
   
   private int notHosted() {
@@ -424,7 +428,7 @@ public class Master implements LiveTServ
         }
         break;
       case SAFE_MODE:
-        // Count offline tablets for the METADATA table
+        // Count offline tablets for the METADATA tables
         for (TabletGroupWatcher watcher : watchers) {
           result += watcher.getStats(meta).unassigned();
         }

Modified: accumulo/branches/ACCUMULO-722/1.5/server/src/main/java/org/apache/accumulo/server/security/ZKAuthenticator.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-722/1.5/server/src/main/java/org/apache/accumulo/server/security/ZKAuthenticator.java?rev=1383486&r1=1383485&r2=1383486&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-722/1.5/server/src/main/java/org/apache/accumulo/server/security/ZKAuthenticator.java
(original)
+++ accumulo/branches/ACCUMULO-722/1.5/server/src/main/java/org/apache/accumulo/server/security/ZKAuthenticator.java
Tue Sep 11 17:28:51 2012
@@ -132,7 +132,7 @@ public final class ZKAuthenticator imple
         Map<String,Set<TablePermission>> tablePerms = new HashMap<String,Set<TablePermission>>();
         // Allow the root user to flush the !METADATA table
         tablePerms.put(Constants.METADATA_TABLE_ID, Collections.singleton(TablePermission.ALTER_TABLE));
-        for (String other : "0,1,2".split(",")) {
+        for (String other : "!1,!2,!3".split(",")) {
           tablePerms.put(other, new HashSet<TablePermission>(Arrays.asList(TablePermission.ALTER_TABLE,TablePermission.READ,
TablePermission.WRITE)));
         }
         constructUser(rootuser, Tool.createPass(rootpass), rootPerms, tablePerms, Constants.NO_AUTHS);

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=1383486&r1=1383485&r2=1383486&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
Tue Sep 11 17:28:51 2012
@@ -317,7 +317,7 @@ public class Initialize {
       mfw = FileOperations.getInstance().openWriter(defaultTabletFile, fs, conf, AccumuloConfiguration.getDefaultConfiguration());
       mfw.startDefaultLocalityGroup();
       Map<Key, Value> defaultData = new TreeMap<Key, Value>();
-      String ids[] = "0,1,2".split(",");
+      String ids[] = "!1,!2,!3".split(",");
       long now = System.currentTimeMillis();
       for (int i = 0; i < ids.length; i++) {
         Text extent = new Text(KeyExtent.getMetadataEntry(new Text(ids[i]), null));
@@ -330,7 +330,7 @@ public class Initialize {
         fs.mkdirs(new Path(ServerConstants.getTablesDir() + "/" + ids[i] + Constants.DEFAULT_TABLET_LOCATION));
       }
       // Add the file entry for the namespace root entry
-      Text extent = new Text(KeyExtent.getMetadataEntry(new Text("0"), null));
+      Text extent = new Text(KeyExtent.getMetadataEntry(new Text("!1"), null));
       String rootNSFile = Constants.DEFAULT_TABLET_LOCATION + "/00000_00002." + suffix;
       defaultData.put(new Key(extent, Constants.METADATA_DATAFILE_COLUMN_FAMILY, new Text(rootNSFile),
0), new Value("1,0".getBytes()));
       for (Entry<Key,Value> entry : defaultData.entrySet()) {
@@ -339,12 +339,12 @@ public class Initialize {
       mfw.close();
       
       // write out the namespace data for / in the DistributedNameNode 
-      String rootNSDataFile = ServerConstants.getTablesDir() + "/0" + rootNSFile;
+      String rootNSDataFile = ServerConstants.getTablesDir() + "/!1" + rootNSFile;
       mfw = FileOperations.getInstance().openWriter(rootNSDataFile, fs, conf, AccumuloConfiguration.getDefaultConfiguration());
       mfw.startDefaultLocalityGroup();
       Text infoFam = new Text("info");
-      mfw.append(new Key(new Text("/"), infoFam, new Text("create_time"), now), new Value(Long.toString(now).getBytes()));
       mfw.append(new Key(new Text("/"), infoFam, new Text("isDir"), now), new Value("Y".getBytes()));
+      mfw.append(new Key(new Text("/"), infoFam, new Text("mtime"), now), new Value(Long.toString(now).getBytes()));
       mfw.close();
     }
     
@@ -411,10 +411,10 @@ public class Initialize {
     ZooReaderWriter.getInstance().putPersistentData(zkInstanceRoot, new byte[0], NodeExistsPolicy.FAIL);
     ZooReaderWriter.getInstance().putPersistentData(zkInstanceRoot + Constants.ZTABLES, Constants.ZTABLES_INITIAL_ID,
NodeExistsPolicy.FAIL);
     TableManager.prepareNewTableState(uuid, Constants.METADATA_TABLE_ID, Constants.METADATA_TABLE_NAME,
TableState.ONLINE, NodeExistsPolicy.FAIL);
-    TableManager.prepareNewTableState(uuid, "0", "namespace", TableState.ONLINE, NodeExistsPolicy.FAIL);
-    TableManager.prepareNewTableState(uuid, "1", "blocks", TableState.ONLINE, NodeExistsPolicy.FAIL);
-    TableManager.prepareNewTableState(uuid, "2", "datanodes", TableState.ONLINE, NodeExistsPolicy.FAIL);
-    for (String tableId  :"0,1,2".split(",")) {
+    TableManager.prepareNewTableState(uuid, "!1", "namespace", TableState.ONLINE, NodeExistsPolicy.FAIL);
+    TableManager.prepareNewTableState(uuid, "!2", "blocks", TableState.ONLINE, NodeExistsPolicy.FAIL);
+    TableManager.prepareNewTableState(uuid, "!3", "datanodes", TableState.ONLINE, NodeExistsPolicy.FAIL);
+    for (String tableId  :"!1,!2,!3".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);

Modified: accumulo/branches/ACCUMULO-722/1.5/server/src/test/java/org/apache/accumulo/server/constraints/MetadataConstraintsTest.java
URL: http://svn.apache.org/viewvc/accumulo/branches/ACCUMULO-722/1.5/server/src/test/java/org/apache/accumulo/server/constraints/MetadataConstraintsTest.java?rev=1383486&r1=1383485&r2=1383486&view=diff
==============================================================================
--- accumulo/branches/ACCUMULO-722/1.5/server/src/test/java/org/apache/accumulo/server/constraints/MetadataConstraintsTest.java
(original)
+++ accumulo/branches/ACCUMULO-722/1.5/server/src/test/java/org/apache/accumulo/server/constraints/MetadataConstraintsTest.java
Tue Sep 11 17:28:51 2012
@@ -102,6 +102,13 @@ public class MetadataConstraintsTest {
     
     violations = mc.check(null, m);
     
+    assertEquals(null, violations);
+    
+    m = new Mutation(new Text("!7<"));
+    Constants.METADATA_PREV_ROW_COLUMN.put(m, new Value("bar".getBytes()));
+    
+    violations = mc.check(null, m);
+    
     assertNotNull(violations);
     assertEquals(1, violations.size());
     assertEquals(Short.valueOf((short) 4), violations.get(0));



Mime
View raw message