accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ktur...@apache.org
Subject [accumulo] branch master updated: Inlined KeyExtent.getMetadataEntry
Date Wed, 05 Dec 2018 20:02:43 GMT
This is an automated email from the ASF dual-hosted git repository.

kturner pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/master by this push:
     new 787ae13  Inlined KeyExtent.getMetadataEntry
787ae13 is described below

commit 787ae13841d6b3540cded5fb6464632d2a8ce732
Author: Keith Turner <kturner@apache.org>
AuthorDate: Wed Dec 5 15:02:35 2018 -0500

    Inlined KeyExtent.getMetadataEntry
---
 .../main/java/org/apache/accumulo/core/dataImpl/KeyExtent.java   | 9 ++-------
 .../main/java/org/apache/accumulo/core/metadata/RootTable.java   | 3 ++-
 .../apache/accumulo/core/metadata/schema/LinkingIterator.java    | 5 ++---
 .../test/java/org/apache/accumulo/core/file/rfile/RFileTest.java | 4 ++--
 .../main/java/org/apache/accumulo/server/init/Initialize.java    | 2 +-
 .../java/org/apache/accumulo/server/util/MasterMetadataUtil.java | 2 +-
 .../java/org/apache/accumulo/server/util/MetadataTableUtil.java  | 4 ++--
 .../main/java/org/apache/accumulo/master/TabletGroupWatcher.java | 8 ++++----
 .../main/java/org/apache/accumulo/master/state/MergeStats.java   | 3 ++-
 .../org/apache/accumulo/monitor/rest/tables/TablesResource.java  | 6 +++---
 .../main/java/org/apache/accumulo/test/QueryMetadataTable.java   | 2 +-
 .../org/apache/accumulo/test/functional/MasterAssignmentIT.java  | 4 ++--
 12 files changed, 24 insertions(+), 28 deletions(-)

diff --git a/core/src/main/java/org/apache/accumulo/core/dataImpl/KeyExtent.java b/core/src/main/java/org/apache/accumulo/core/dataImpl/KeyExtent.java
index f4b3568..2d88103 100644
--- a/core/src/main/java/org/apache/accumulo/core/dataImpl/KeyExtent.java
+++ b/core/src/main/java/org/apache/accumulo/core/dataImpl/KeyExtent.java
@@ -43,7 +43,6 @@ import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.dataImpl.thrift.TKeyExtent;
 import org.apache.accumulo.core.metadata.MetadataTable;
 import org.apache.accumulo.core.metadata.RootTable;
-import org.apache.accumulo.core.metadata.schema.MetadataSchema;
 import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection;
 import org.apache.accumulo.core.util.ByteBufferUtil;
 import org.apache.accumulo.core.util.TextUtil;
