accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject [57/61] [abbrv] accumulo git commit: ACCUMULO-722: make all the special tables start with an exclaimation mark
Date Thu, 03 Mar 2016 22:00:22 GMT
ACCUMULO-722: make all the special tables start with an exclaimation mark

git-svn-id: https://svn.apache.org/repos/asf/accumulo/branches/ACCUMULO-722@1383486 13f79535-47bb-0310-9956-ffa450edef68


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/f42e4365
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/f42e4365
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/f42e4365

Branch: refs/heads/ACCUMULO-722
Commit: f42e43655459cafa6b84dc66ec47d607173ecd26
Parents: 11546ee
Author: Eric C. Newton <ecn@apache.org>
Authored: Tue Sep 11 17:28:51 2012 +0000
Committer: Eric C. Newton <ecn@apache.org>
Committed: Tue Sep 11 17:28:51 2012 +0000

----------------------------------------------------------------------
 .../java/org/apache/accumulo/core/Constants.java    |  2 +-
 .../org/apache/accumulo/core/data/KeyExtent.java    |  2 +-
 1.5/pom.xml                                         |  2 +-
 .../server/constraints/MetadataConstraints.java     |  3 +--
 .../org/apache/accumulo/server/master/Master.java   |  8 ++++++--
 .../accumulo/server/security/ZKAuthenticator.java   |  2 +-
 .../org/apache/accumulo/server/util/Initialize.java | 16 ++++++++--------
 .../server/constraints/MetadataConstraintsTest.java |  7 +++++++
 8 files changed, 26 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/f42e4365/1.5/core/src/main/java/org/apache/accumulo/core/Constants.java
----------------------------------------------------------------------
diff --git a/1.5/core/src/main/java/org/apache/accumulo/core/Constants.java b/1.5/core/src/main/java/org/apache/accumulo/core/Constants.java
index e100135..06247a8 100644
--- a/1.5/core/src/main/java/org/apache/accumulo/core/Constants.java
+++ b/1.5/core/src/main/java/org/apache/accumulo/core/Constants.java
@@ -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";

http://git-wip-us.apache.org/repos/asf/accumulo/blob/f42e4365/1.5/core/src/main/java/org/apache/accumulo/core/data/KeyExtent.java
----------------------------------------------------------------------
diff --git a/1.5/core/src/main/java/org/apache/accumulo/core/data/KeyExtent.java b/1.5/core/src/main/java/org/apache/accumulo/core/data/KeyExtent.java
index 72557c6..76e619e 100644
--- a/1.5/core/src/main/java/org/apache/accumulo/core/data/KeyExtent.java
+++ b/1.5/core/src/main/java/org/apache/accumulo/core/data/KeyExtent.java
@@ -53,7 +53,7 @@ public class KeyExtent implements WritableComparable<KeyExtent> {
   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));
   }
   

http://git-wip-us.apache.org/repos/asf/accumulo/blob/f42e4365/1.5/pom.xml
----------------------------------------------------------------------
diff --git a/1.5/pom.xml b/1.5/pom.xml
index 88c4e2e..059ea7a 100644
--- a/1.5/pom.xml
+++ b/1.5/pom.xml
@@ -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>
 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/f42e4365/1.5/server/src/main/java/org/apache/accumulo/server/constraints/MetadataConstraints.java
----------------------------------------------------------------------
diff --git a/1.5/server/src/main/java/org/apache/accumulo/server/constraints/MetadataConstraints.java
b/1.5/server/src/main/java/org/apache/accumulo/server/constraints/MetadataConstraints.java
index bd19d1f..d3142f2 100644
--- a/1.5/server/src/main/java/org/apache/accumulo/server/constraints/MetadataConstraints.java
+++ b/1.5/server/src/main/java/org/apache/accumulo/server/constraints/MetadataConstraints.java
@@ -119,9 +119,8 @@ public class MetadataConstraints implements Constraint {
           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))

http://git-wip-us.apache.org/repos/asf/accumulo/blob/f42e4365/1.5/server/src/main/java/org/apache/accumulo/server/master/Master.java
----------------------------------------------------------------------
diff --git a/1.5/server/src/main/java/org/apache/accumulo/server/master/Master.java b/1.5/server/src/main/java/org/apache/accumulo/server/master/Master.java
index 8dc1386..8b6e26e 100644
--- a/1.5/server/src/main/java/org/apache/accumulo/server/master/Master.java
+++ b/1.5/server/src/main/java/org/apache/accumulo/server/master/Master.java
@@ -391,7 +391,11 @@ public class Master implements LiveTServerSet.Listener, TableObserver,
CurrentSt
   }
   
   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 LiveTServerSet.Listener, TableObserver,
CurrentSt
         }
         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();
         }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/f42e4365/1.5/server/src/main/java/org/apache/accumulo/server/security/ZKAuthenticator.java
----------------------------------------------------------------------
diff --git a/1.5/server/src/main/java/org/apache/accumulo/server/security/ZKAuthenticator.java
b/1.5/server/src/main/java/org/apache/accumulo/server/security/ZKAuthenticator.java
index 7a77f99..84ef3e4 100644
--- a/1.5/server/src/main/java/org/apache/accumulo/server/security/ZKAuthenticator.java
+++ b/1.5/server/src/main/java/org/apache/accumulo/server/security/ZKAuthenticator.java
@@ -132,7 +132,7 @@ public final class ZKAuthenticator implements Authenticator {
         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);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/f42e4365/1.5/server/src/main/java/org/apache/accumulo/server/util/Initialize.java
----------------------------------------------------------------------
diff --git a/1.5/server/src/main/java/org/apache/accumulo/server/util/Initialize.java b/1.5/server/src/main/java/org/apache/accumulo/server/util/Initialize.java
index d7a7ad7..051889b 100644
--- a/1.5/server/src/main/java/org/apache/accumulo/server/util/Initialize.java
+++ b/1.5/server/src/main/java/org/apache/accumulo/server/util/Initialize.java
@@ -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);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/f42e4365/1.5/server/src/test/java/org/apache/accumulo/server/constraints/MetadataConstraintsTest.java
----------------------------------------------------------------------
diff --git a/1.5/server/src/test/java/org/apache/accumulo/server/constraints/MetadataConstraintsTest.java
b/1.5/server/src/test/java/org/apache/accumulo/server/constraints/MetadataConstraintsTest.java
index a7f72a5..d223704 100644
--- a/1.5/server/src/test/java/org/apache/accumulo/server/constraints/MetadataConstraintsTest.java
+++ b/1.5/server/src/test/java/org/apache/accumulo/server/constraints/MetadataConstraintsTest.java
@@ -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