@@ -119,11 +118,7 @@ public class KeyExtent implements WritableComparable<KeyExtent>
{
    *
    */
   public Text getMetadataEntry() {
-    return getMetadataEntry(getTableId(), getEndRow());
-  }
-
-  public static Text getMetadataEntry(Table.ID tableId, Text endRow) {
-    return MetadataSchema.TabletsSection.getRow(tableId, endRow);
+    return TabletsSection.getRow(getTableId(), getEndRow());
   }
 
   // constructor for loading extents from metadata rows
@@ -642,7 +637,7 @@ public class KeyExtent implements WritableComparable<KeyExtent>
{
   }
 
   public static Text getMetadataEntry(KeyExtent extent) {
-    return getMetadataEntry(extent.getTableId(), extent.getEndRow());
+    return TabletsSection.getRow(extent.getTableId(), extent.getEndRow());
   }
 
   public TKeyExtent toThrift() {
diff --git a/core/src/main/java/org/apache/accumulo/core/metadata/RootTable.java b/core/src/main/java/org/apache/accumulo/core/metadata/RootTable.java
index 8014c8c..90f3642 100644
--- a/core/src/main/java/org/apache/accumulo/core/metadata/RootTable.java
+++ b/core/src/main/java/org/apache/accumulo/core/metadata/RootTable.java
@@ -19,6 +19,7 @@ package org.apache.accumulo.core.metadata;
 import org.apache.accumulo.core.clientImpl.Namespace;
 import org.apache.accumulo.core.clientImpl.Table;
 import org.apache.accumulo.core.dataImpl.KeyExtent;
+import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection;
 
 public class RootTable {
 
@@ -43,6 +44,6 @@ public class RootTable {
 
   public static final KeyExtent EXTENT = new KeyExtent(ID, null, null);
   public static final KeyExtent OLD_EXTENT = new KeyExtent(MetadataTable.ID,
-      KeyExtent.getMetadataEntry(MetadataTable.ID, null), null);
+      TabletsSection.getRow(MetadataTable.ID, null), null);
 
 }
diff --git a/core/src/main/java/org/apache/accumulo/core/metadata/schema/LinkingIterator.java
b/core/src/main/java/org/apache/accumulo/core/metadata/schema/LinkingIterator.java
index 0866633..d12e34c 100644
--- a/core/src/main/java/org/apache/accumulo/core/metadata/schema/LinkingIterator.java
+++ b/core/src/main/java/org/apache/accumulo/core/metadata/schema/LinkingIterator.java
@@ -26,7 +26,7 @@ import java.util.function.Function;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.PartialKey;
 import org.apache.accumulo.core.data.Range;
-import org.apache.accumulo.core.dataImpl.KeyExtent;
+import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection;
 import org.apache.hadoop.io.Text;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -104,8 +104,7 @@ public class LinkingIterator implements Iterator<TabletMetadata>
{
       source = iteratorFactory.apply(range);
     } else {
       // get the metadata table row for the previous tablet
-      Text prevMetaRow = KeyExtent.getMetadataEntry(prevTablet.getTableId(),
-          prevTablet.getEndRow());
+      Text prevMetaRow = TabletsSection.getRow(prevTablet.getTableId(), prevTablet.getEndRow());
 
       // ensure the previous tablet still exists in the metadata table
       if (Iterators.size(iteratorFactory.apply(new Range(prevMetaRow))) == 0) {
diff --git a/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java b/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java
index 40f728a..f8d1f34 100644
--- a/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/file/rfile/RFileTest.java
@@ -2322,7 +2322,7 @@ public class RFileTest {
 
     // mfw.startDefaultLocalityGroup();
 
-    Text tableExtent = new Text(KeyExtent.getMetadataEntry(MetadataTable.ID,
+    Text tableExtent = new Text(TabletsSection.getRow(MetadataTable.ID,
         MetadataSchema.TabletsSection.getRange().getEndKey().getRow()));
 
     // table tablet's directory
@@ -2344,7 +2344,7 @@ public class RFileTest {
     mfw.append(tablePrevRowKey, KeyExtent.encodePrevEndRow(null));
 
     // ----------] default tablet info
-    Text defaultExtent = new Text(KeyExtent.getMetadataEntry(MetadataTable.ID, null));
+    Text defaultExtent = new Text(TabletsSection.getRow(MetadataTable.ID, null));
 
     // default's directory
     Key defaultDirKey = new Key(defaultExtent,
diff --git a/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java b/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java
index 805efa1..8499f56 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java
@@ -560,7 +560,7 @@ public class Initialize implements KeywordExecutable {
 
   private static void createEntriesForTablet(TreeMap<Key,Value> map, Tablet tablet)
{
     Value EMPTY_SIZE = new DataFileValue(0, 0).encodeAsValue();
-    Text extent = new Text(KeyExtent.getMetadataEntry(tablet.tableId, tablet.endRow));
+    Text extent = new Text(TabletsSection.getRow(tablet.tableId, tablet.endRow));
     addEntry(map, extent, DIRECTORY_COLUMN, new Value(tablet.dir.getBytes(UTF_8)));
     addEntry(map, extent, TIME_COLUMN,
         new Value((TabletTime.LOGICAL_TIME_ID + "0").getBytes(UTF_8)));
diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/MasterMetadataUtil.java
b/server/base/src/main/java/org/apache/accumulo/server/util/MasterMetadataUtil.java
index c78bbb2..f7739a7 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/util/MasterMetadataUtil.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/MasterMetadataUtil.java
@@ -155,7 +155,7 @@ public class MasterMetadataUtil {
           "Split tablet does not have prev end row, something is amiss, extent = " + metadataEntry);
 
     // check to see if prev tablet exist in metadata tablet
-    Key prevRowKey = new Key(new Text(KeyExtent.getMetadataEntry(tableId, metadataPrevEndRow)));
+    Key prevRowKey = new Key(new Text(TabletsSection.getRow(tableId, metadataPrevEndRow)));
 
     try (ScannerImpl scanner2 = new ScannerImpl(context, MetadataTable.ID, Authorizations.EMPTY))
{
       scanner2.setRange(new Range(prevRowKey, prevRowKey.followingKey(PartialKey.ROW)));
diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/MetadataTableUtil.java
b/server/base/src/main/java/org/apache/accumulo/server/util/MetadataTableUtil.java
index 5befb65..f816f0c 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/util/MetadataTableUtil.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/MetadataTableUtil.java
@@ -726,7 +726,7 @@ public class MetadataTableUtil {
       Map<Key,Value> tablet) {
 
     KeyExtent ke = new KeyExtent(tablet.keySet().iterator().next().getRow(), (Text) null);
-    Mutation m = new Mutation(KeyExtent.getMetadataEntry(tableId, ke.getEndRow()));
+    Mutation m = new Mutation(TabletsSection.getRow(tableId, ke.getEndRow()));
 
     for (Entry<Key,Value> entry : tablet.entrySet()) {
       if (entry.getKey().getColumnFamily().equals(DataFileColumnFamily.NAME)) {
@@ -1044,7 +1044,7 @@ public class MetadataTableUtil {
         ServerConstants.getBaseUris(context.getConfiguration())) + Constants.HDFS_TABLES_DIR
         + Path.SEPARATOR + ReplicationTable.ID + Constants.DEFAULT_TABLET_LOCATION;
 
-    Mutation m = new Mutation(new Text(KeyExtent.getMetadataEntry(ReplicationTable.ID, null)));
+    Mutation m = new Mutation(new Text(TabletsSection.getRow(ReplicationTable.ID, null)));
     m.put(DIRECTORY_COLUMN.getColumnFamily(), DIRECTORY_COLUMN.getColumnQualifier(), 0,
         new Value(dir.getBytes(UTF_8)));
     m.put(TIME_COLUMN.getColumnFamily(), TIME_COLUMN.getColumnQualifier(), 0,
diff --git a/server/master/src/main/java/org/apache/accumulo/master/TabletGroupWatcher.java
b/server/master/src/main/java/org/apache/accumulo/master/TabletGroupWatcher.java
index bc1cb33..9cb447c 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/TabletGroupWatcher.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/TabletGroupWatcher.java
@@ -604,8 +604,8 @@ abstract class TabletGroupWatcher extends Daemon {
         start = new Text();
       }
       Master.log.debug("Making file deletion entries for {}", extent);
-      Range deleteRange = new Range(KeyExtent.getMetadataEntry(extent.getTableId(), start),
false,
-          KeyExtent.getMetadataEntry(extent.getTableId(), extent.getEndRow()), true);
+      Range deleteRange = new Range(TabletsSection.getRow(extent.getTableId(), start), false,
+          TabletsSection.getRow(extent.getTableId(), extent.getEndRow()), true);
       Scanner scanner = client.createScanner(targetSystemTable, Authorizations.EMPTY);
       scanner.setRange(deleteRange);
       TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.fetch(scanner);
@@ -694,8 +694,8 @@ abstract class TabletGroupWatcher extends Daemon {
     if (start == null) {
       start = new Text();
     }
-    Range scanRange = new Range(KeyExtent.getMetadataEntry(range.getTableId(), start), false,
-        stopRow, false);
+    Range scanRange = new Range(TabletsSection.getRow(range.getTableId(), start), false,
stopRow,
+        false);
     String targetSystemTable = MetadataTable.NAME;
     if (range.isMeta()) {
       targetSystemTable = RootTable.NAME;
diff --git a/server/master/src/main/java/org/apache/accumulo/master/state/MergeStats.java
b/server/master/src/main/java/org/apache/accumulo/master/state/MergeStats.java
index 7df19c4..a462226 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/state/MergeStats.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/state/MergeStats.java
@@ -32,6 +32,7 @@ import org.apache.accumulo.core.dataImpl.KeyExtent;
 import org.apache.accumulo.core.metadata.MetadataTable;
 import org.apache.accumulo.core.metadata.RootTable;
 import org.apache.accumulo.core.metadata.schema.MetadataSchema;
+import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection;
 import org.apache.accumulo.core.security.Authorizations;
 import org.apache.accumulo.fate.zookeeper.ZooReaderWriter;
 import org.apache.accumulo.fate.zookeeper.ZooUtil;
@@ -197,7 +198,7 @@ public class MergeStats {
       start = new Text();
     }
     Table.ID tableId = extent.getTableId();
-    Text first = KeyExtent.getMetadataEntry(tableId, start);
+    Text first = TabletsSection.getRow(tableId, start);
     Range range = new Range(first, false, null, true);
     scanner.setRange(range.clip(MetadataSchema.TabletsSection.getRange()));
     KeyExtent prevExtent = null;
diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tables/TablesResource.java
b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tables/TablesResource.java
index 6871642..a01dca2 100644
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tables/TablesResource.java
+++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/rest/tables/TablesResource.java
@@ -36,12 +36,12 @@ import javax.ws.rs.core.MediaType;
 import org.apache.accumulo.core.clientImpl.Table;
 import org.apache.accumulo.core.clientImpl.Tables;
 import org.apache.accumulo.core.data.Range;
-import org.apache.accumulo.core.dataImpl.KeyExtent;
 import org.apache.accumulo.core.master.state.tables.TableState;
 import org.apache.accumulo.core.master.thrift.TableInfo;
 import org.apache.accumulo.core.master.thrift.TabletServerStatus;
 import org.apache.accumulo.core.metadata.MetadataTable;
 import org.apache.accumulo.core.metadata.RootTable;
+import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection;
 import org.apache.accumulo.monitor.Monitor;
 import org.apache.accumulo.monitor.rest.tservers.TabletServer;
 import org.apache.accumulo.monitor.rest.tservers.TabletServers;
@@ -130,8 +130,8 @@ public class TablesResource {
       String systemTableName = MetadataTable.ID.equals(tableId) ? RootTable.NAME
           : MetadataTable.NAME;
       MetaDataTableScanner scanner = new MetaDataTableScanner(Monitor.getContext(),
-          new Range(KeyExtent.getMetadataEntry(tableId, new Text()),
-              KeyExtent.getMetadataEntry(tableId, null)),
+          new Range(TabletsSection.getRow(tableId, new Text()),
+              TabletsSection.getRow(tableId, null)),
           systemTableName);
 
       while (scanner.hasNext()) {
diff --git a/test/src/main/java/org/apache/accumulo/test/QueryMetadataTable.java b/test/src/main/java/org/apache/accumulo/test/QueryMetadataTable.java
index 6e3215f..4c4a155 100644
--- a/test/src/main/java/org/apache/accumulo/test/QueryMetadataTable.java
+++ b/test/src/main/java/org/apache/accumulo/test/QueryMetadataTable.java
@@ -107,7 +107,7 @@ public class QueryMetadataTable {
 
     try (Scanner scanner = accumuloClient.createScanner(MetadataTable.NAME, opts.auths))
{
       scanner.setBatchSize(scanOpts.scanBatchSize);
-      Text mdrow = new Text(KeyExtent.getMetadataEntry(MetadataTable.ID, null));
+      Text mdrow = new Text(TabletsSection.getRow(MetadataTable.ID, null));
 
       for (Entry<Key,Value> entry : scanner) {
         System.out.print(".");
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/MasterAssignmentIT.java
b/test/src/main/java/org/apache/accumulo/test/functional/MasterAssignmentIT.java
index 78f947d..063edc3 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/MasterAssignmentIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/MasterAssignmentIT.java
@@ -29,7 +29,7 @@ import org.apache.accumulo.core.clientImpl.ClientContext;
 import org.apache.accumulo.core.clientImpl.Table;
 import org.apache.accumulo.core.data.Mutation;
 import org.apache.accumulo.core.data.Range;
-import org.apache.accumulo.core.dataImpl.KeyExtent;
+import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection;
 import org.apache.accumulo.fate.util.UtilWaitThread;
 import org.apache.accumulo.harness.AccumuloClusterHarness;
 import org.apache.accumulo.server.master.state.MetaDataTableScanner;
@@ -93,7 +93,7 @@ public class MasterAssignmentIT extends AccumuloClusterHarness {
       throws FileNotFoundException, ConfigurationException {
     ClientContext context = getClientContext();
     try (MetaDataTableScanner s = new MetaDataTableScanner(context,
-        new Range(KeyExtent.getMetadataEntry(Table.ID.of(tableId), null)))) {
+        new Range(TabletsSection.getRow(Table.ID.of(tableId), null)))) {
       return s.next();
     }
   }


Mime
View raw message