You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ct...@apache.org on 2013/07/17 04:33:11 UTC
[09/50] [abbrv] ACCUMULO-1481 : Add tests for splitting/merging root
table;
refactor to consolidate metadata constants and structures in an organized way;
begin consolidating metadata ops into a servicer interface to abstract the
code that actually does
http://git-wip-us.apache.org/repos/asf/accumulo/blob/446a37a9/server/src/test/java/org/apache/accumulo/server/iterators/MetadataBulkLoadFilterTest.java
----------------------------------------------------------------------
diff --git a/server/src/test/java/org/apache/accumulo/server/iterators/MetadataBulkLoadFilterTest.java b/server/src/test/java/org/apache/accumulo/server/iterators/MetadataBulkLoadFilterTest.java
index 79f8ec4..eb98e0c 100644
--- a/server/src/test/java/org/apache/accumulo/server/iterators/MetadataBulkLoadFilterTest.java
+++ b/server/src/test/java/org/apache/accumulo/server/iterators/MetadataBulkLoadFilterTest.java
@@ -21,8 +21,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.TreeMap;
-import org.junit.Assert;
-
import org.apache.accumulo.core.conf.AccumuloConfiguration;
import org.apache.accumulo.core.data.ByteSequence;
import org.apache.accumulo.core.data.Key;
@@ -32,10 +30,12 @@ import org.apache.accumulo.core.iterators.IteratorEnvironment;
import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope;
import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
import org.apache.accumulo.core.iterators.SortedMapIterator;
+import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection;
+import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.DataFileColumnFamily;
import org.apache.accumulo.core.util.ColumnFQ;
-import org.apache.accumulo.core.util.MetadataTable;
import org.apache.accumulo.fate.zookeeper.TransactionWatcher.Arbitrator;
import org.apache.hadoop.io.Text;
+import org.junit.Assert;
import org.junit.Test;
/**
@@ -83,24 +83,24 @@ public class MetadataBulkLoadFilterTest {
TreeMap<Key,Value> expected = new TreeMap<Key,Value>();
// following should not be deleted by filter
- put(tm1, "2;m", MetadataTable.DIRECTORY_COLUMN, "/t1");
- put(tm1, "2;m", MetadataTable.DATAFILE_COLUMN_FAMILY, "/t1/file1", "1,1");
- put(tm1, "2;m", MetadataTable.BULKFILE_COLUMN_FAMILY, "/t1/file1", "5");
- put(tm1, "2;m", MetadataTable.BULKFILE_COLUMN_FAMILY, "/t1/file3", "7");
- put(tm1, "2;m", MetadataTable.BULKFILE_COLUMN_FAMILY, "/t1/file4", "9");
- put(tm1, "2<", MetadataTable.DIRECTORY_COLUMN, "/t2");
- put(tm1, "2<", MetadataTable.DATAFILE_COLUMN_FAMILY, "/t2/file2", "1,1");
- put(tm1, "2<", MetadataTable.BULKFILE_COLUMN_FAMILY, "/t2/file6", "5");
- put(tm1, "2<", MetadataTable.BULKFILE_COLUMN_FAMILY, "/t2/file7", "7");
- put(tm1, "2<", MetadataTable.BULKFILE_COLUMN_FAMILY, "/t2/file8", "9");
- put(tm1, "2<", MetadataTable.BULKFILE_COLUMN_FAMILY, "/t2/fileC", null);
+ put(tm1, "2;m", TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN, "/t1");
+ put(tm1, "2;m", DataFileColumnFamily.NAME, "/t1/file1", "1,1");
+ put(tm1, "2;m", TabletsSection.BulkFileColumnFamily.NAME, "/t1/file1", "5");
+ put(tm1, "2;m", TabletsSection.BulkFileColumnFamily.NAME, "/t1/file3", "7");
+ put(tm1, "2;m", TabletsSection.BulkFileColumnFamily.NAME, "/t1/file4", "9");
+ put(tm1, "2<", TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN, "/t2");
+ put(tm1, "2<", DataFileColumnFamily.NAME, "/t2/file2", "1,1");
+ put(tm1, "2<", TabletsSection.BulkFileColumnFamily.NAME, "/t2/file6", "5");
+ put(tm1, "2<", TabletsSection.BulkFileColumnFamily.NAME, "/t2/file7", "7");
+ put(tm1, "2<", TabletsSection.BulkFileColumnFamily.NAME, "/t2/file8", "9");
+ put(tm1, "2<", TabletsSection.BulkFileColumnFamily.NAME, "/t2/fileC", null);
expected.putAll(tm1);
-
+
// the following should be deleted by filter
- put(tm1, "2;m", MetadataTable.BULKFILE_COLUMN_FAMILY, "/t1/file5", "8");
- put(tm1, "2<", MetadataTable.BULKFILE_COLUMN_FAMILY, "/t2/file9", "8");
- put(tm1, "2<", MetadataTable.BULKFILE_COLUMN_FAMILY, "/t2/fileA", "2");
+ put(tm1, "2;m", TabletsSection.BulkFileColumnFamily.NAME, "/t1/file5", "8");
+ put(tm1, "2<", TabletsSection.BulkFileColumnFamily.NAME, "/t2/file9", "8");
+ put(tm1, "2<", TabletsSection.BulkFileColumnFamily.NAME, "/t2/fileA", "2");
TestMetadataBulkLoadFilter iter = new TestMetadataBulkLoadFilter();
iter.init(new SortedMapIterator(tm1), new HashMap<String,String>(), new IteratorEnvironment() {
@@ -111,8 +111,7 @@ public class MetadataBulkLoadFilterTest {
}
@Override
- public void registerSideChannel(SortedKeyValueIterator<Key,Value> iter) {
- }
+ public void registerSideChannel(SortedKeyValueIterator<Key,Value> iter) {}
@Override
public boolean isFullMajorCompaction() {
@@ -129,7 +128,7 @@ public class MetadataBulkLoadFilterTest {
return null;
}
});
-
+
iter.seek(new Range(), new ArrayList<ByteSequence>(), false);
TreeMap<Key,Value> actual = new TreeMap<Key,Value>();
http://git-wip-us.apache.org/repos/asf/accumulo/blob/446a37a9/server/src/test/java/org/apache/accumulo/server/master/TestMergeState.java
----------------------------------------------------------------------
diff --git a/server/src/test/java/org/apache/accumulo/server/master/TestMergeState.java b/server/src/test/java/org/apache/accumulo/server/master/TestMergeState.java
index b2f84fa..32c3a33 100644
--- a/server/src/test/java/org/apache/accumulo/server/master/TestMergeState.java
+++ b/server/src/test/java/org/apache/accumulo/server/master/TestMergeState.java
@@ -34,10 +34,12 @@ import org.apache.accumulo.core.data.KeyExtent;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.core.metadata.MetadataTable;
+import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection;
+import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.ChoppedColumnFamily;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.security.CredentialHelper;
import org.apache.accumulo.core.security.thrift.TCredentials;
-import org.apache.accumulo.core.util.MetadataTable;
import org.apache.accumulo.server.master.state.Assignment;
import org.apache.accumulo.server.master.state.CurrentState;
import org.apache.accumulo.server.master.state.MergeInfo;
@@ -101,14 +103,14 @@ public class TestMergeState {
for (String s : splits) {
Text split = new Text(s);
Mutation prevRow = KeyExtent.getPrevRowUpdateMutation(new KeyExtent(tableId, split, pr));
- prevRow.put(MetadataTable.CURRENT_LOCATION_COLUMN_FAMILY, new Text("123456"), new Value("127.0.0.1:1234".getBytes()));
- MetadataTable.CHOPPED_COLUMN.put(prevRow, new Value("junk".getBytes()));
+ prevRow.put(TabletsSection.CurrentLocationColumnFamily.NAME, new Text("123456"), new Value("127.0.0.1:1234".getBytes()));
+ ChoppedColumnFamily.CHOPPED_COLUMN.put(prevRow, new Value("junk".getBytes()));
bw.addMutation(prevRow);
pr = split;
}
// Add the default tablet
Mutation defaultTablet = KeyExtent.getPrevRowUpdateMutation(new KeyExtent(tableId, null, pr));
- defaultTablet.put(MetadataTable.CURRENT_LOCATION_COLUMN_FAMILY, new Text("123456"), new Value("127.0.0.1:1234".getBytes()));
+ defaultTablet.put(TabletsSection.CurrentLocationColumnFamily.NAME, new Text("123456"), new Value("127.0.0.1:1234".getBytes()));
bw.addMutation(defaultTablet);
bw.close();
@@ -128,8 +130,8 @@ public class TestMergeState {
// Create the hole
// Split the tablet at one end of the range
Mutation m = new KeyExtent(tableId, new Text("t"), new Text("p")).getPrevRowUpdateMutation();
- MetadataTable.SPLIT_RATIO_COLUMN.put(m, new Value("0.5".getBytes()));
- MetadataTable.OLD_PREV_ROW_COLUMN.put(m, KeyExtent.encodePrevEndRow(new Text("o")));
+ TabletsSection.TabletColumnFamily.SPLIT_RATIO_COLUMN.put(m, new Value("0.5".getBytes()));
+ TabletsSection.TabletColumnFamily.OLD_PREV_ROW_COLUMN.put(m, KeyExtent.encodePrevEndRow(new Text("o")));
update(connector, m);
// do the state check
@@ -139,7 +141,7 @@ public class TestMergeState {
// unassign the tablets
BatchDeleter deleter = connector.createBatchDeleter("!METADATA", Authorizations.EMPTY, 1000, new BatchWriterConfig());
- deleter.fetchColumnFamily(MetadataTable.CURRENT_LOCATION_COLUMN_FAMILY);
+ deleter.fetchColumnFamily(TabletsSection.CurrentLocationColumnFamily.NAME);
deleter.setRanges(Collections.singletonList(new Range()));
deleter.delete();
@@ -150,7 +152,7 @@ public class TestMergeState {
// finish the split
KeyExtent tablet = new KeyExtent(tableId, new Text("p"), new Text("o"));
m = tablet.getPrevRowUpdateMutation();
- MetadataTable.SPLIT_RATIO_COLUMN.put(m, new Value("0.5".getBytes()));
+ TabletsSection.TabletColumnFamily.SPLIT_RATIO_COLUMN.put(m, new Value("0.5".getBytes()));
update(connector, m);
metaDataStateStore.setLocations(Collections.singletonList(new Assignment(tablet, state.someTServer)));
@@ -160,7 +162,7 @@ public class TestMergeState {
// chop it
m = tablet.getPrevRowUpdateMutation();
- MetadataTable.CHOPPED_COLUMN.put(m, new Value("junk".getBytes()));
+ ChoppedColumnFamily.CHOPPED_COLUMN.put(m, new Value("junk".getBytes()));
update(connector, m);
stats = scan(state, metaDataStateStore);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/446a37a9/server/src/test/java/org/apache/accumulo/server/master/state/RootTabletStateStoreTest.java
----------------------------------------------------------------------
diff --git a/server/src/test/java/org/apache/accumulo/server/master/state/RootTabletStateStoreTest.java b/server/src/test/java/org/apache/accumulo/server/master/state/RootTabletStateStoreTest.java
index b0a9528..a5613ea 100644
--- a/server/src/test/java/org/apache/accumulo/server/master/state/RootTabletStateStoreTest.java
+++ b/server/src/test/java/org/apache/accumulo/server/master/state/RootTabletStateStoreTest.java
@@ -28,8 +28,8 @@ import java.util.HashSet;
import java.util.List;
import org.apache.accumulo.core.data.KeyExtent;
+import org.apache.accumulo.core.metadata.RootTable;
import org.apache.accumulo.core.util.AddressUtil;
-import org.apache.accumulo.core.util.RootTable;
import org.apache.accumulo.server.master.state.TabletLocationState.BadLocationStateException;
import org.apache.hadoop.io.Text;
import org.junit.Assert;
http://git-wip-us.apache.org/repos/asf/accumulo/blob/446a37a9/server/src/test/java/org/apache/accumulo/server/tabletserver/CheckTabletMetadataTest.java
----------------------------------------------------------------------
diff --git a/server/src/test/java/org/apache/accumulo/server/tabletserver/CheckTabletMetadataTest.java b/server/src/test/java/org/apache/accumulo/server/tabletserver/CheckTabletMetadataTest.java
index f475c44..8fe1ea0 100644
--- a/server/src/test/java/org/apache/accumulo/server/tabletserver/CheckTabletMetadataTest.java
+++ b/server/src/test/java/org/apache/accumulo/server/tabletserver/CheckTabletMetadataTest.java
@@ -22,14 +22,13 @@ import java.util.TreeMap;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.KeyExtent;
import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection;
import org.apache.accumulo.core.util.ColumnFQ;
-import org.apache.accumulo.core.util.MetadataTable;
import org.apache.accumulo.server.master.state.TServerInstance;
import org.apache.hadoop.io.Text;
import org.junit.Assert;
import org.junit.Test;
-
public class CheckTabletMetadataTest {
private static Key nk(String row, ColumnFQ cfq) {
@@ -39,7 +38,7 @@ public class CheckTabletMetadataTest {
private static Key nk(String row, Text cf, String cq) {
return new Key(row, cf.toString(), cq);
}
-
+
private static void put(TreeMap<Key,Value> tabletMeta, String row, ColumnFQ cfq, byte[] val) {
Key k = new Key(new Text(row), cfq.getColumnFamily(), cfq.getColumnQualifier());
tabletMeta.put(k, new Value(val));
@@ -49,25 +48,25 @@ public class CheckTabletMetadataTest {
Key k = new Key(new Text(row), cf, new Text(cq));
tabletMeta.put(k, new Value(val.getBytes()));
}
-
+
private static void assertFail(TreeMap<Key,Value> tabletMeta, KeyExtent ke, TServerInstance tsi) {
try {
Assert.assertNull(TabletServer.checkTabletMetadata(ke, tsi, tabletMeta, ke.getMetadataEntry()));
} catch (Exception e) {
-
+
}
}
-
+
private static void assertFail(TreeMap<Key,Value> tabletMeta, KeyExtent ke, TServerInstance tsi, Key keyToDelete) {
TreeMap<Key,Value> copy = new TreeMap<Key,Value>(tabletMeta);
Assert.assertNotNull(copy.remove(keyToDelete));
try {
Assert.assertNull(TabletServer.checkTabletMetadata(ke, tsi, copy, ke.getMetadataEntry()));
} catch (Exception e) {
-
+
}
}
-
+
@Test
public void testBadTabletMetadata() throws Exception {
@@ -75,10 +74,10 @@ public class CheckTabletMetadataTest {
TreeMap<Key,Value> tabletMeta = new TreeMap<Key,Value>();
- put(tabletMeta, "1<", MetadataTable.PREV_ROW_COLUMN, KeyExtent.encodePrevEndRow(null).get());
- put(tabletMeta, "1<", MetadataTable.DIRECTORY_COLUMN, "/t1".getBytes());
- put(tabletMeta, "1<", MetadataTable.TIME_COLUMN, "M0".getBytes());
- put(tabletMeta, "1<", MetadataTable.FUTURE_LOCATION_COLUMN_FAMILY, "4", "127.0.0.1:9997");
+ put(tabletMeta, "1<", TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN, KeyExtent.encodePrevEndRow(null).get());
+ put(tabletMeta, "1<", TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN, "/t1".getBytes());
+ put(tabletMeta, "1<", TabletsSection.ServerColumnFamily.TIME_COLUMN, "M0".getBytes());
+ put(tabletMeta, "1<", TabletsSection.FutureLocationColumnFamily.NAME, "4", "127.0.0.1:9997");
TServerInstance tsi = new TServerInstance("127.0.0.1:9997", 4);
@@ -94,30 +93,30 @@ public class CheckTabletMetadataTest {
assertFail(tabletMeta, new KeyExtent(new Text("1"), new Text("r"), new Text("m")), tsi);
- assertFail(tabletMeta, ke, tsi, nk("1<", MetadataTable.PREV_ROW_COLUMN));
-
- assertFail(tabletMeta, ke, tsi, nk("1<", MetadataTable.DIRECTORY_COLUMN));
+ assertFail(tabletMeta, ke, tsi, nk("1<", TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN));
- assertFail(tabletMeta, ke, tsi, nk("1<", MetadataTable.TIME_COLUMN));
+ assertFail(tabletMeta, ke, tsi, nk("1<", TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN));
- assertFail(tabletMeta, ke, tsi, nk("1<", MetadataTable.FUTURE_LOCATION_COLUMN_FAMILY, "4"));
+ assertFail(tabletMeta, ke, tsi, nk("1<", TabletsSection.ServerColumnFamily.TIME_COLUMN));
+
+ assertFail(tabletMeta, ke, tsi, nk("1<", TabletsSection.FutureLocationColumnFamily.NAME, "4"));
TreeMap<Key,Value> copy = new TreeMap<Key,Value>(tabletMeta);
- put(copy, "1<", MetadataTable.CURRENT_LOCATION_COLUMN_FAMILY, "4", "127.0.0.1:9997");
+ put(copy, "1<", TabletsSection.CurrentLocationColumnFamily.NAME, "4", "127.0.0.1:9997");
assertFail(copy, ke, tsi);
- assertFail(copy, ke, tsi, nk("1<", MetadataTable.FUTURE_LOCATION_COLUMN_FAMILY, "4"));
+ assertFail(copy, ke, tsi, nk("1<", TabletsSection.FutureLocationColumnFamily.NAME, "4"));
copy = new TreeMap<Key,Value>(tabletMeta);
- put(copy, "1<", MetadataTable.CURRENT_LOCATION_COLUMN_FAMILY, "5", "127.0.0.1:9998");
+ put(copy, "1<", TabletsSection.CurrentLocationColumnFamily.NAME, "5", "127.0.0.1:9998");
assertFail(copy, ke, tsi);
- put(copy, "1<", MetadataTable.CURRENT_LOCATION_COLUMN_FAMILY, "6", "127.0.0.1:9999");
+ put(copy, "1<", TabletsSection.CurrentLocationColumnFamily.NAME, "6", "127.0.0.1:9999");
assertFail(copy, ke, tsi);
copy = new TreeMap<Key,Value>(tabletMeta);
- put(copy, "1<", MetadataTable.FUTURE_LOCATION_COLUMN_FAMILY, "5", "127.0.0.1:9998");
+ put(copy, "1<", TabletsSection.FutureLocationColumnFamily.NAME, "5", "127.0.0.1:9998");
assertFail(copy, ke, tsi);
assertFail(new TreeMap<Key,Value>(), ke, tsi);
-
+
}
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/446a37a9/server/src/test/java/org/apache/accumulo/server/util/CloneTest.java
----------------------------------------------------------------------
diff --git a/server/src/test/java/org/apache/accumulo/server/util/CloneTest.java b/server/src/test/java/org/apache/accumulo/server/util/CloneTest.java
index 93f7b51..e2d1ecb 100644
--- a/server/src/test/java/org/apache/accumulo/server/util/CloneTest.java
+++ b/server/src/test/java/org/apache/accumulo/server/util/CloneTest.java
@@ -31,6 +31,9 @@ import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.KeyExtent;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.core.metadata.MetadataTable;
+import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection;
+import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.DataFileColumnFamily;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.hadoop.io.Text;
@@ -43,8 +46,8 @@ public class CloneTest extends TestCase {
KeyExtent ke = new KeyExtent(new Text("0"), null, null);
Mutation mut = ke.getPrevRowUpdateMutation();
- MetadataTable.TIME_COLUMN.put(mut, new Value("M0".getBytes()));
- MetadataTable.DIRECTORY_COLUMN.put(mut, new Value("/default_tablet".getBytes()));
+ TabletsSection.ServerColumnFamily.TIME_COLUMN.put(mut, new Value("M0".getBytes()));
+ TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.put(mut, new Value("/default_tablet".getBytes()));
BatchWriter bw1 = conn.createBatchWriter(MetadataTable.NAME, new BatchWriterConfig());
@@ -54,9 +57,9 @@ public class CloneTest extends TestCase {
BatchWriter bw2 = conn.createBatchWriter(MetadataTable.NAME, new BatchWriterConfig());
- MetadataTable.initializeClone("0", "1", conn, bw2);
+ MetadataTableUtil.initializeClone("0", "1", conn, bw2);
- int rc = MetadataTable.checkClone("0", "1", conn, bw2);
+ int rc = MetadataTableUtil.checkClone("0", "1", conn, bw2);
assertEquals(0, rc);
@@ -71,9 +74,9 @@ public class CloneTest extends TestCase {
KeyExtent ke = new KeyExtent(new Text("0"), null, null);
Mutation mut = ke.getPrevRowUpdateMutation();
- MetadataTable.TIME_COLUMN.put(mut, new Value("M0".getBytes()));
- MetadataTable.DIRECTORY_COLUMN.put(mut, new Value("/default_tablet".getBytes()));
- mut.put(MetadataTable.DATAFILE_COLUMN_FAMILY.toString(), "/default_tablet/0_0.rf", "1,200");
+ TabletsSection.ServerColumnFamily.TIME_COLUMN.put(mut, new Value("M0".getBytes()));
+ TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.put(mut, new Value("/default_tablet".getBytes()));
+ mut.put(DataFileColumnFamily.NAME.toString(), "/default_tablet/0_0.rf", "1,200");
BatchWriter bw1 = conn.createBatchWriter(MetadataTable.NAME, new BatchWriterConfig());
@@ -83,20 +86,20 @@ public class CloneTest extends TestCase {
BatchWriter bw2 = conn.createBatchWriter(MetadataTable.NAME, new BatchWriterConfig());
- MetadataTable.initializeClone("0", "1", conn, bw2);
+ MetadataTableUtil.initializeClone("0", "1", conn, bw2);
Mutation mut2 = new Mutation(ke.getMetadataEntry());
- mut2.putDelete(MetadataTable.DATAFILE_COLUMN_FAMILY.toString(), "/default_tablet/0_0.rf");
- mut2.put(MetadataTable.DATAFILE_COLUMN_FAMILY.toString(), "/default_tablet/1_0.rf", "2,300");
+ mut2.putDelete(DataFileColumnFamily.NAME.toString(), "/default_tablet/0_0.rf");
+ mut2.put(DataFileColumnFamily.NAME.toString(), "/default_tablet/1_0.rf", "2,300");
bw1.addMutation(mut2);
bw1.flush();
- int rc = MetadataTable.checkClone("0", "1", conn, bw2);
+ int rc = MetadataTableUtil.checkClone("0", "1", conn, bw2);
assertEquals(1, rc);
- rc = MetadataTable.checkClone("0", "1", conn, bw2);
+ rc = MetadataTableUtil.checkClone("0", "1", conn, bw2);
assertEquals(0, rc);
@@ -106,7 +109,7 @@ public class CloneTest extends TestCase {
HashSet<String> files = new HashSet<String>();
for (Entry<Key,Value> entry : scanner) {
- if (entry.getKey().getColumnFamily().equals(MetadataTable.DATAFILE_COLUMN_FAMILY))
+ if (entry.getKey().getColumnFamily().equals(DataFileColumnFamily.NAME))
files.add(entry.getKey().getColumnQualifier().toString());
}
@@ -128,14 +131,14 @@ public class CloneTest extends TestCase {
BatchWriter bw2 = conn.createBatchWriter(MetadataTable.NAME, new BatchWriterConfig());
- MetadataTable.initializeClone("0", "1", conn, bw2);
+ MetadataTableUtil.initializeClone("0", "1", conn, bw2);
bw1.addMutation(createTablet("0", "m", null, "/default_tablet", "/default_tablet/0_0.rf"));
bw1.addMutation(createTablet("0", null, "m", "/t-1", "/default_tablet/0_0.rf"));
bw1.flush();
- int rc = MetadataTable.checkClone("0", "1", conn, bw2);
+ int rc = MetadataTableUtil.checkClone("0", "1", conn, bw2);
assertEquals(0, rc);
@@ -146,7 +149,7 @@ public class CloneTest extends TestCase {
int count = 0;
for (Entry<Key,Value> entry : scanner) {
- if (entry.getKey().getColumnFamily().equals(MetadataTable.DATAFILE_COLUMN_FAMILY)) {
+ if (entry.getKey().getColumnFamily().equals(DataFileColumnFamily.NAME)) {
files.add(entry.getKey().getColumnQualifier().toString());
count++;
}
@@ -170,20 +173,20 @@ public class CloneTest extends TestCase {
BatchWriter bw2 = conn.createBatchWriter(MetadataTable.NAME, new BatchWriterConfig());
- MetadataTable.initializeClone("0", "1", conn, bw2);
+ MetadataTableUtil.initializeClone("0", "1", conn, bw2);
bw1.addMutation(createTablet("0", "m", null, "/default_tablet", "/default_tablet/1_0.rf"));
Mutation mut3 = createTablet("0", null, "m", "/t-1", "/default_tablet/1_0.rf");
- mut3.putDelete(MetadataTable.DATAFILE_COLUMN_FAMILY.toString(), "/default_tablet/0_0.rf");
+ mut3.putDelete(DataFileColumnFamily.NAME.toString(), "/default_tablet/0_0.rf");
bw1.addMutation(mut3);
bw1.flush();
- int rc = MetadataTable.checkClone("0", "1", conn, bw2);
+ int rc = MetadataTableUtil.checkClone("0", "1", conn, bw2);
assertEquals(1, rc);
- rc = MetadataTable.checkClone("0", "1", conn, bw2);
+ rc = MetadataTableUtil.checkClone("0", "1", conn, bw2);
assertEquals(0, rc);
@@ -195,7 +198,7 @@ public class CloneTest extends TestCase {
int count = 0;
for (Entry<Key,Value> entry : scanner) {
- if (entry.getKey().getColumnFamily().equals(MetadataTable.DATAFILE_COLUMN_FAMILY)) {
+ if (entry.getKey().getColumnFamily().equals(DataFileColumnFamily.NAME)) {
files.add(entry.getKey().getColumnQualifier().toString());
count++;
}
@@ -209,10 +212,10 @@ public class CloneTest extends TestCase {
private static Mutation deleteTablet(String tid, String endRow, String prevRow, String dir, String file) throws Exception {
KeyExtent ke = new KeyExtent(new Text(tid), endRow == null ? null : new Text(endRow), prevRow == null ? null : new Text(prevRow));
Mutation mut = new Mutation(ke.getMetadataEntry());
- MetadataTable.PREV_ROW_COLUMN.putDelete(mut);
- MetadataTable.TIME_COLUMN.putDelete(mut);
- MetadataTable.DIRECTORY_COLUMN.putDelete(mut);
- mut.putDelete(MetadataTable.DATAFILE_COLUMN_FAMILY.toString(), file);
+ TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.putDelete(mut);
+ TabletsSection.ServerColumnFamily.TIME_COLUMN.putDelete(mut);
+ TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.putDelete(mut);
+ mut.putDelete(DataFileColumnFamily.NAME.toString(), file);
return mut;
}
@@ -221,9 +224,9 @@ public class CloneTest extends TestCase {
KeyExtent ke = new KeyExtent(new Text(tid), endRow == null ? null : new Text(endRow), prevRow == null ? null : new Text(prevRow));
Mutation mut = ke.getPrevRowUpdateMutation();
- MetadataTable.TIME_COLUMN.put(mut, new Value("M0".getBytes()));
- MetadataTable.DIRECTORY_COLUMN.put(mut, new Value(dir.getBytes()));
- mut.put(MetadataTable.DATAFILE_COLUMN_FAMILY.toString(), file, "10,200");
+ TabletsSection.ServerColumnFamily.TIME_COLUMN.put(mut, new Value("M0".getBytes()));
+ TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.put(mut, new Value(dir.getBytes()));
+ mut.put(DataFileColumnFamily.NAME.toString(), file, "10,200");
return mut;
}
@@ -242,7 +245,7 @@ public class CloneTest extends TestCase {
BatchWriter bw2 = conn.createBatchWriter(MetadataTable.NAME, new BatchWriterConfig());
- MetadataTable.initializeClone("0", "1", conn, bw2);
+ MetadataTableUtil.initializeClone("0", "1", conn, bw2);
bw1.addMutation(createTablet("0", "f", null, "/d1", "/d1/file3"));
bw1.addMutation(createTablet("0", "m", "f", "/d3", "/d1/file1"));
@@ -251,7 +254,7 @@ public class CloneTest extends TestCase {
bw1.flush();
- int rc = MetadataTable.checkClone("0", "1", conn, bw2);
+ int rc = MetadataTableUtil.checkClone("0", "1", conn, bw2);
assertEquals(0, rc);
@@ -262,7 +265,7 @@ public class CloneTest extends TestCase {
int count = 0;
for (Entry<Key,Value> entry : scanner) {
- if (entry.getKey().getColumnFamily().equals(MetadataTable.DATAFILE_COLUMN_FAMILY)) {
+ if (entry.getKey().getColumnFamily().equals(DataFileColumnFamily.NAME)) {
files.add(entry.getKey().getColumnQualifier().toString());
count++;
}
@@ -289,7 +292,7 @@ public class CloneTest extends TestCase {
BatchWriter bw2 = conn.createBatchWriter(MetadataTable.NAME, new BatchWriterConfig());
- MetadataTable.initializeClone("0", "1", conn, bw2);
+ MetadataTableUtil.initializeClone("0", "1", conn, bw2);
bw1.addMutation(deleteTablet("0", "m", null, "/d1", "/d1/file1"));
bw1.addMutation(deleteTablet("0", null, "m", "/d2", "/d2/file2"));
@@ -303,7 +306,7 @@ public class CloneTest extends TestCase {
bw1.flush();
- int rc = MetadataTable.checkClone("0", "1", conn, bw2);
+ int rc = MetadataTableUtil.checkClone("0", "1", conn, bw2);
assertEquals(1, rc);
@@ -315,7 +318,7 @@ public class CloneTest extends TestCase {
bw1.flush();
- rc = MetadataTable.checkClone("0", "1", conn, bw2);
+ rc = MetadataTableUtil.checkClone("0", "1", conn, bw2);
assertEquals(0, rc);
@@ -326,7 +329,7 @@ public class CloneTest extends TestCase {
int count = 0;
for (Entry<Key,Value> entry : scanner) {
- if (entry.getKey().getColumnFamily().equals(MetadataTable.DATAFILE_COLUMN_FAMILY)) {
+ if (entry.getKey().getColumnFamily().equals(DataFileColumnFamily.NAME)) {
files.add(entry.getKey().getColumnQualifier().toString());
count++;
}
@@ -353,17 +356,17 @@ public class CloneTest extends TestCase {
BatchWriter bw2 = conn.createBatchWriter(MetadataTable.NAME, new BatchWriterConfig());
- MetadataTable.initializeClone("0", "1", conn, bw2);
+ MetadataTableUtil.initializeClone("0", "1", conn, bw2);
bw1.addMutation(deleteTablet("0", "m", null, "/d1", "/d1/file1"));
Mutation mut = createTablet("0", null, null, "/d2", "/d2/file2");
- mut.put(MetadataTable.DATAFILE_COLUMN_FAMILY.toString(), "/d1/file1", "10,200");
+ mut.put(DataFileColumnFamily.NAME.toString(), "/d1/file1", "10,200");
bw1.addMutation(mut);
bw1.flush();
try {
- MetadataTable.checkClone("0", "1", conn, bw2);
+ MetadataTableUtil.checkClone("0", "1", conn, bw2);
assertTrue(false);
} catch (TabletIterator.TabletDeletedException tde) {}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/446a37a9/server/src/test/java/org/apache/accumulo/server/util/TabletIteratorTest.java
----------------------------------------------------------------------
diff --git a/server/src/test/java/org/apache/accumulo/server/util/TabletIteratorTest.java b/server/src/test/java/org/apache/accumulo/server/util/TabletIteratorTest.java
index 122b493..72ce334 100644
--- a/server/src/test/java/org/apache/accumulo/server/util/TabletIteratorTest.java
+++ b/server/src/test/java/org/apache/accumulo/server/util/TabletIteratorTest.java
@@ -31,8 +31,10 @@ import org.apache.accumulo.core.data.KeyExtent;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.core.metadata.MetadataTable;
+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.core.util.MetadataTable;
import org.apache.accumulo.server.util.TabletIterator.TabletDeletedException;
import org.apache.hadoop.io.Text;
@@ -43,10 +45,11 @@ public class TabletIteratorTest extends TestCase {
private Connector conn;
public TestTabletIterator(Connector conn) throws Exception {
- super(conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY), MetadataTable.KEYSPACE, true, true);
+ super(conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY), MetadataSchema.TabletsSection.getRange(), true, true);
this.conn = conn;
}
+ @Override
protected void resetScanner() {
try {
Scanner ds = conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
@@ -81,11 +84,11 @@ public class TabletIteratorTest extends TestCase {
KeyExtent ke1 = new KeyExtent(new Text("0"), new Text("m"), null);
Mutation mut1 = ke1.getPrevRowUpdateMutation();
- MetadataTable.DIRECTORY_COLUMN.put(mut1, new Value("/d1".getBytes()));
+ TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.put(mut1, new Value("/d1".getBytes()));
KeyExtent ke2 = new KeyExtent(new Text("0"), null, null);
Mutation mut2 = ke2.getPrevRowUpdateMutation();
- MetadataTable.DIRECTORY_COLUMN.put(mut2, new Value("/d2".getBytes()));
+ TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.put(mut2, new Value("/d2".getBytes()));
BatchWriter bw1 = conn.createBatchWriter(MetadataTable.NAME, new BatchWriterConfig());
bw1.addMutation(mut1);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/446a37a9/test/src/main/java/org/apache/accumulo/test/QueryMetadataTable.java
----------------------------------------------------------------------
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 b125176..45cc557 100644
--- a/test/src/main/java/org/apache/accumulo/test/QueryMetadataTable.java
+++ b/test/src/main/java/org/apache/accumulo/test/QueryMetadataTable.java
@@ -35,8 +35,9 @@ import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.KeyExtent;
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.core.metadata.MetadataTable;
+import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection;
import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.core.util.MetadataTable;
import org.apache.accumulo.server.cli.ClientOpts;
import org.apache.accumulo.server.client.HdfsZooInstance;
import org.apache.hadoop.io.Text;
@@ -111,7 +112,7 @@ public class QueryMetadataTable {
if (count % 72 == 0) {
System.out.printf(" %,d%n", count);
}
- if (entry.getKey().compareRow(mdrow) == 0 && entry.getKey().getColumnFamily().compareTo(MetadataTable.CURRENT_LOCATION_COLUMN_FAMILY) == 0) {
+ if (entry.getKey().compareRow(mdrow) == 0 && entry.getKey().getColumnFamily().compareTo(TabletsSection.CurrentLocationColumnFamily.NAME) == 0) {
System.out.println(entry.getKey() + " " + entry.getValue());
location = entry.getValue().toString();
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/446a37a9/test/src/main/java/org/apache/accumulo/test/TestMultiTableIngest.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/TestMultiTableIngest.java b/test/src/main/java/org/apache/accumulo/test/TestMultiTableIngest.java
index 8edcd92..b051988 100644
--- a/test/src/main/java/org/apache/accumulo/test/TestMultiTableIngest.java
+++ b/test/src/main/java/org/apache/accumulo/test/TestMultiTableIngest.java
@@ -20,8 +20,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map.Entry;
-import javax.crypto.Mac;
-
import org.apache.accumulo.core.cli.BatchWriterOpts;
import org.apache.accumulo.core.cli.ScannerOpts;
import org.apache.accumulo.core.client.AccumuloException;
@@ -34,7 +32,6 @@ import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.server.cli.ClientOpts;
-import org.apache.accumulo.test.functional.MacTest;
import org.apache.hadoop.io.Text;
import com.beust.jcommander.Parameter;
@@ -42,11 +39,11 @@ import com.beust.jcommander.Parameter;
public class TestMultiTableIngest {
static class Opts extends ClientOpts {
- @Parameter(names="--readonly", description="read only")
+ @Parameter(names = "--readonly", description = "read only")
boolean readonly = false;
- @Parameter(names="--tables", description="number of tables to create")
+ @Parameter(names = "--tables", description = "number of tables to create")
int tables = 5;
- @Parameter(names="--count", description="number of entries to create")
+ @Parameter(names = "--count", description = "number of entries to create")
int count = 10000;
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/446a37a9/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousStatsCollector.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousStatsCollector.java b/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousStatsCollector.java
index 8a80050..ea677da 100644
--- a/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousStatsCollector.java
+++ b/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousStatsCollector.java
@@ -36,8 +36,9 @@ import org.apache.accumulo.core.master.thrift.MasterClientService;
import org.apache.accumulo.core.master.thrift.MasterMonitorInfo;
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.schema.MetadataSchema.TabletsSection.DataFileColumnFamily;
import org.apache.accumulo.core.util.CachedConfiguration;
-import org.apache.accumulo.core.util.MetadataTable;
import org.apache.accumulo.core.util.Stat;
import org.apache.accumulo.server.ServerConstants;
import org.apache.accumulo.server.cli.ClientOnRequiredTable;
@@ -91,7 +92,7 @@ public class ContinuousStatsCollector {
Connector conn = opts.getConnector();
Scanner scanner = conn.createScanner(MetadataTable.NAME, opts.auths);
scanner.setBatchSize(scanBatchSize);
- scanner.fetchColumnFamily(MetadataTable.DATAFILE_COLUMN_FAMILY);
+ scanner.fetchColumnFamily(DataFileColumnFamily.NAME);
scanner.addScanIterator(new IteratorSetting(1000, "cfc", ColumnFamilyCounter.class.getName()));
scanner.setRange(new KeyExtent(new Text(tableId), null, null).toMetadataRange());
http://git-wip-us.apache.org/repos/asf/accumulo/blob/446a37a9/test/src/main/java/org/apache/accumulo/test/functional/FunctionalTest.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/FunctionalTest.java b/test/src/main/java/org/apache/accumulo/test/functional/FunctionalTest.java
index 0d0cfc3..d169596 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/FunctionalTest.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/FunctionalTest.java
@@ -40,9 +40,11 @@ import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.core.metadata.MetadataTable;
+import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection;
+import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.DataFileColumnFamily;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.security.CredentialHelper;
-import org.apache.accumulo.core.util.MetadataTable;
import org.apache.accumulo.server.cli.ClientOpts;
import org.apache.accumulo.server.conf.ServerConfiguration;
import org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader;
@@ -193,8 +195,8 @@ public abstract class FunctionalTest {
Scanner scanner = getConnector().createScanner(MetadataTable.NAME, Authorizations.EMPTY);
String tableId = Tables.getNameToIdMap(getInstance()).get(tableName);
scanner.setRange(new Range(new Text(tableId + ";"), true, new Text(tableId + "<"), true));
- scanner.fetchColumnFamily(MetadataTable.DATAFILE_COLUMN_FAMILY);
- MetadataTable.PREV_ROW_COLUMN.fetch(scanner);
+ scanner.fetchColumnFamily(DataFileColumnFamily.NAME);
+ TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.fetch(scanner);
HashMap<Text,Integer> tabletFileCounts = new HashMap<Text,Integer>();
@@ -205,7 +207,7 @@ public abstract class FunctionalTest {
Integer count = tabletFileCounts.get(row);
if (count == null)
count = 0;
- if (entry.getKey().getColumnFamily().equals(MetadataTable.DATAFILE_COLUMN_FAMILY)) {
+ if (entry.getKey().getColumnFamily().equals(DataFileColumnFamily.NAME)) {
count = count + 1;
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/446a37a9/test/src/main/java/org/apache/accumulo/test/functional/SplitRecoveryTest.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/SplitRecoveryTest.java b/test/src/main/java/org/apache/accumulo/test/functional/SplitRecoveryTest.java
index ce31323..8cb79c3 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/SplitRecoveryTest.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/SplitRecoveryTest.java
@@ -36,9 +36,12 @@ import org.apache.accumulo.core.data.KeyExtent;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.file.rfile.RFile;
+import org.apache.accumulo.core.metadata.MetadataTable;
+import org.apache.accumulo.core.metadata.schema.DataFileValue;
+import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection;
+import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.DataFileColumnFamily;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.util.ColumnFQ;
-import org.apache.accumulo.core.util.MetadataTable.DataFileValue;
import org.apache.accumulo.core.zookeeper.ZooUtil;
import org.apache.accumulo.fate.zookeeper.IZooReaderWriter;
import org.apache.accumulo.fate.zookeeper.ZooLock.LockLossReason;
@@ -53,7 +56,7 @@ import org.apache.accumulo.server.security.SecurityConstants;
import org.apache.accumulo.server.tabletserver.TabletServer;
import org.apache.accumulo.server.tabletserver.TabletTime;
import org.apache.accumulo.server.util.FileUtil;
-import org.apache.accumulo.server.util.MetadataTable;
+import org.apache.accumulo.server.util.MetadataTableUtil;
import org.apache.accumulo.server.zookeeper.TransactionWatcher;
import org.apache.accumulo.server.zookeeper.ZooLock;
import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
@@ -137,7 +140,7 @@ public class SplitRecoveryTest extends FunctionalTest {
KeyExtent extent = extents[i];
String tdir = ServerConstants.getTablesDirs()[0] + "/" + extent.getTableId().toString() + "/dir_" + i;
- MetadataTable.addTablet(extent, tdir, SecurityConstants.getSystemCredentials(), TabletTime.LOGICAL_TIME_ID, zl);
+ MetadataTableUtil.addTablet(extent, tdir, SecurityConstants.getSystemCredentials(), TabletTime.LOGICAL_TIME_ID, zl);
SortedMap<FileRef,DataFileValue> mapFiles = new TreeMap<FileRef,DataFileValue>();
mapFiles.put(new FileRef(tdir + "/" + RFile.EXTENSION + "_000_000"), new DataFileValue(1000017 + i, 10000 + i));
@@ -146,7 +149,7 @@ public class SplitRecoveryTest extends FunctionalTest {
}
int tid = 0;
TransactionWatcher.ZooArbitrator.start(Constants.BULK_ARBITRATOR_TYPE, tid);
- MetadataTable.updateTabletDataFile(tid, extent, mapFiles, "L0", SecurityConstants.getSystemCredentials(), zl);
+ MetadataTableUtil.updateTabletDataFile(tid, extent, mapFiles, "L0", SecurityConstants.getSystemCredentials(), zl);
}
KeyExtent extent = extents[extentToSplit];
@@ -164,24 +167,24 @@ public class SplitRecoveryTest extends FunctionalTest {
SortedMap<FileRef,DataFileValue> highDatafileSizes = new TreeMap<FileRef,DataFileValue>();
List<FileRef> highDatafilesToRemove = new ArrayList<FileRef>();
- MetadataTable.splitDatafiles(extent.getTableId(), midRow, splitRatio, new HashMap<FileRef,FileUtil.FileInfo>(), mapFiles, lowDatafileSizes,
+ MetadataTableUtil.splitDatafiles(extent.getTableId(), midRow, splitRatio, new HashMap<FileRef,FileUtil.FileInfo>(), mapFiles, lowDatafileSizes,
highDatafileSizes, highDatafilesToRemove);
- MetadataTable.splitTablet(high, extent.getPrevEndRow(), splitRatio, SecurityConstants.getSystemCredentials(), zl);
+ MetadataTableUtil.splitTablet(high, extent.getPrevEndRow(), splitRatio, SecurityConstants.getSystemCredentials(), zl);
TServerInstance instance = new TServerInstance(location, zl.getSessionId());
Writer writer = new Writer(HdfsZooInstance.getInstance(), SecurityConstants.getSystemCredentials(), MetadataTable.ID);
Assignment assignment = new Assignment(high, instance);
Mutation m = new Mutation(assignment.tablet.getMetadataEntry());
- m.put(MetadataTable.FUTURE_LOCATION_COLUMN_FAMILY, assignment.server.asColumnQualifier(), assignment.server.asMutationValue());
+ m.put(TabletsSection.FutureLocationColumnFamily.NAME, assignment.server.asColumnQualifier(), assignment.server.asMutationValue());
writer.update(m);
if (steps >= 1) {
- Map<FileRef,Long> bulkFiles = MetadataTable.getBulkFilesLoaded(SecurityConstants.getSystemCredentials(), extent);
- MetadataTable.addNewTablet(low, "/lowDir", instance, lowDatafileSizes, bulkFiles, SecurityConstants.getSystemCredentials(), TabletTime.LOGICAL_TIME_ID
- + "0", -1l, -1l, zl);
+ Map<FileRef,Long> bulkFiles = MetadataTableUtil.getBulkFilesLoaded(SecurityConstants.getSystemCredentials(), extent);
+ MetadataTableUtil.addNewTablet(low, "/lowDir", instance, lowDatafileSizes, bulkFiles, SecurityConstants.getSystemCredentials(),
+ TabletTime.LOGICAL_TIME_ID + "0", -1l, -1l, zl);
}
if (steps >= 2)
- MetadataTable.finishSplit(high, highDatafileSizes, highDatafilesToRemove, SecurityConstants.getSystemCredentials(), zl);
+ MetadataTableUtil.finishSplit(high, highDatafileSizes, highDatafilesToRemove, SecurityConstants.getSystemCredentials(), zl);
TabletServer.verifyTabletInformation(high, instance, null, "127.0.0.1:0", zl);
@@ -189,8 +192,8 @@ public class SplitRecoveryTest extends FunctionalTest {
ensureTabletHasNoUnexpectedMetadataEntries(low, lowDatafileSizes);
ensureTabletHasNoUnexpectedMetadataEntries(high, highDatafileSizes);
- Map<FileRef,Long> lowBulkFiles = MetadataTable.getBulkFilesLoaded(SecurityConstants.getSystemCredentials(), low);
- Map<FileRef,Long> highBulkFiles = MetadataTable.getBulkFilesLoaded(SecurityConstants.getSystemCredentials(), high);
+ Map<FileRef,Long> lowBulkFiles = MetadataTableUtil.getBulkFilesLoaded(SecurityConstants.getSystemCredentials(), low);
+ Map<FileRef,Long> highBulkFiles = MetadataTableUtil.getBulkFilesLoaded(SecurityConstants.getSystemCredentials(), high);
if (!lowBulkFiles.equals(highBulkFiles)) {
throw new Exception(" " + lowBulkFiles + " != " + highBulkFiles + " " + low + " " + high);
@@ -209,17 +212,17 @@ public class SplitRecoveryTest extends FunctionalTest {
scanner.setRange(extent.toMetadataRange());
HashSet<ColumnFQ> expectedColumns = new HashSet<ColumnFQ>();
- expectedColumns.add(MetadataTable.DIRECTORY_COLUMN);
- expectedColumns.add(MetadataTable.PREV_ROW_COLUMN);
- expectedColumns.add(MetadataTable.TIME_COLUMN);
- expectedColumns.add(MetadataTable.LOCK_COLUMN);
+ expectedColumns.add(TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN);
+ expectedColumns.add(TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN);
+ expectedColumns.add(TabletsSection.ServerColumnFamily.TIME_COLUMN);
+ expectedColumns.add(TabletsSection.ServerColumnFamily.LOCK_COLUMN);
HashSet<Text> expectedColumnFamilies = new HashSet<Text>();
- expectedColumnFamilies.add(MetadataTable.DATAFILE_COLUMN_FAMILY);
- expectedColumnFamilies.add(MetadataTable.FUTURE_LOCATION_COLUMN_FAMILY);
- expectedColumnFamilies.add(MetadataTable.CURRENT_LOCATION_COLUMN_FAMILY);
- expectedColumnFamilies.add(MetadataTable.LAST_LOCATION_COLUMN_FAMILY);
- expectedColumnFamilies.add(MetadataTable.BULKFILE_COLUMN_FAMILY);
+ expectedColumnFamilies.add(DataFileColumnFamily.NAME);
+ expectedColumnFamilies.add(TabletsSection.FutureLocationColumnFamily.NAME);
+ expectedColumnFamilies.add(TabletsSection.CurrentLocationColumnFamily.NAME);
+ expectedColumnFamilies.add(TabletsSection.LastLocationColumnFamily.NAME);
+ expectedColumnFamilies.add(TabletsSection.BulkFileColumnFamily.NAME);
Iterator<Entry<Key,Value>> iter = scanner.iterator();
while (iter.hasNext()) {
@@ -244,7 +247,7 @@ public class SplitRecoveryTest extends FunctionalTest {
throw new Exception("Not all expected columns seen " + extent + " " + expectedColumns);
}
- SortedMap<FileRef,DataFileValue> fixedMapFiles = MetadataTable.getDataFileSizes(extent, SecurityConstants.getSystemCredentials());
+ SortedMap<FileRef,DataFileValue> fixedMapFiles = MetadataTableUtil.getDataFileSizes(extent, SecurityConstants.getSystemCredentials());
verifySame(expectedMapFiles, fixedMapFiles);
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/446a37a9/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java b/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java
index 3675870..5602f14 100644
--- a/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java
+++ b/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java
@@ -35,9 +35,11 @@ import org.apache.accumulo.core.data.KeyExtent;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.core.metadata.MetadataTable;
+import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection;
+import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.DataFileColumnFamily;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.util.AddressUtil;
-import org.apache.accumulo.core.util.MetadataTable;
import org.apache.accumulo.core.util.Stat;
import org.apache.accumulo.server.master.state.TServerInstance;
import org.apache.accumulo.server.security.SecurityConstants;
@@ -99,10 +101,10 @@ public class MetadataBatchScanTest {
String dir = "/t-" + UUID.randomUUID();
- MetadataTable.DIRECTORY_COLUMN.put(mut, new Value(dir.getBytes()));
+ TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.put(mut, new Value(dir.getBytes()));
for (int i = 0; i < 5; i++) {
- mut.put(MetadataTable.DATAFILE_COLUMN_FAMILY, new Text(dir + "/00000_0000" + i + ".map"), new Value("10000,1000000".getBytes()));
+ mut.put(DataFileColumnFamily.NAME, new Text(dir + "/00000_0000" + i + ".map"), new Value("10000,1000000".getBytes()));
}
bw.addMutation(mut);
@@ -165,8 +167,8 @@ public class MetadataBatchScanTest {
Scanner scanner = null;
BatchScanner bs = connector.createBatchScanner(MetadataTable.NAME, Authorizations.EMPTY, 1);
- bs.fetchColumnFamily(MetadataTable.CURRENT_LOCATION_COLUMN_FAMILY);
- MetadataTable.PREV_ROW_COLUMN.fetch(bs);
+ bs.fetchColumnFamily(TabletsSection.CurrentLocationColumnFamily.NAME);
+ TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.fetch(bs);
bs.setRanges(ranges);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/446a37a9/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java b/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java
index 692f415..08430e5 100644
--- a/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java
+++ b/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java
@@ -27,9 +27,8 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Random;
-import java.util.SortedSet;
+import java.util.SortedMap;
import java.util.TreeMap;
-import java.util.TreeSet;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@@ -59,6 +58,7 @@ import org.apache.accumulo.core.iterators.system.ColumnQualifierFilter;
import org.apache.accumulo.core.iterators.system.DeletingIterator;
import org.apache.accumulo.core.iterators.system.MultiIterator;
import org.apache.accumulo.core.iterators.system.VisibilityFilter;
+import org.apache.accumulo.core.metadata.MetadataServicer;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.security.CredentialHelper;
import org.apache.accumulo.core.security.thrift.TCredentials;
@@ -70,7 +70,7 @@ import org.apache.accumulo.server.conf.TableConfiguration;
import org.apache.accumulo.server.fs.FileRef;
import org.apache.accumulo.server.fs.VolumeManager;
import org.apache.accumulo.server.fs.VolumeManagerImpl;
-import org.apache.accumulo.server.util.MetadataTable;
+import org.apache.accumulo.server.util.MetadataTableUtil;
import org.apache.hadoop.fs.BlockLocation;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
@@ -84,16 +84,16 @@ public class CollectTabletStats {
private static final Logger log = Logger.getLogger(CollectTabletStats.class);
static class CollectOptions extends ClientOnRequiredTable {
- @Parameter(names="--iterations", description="number of iterations")
+ @Parameter(names = "--iterations", description = "number of iterations")
int iterations = 3;
- @Parameter(names="-t", description="number of threads")
+ @Parameter(names = "-t", description = "number of threads")
int numThreads = 1;
- @Parameter(names="-f", description="select far tablets, default is to use local tablets")
+ @Parameter(names = "-f", description = "select far tablets, default is to use local tablets")
boolean selectFarTablets = false;
- @Parameter(names="-c", description="comma separated list of columns")
+ @Parameter(names = "-c", description = "comma separated list of columns")
String columns;
}
-
+
public static void main(String[] args) throws Exception {
final CollectOptions opts = new CollectOptions();
@@ -106,7 +106,7 @@ public class CollectTabletStats {
final String columns[] = columnsTmp;
final VolumeManager fs = VolumeManagerImpl.get();
-
+
Instance instance = opts.getInstance();
final ServerConfiguration sconf = new ServerConfiguration(instance);
@@ -116,8 +116,9 @@ public class CollectTabletStats {
System.exit(-1);
}
- Map<KeyExtent,String> locations = new HashMap<KeyExtent,String>();
- List<KeyExtent> candidates = findTablets(!opts.selectFarTablets, CredentialHelper.create(opts.principal, opts.getToken(), opts.instance), opts.tableName, instance, locations);
+ TreeMap<KeyExtent,String> tabletLocations = new TreeMap<KeyExtent,String>();
+ List<KeyExtent> candidates = findTablets(!opts.selectFarTablets, CredentialHelper.create(opts.principal, opts.getToken(), opts.instance), opts.tableName,
+ instance, tabletLocations);
if (candidates.size() < opts.numThreads) {
System.err.println("ERROR : Unable to find " + opts.numThreads + " " + (opts.selectFarTablets ? "far" : "local") + " tablets");
@@ -142,7 +143,7 @@ public class CollectTabletStats {
for (KeyExtent ke : tabletsToTest) {
System.out.println("\t *** Information about tablet " + ke.getUUID() + " *** ");
System.out.println("\t\t# files in tablet : " + tabletFiles.get(ke).size());
- System.out.println("\t\ttablet location : " + locations.get(ke));
+ System.out.println("\t\ttablet location : " + tabletLocations.get(ke));
reportHdfsBlockLocations(tabletFiles.get(ke));
}
@@ -157,6 +158,7 @@ public class CollectTabletStats {
for (final KeyExtent ke : tabletsToTest) {
final List<FileRef> files = tabletFiles.get(ke);
Test test = new Test(ke) {
+ @Override
public int runTest() throws Exception {
return readFiles(fs, sconf.getConfiguration(), files, ke, columns);
}
@@ -176,6 +178,7 @@ public class CollectTabletStats {
for (final KeyExtent ke : tabletsToTest) {
final List<FileRef> files = tabletFiles.get(ke);
Test test = new Test(ke) {
+ @Override
public int runTest() throws Exception {
return readFilesUsingIterStack(fs, sconf, files, opts.auths, ke, columns, false);
}
@@ -193,6 +196,7 @@ public class CollectTabletStats {
for (final KeyExtent ke : tabletsToTest) {
final List<FileRef> files = tabletFiles.get(ke);
Test test = new Test(ke) {
+ @Override
public int runTest() throws Exception {
return readFilesUsingIterStack(fs, sconf, files, opts.auths, ke, columns, true);
}
@@ -212,6 +216,7 @@ public class CollectTabletStats {
for (final KeyExtent ke : tabletsToTest) {
Test test = new Test(ke) {
+ @Override
public int runTest() throws Exception {
return scanTablet(conn, opts.tableName, opts.auths, scanOpts.scanBatchSize, ke.getPrevEndRow(), ke.getEndRow(), columns);
}
@@ -227,6 +232,7 @@ public class CollectTabletStats {
final Connector conn = opts.getConnector();
threadPool.submit(new Runnable() {
+ @Override
public void run() {
try {
calcTabletStats(conn, opts.tableName, opts.auths, scanOpts.scanBatchSize, ke, columns);
@@ -259,6 +265,7 @@ public class CollectTabletStats {
this.finishCdl = fcdl;
}
+ @Override
public void run() {
try {
@@ -337,23 +344,26 @@ public class CollectTabletStats {
}
- private static List<KeyExtent> findTablets(boolean selectLocalTablets, TCredentials credentials, String table, Instance zki,
- Map<KeyExtent,String> locations) throws Exception {
- SortedSet<KeyExtent> tablets = new TreeSet<KeyExtent>();
+ private static List<KeyExtent> findTablets(boolean selectLocalTablets, TCredentials credentials, String tableName, Instance zki,
+ SortedMap<KeyExtent,String> tabletLocations) throws Exception {
- MetadataTable.getEntries(zki, credentials, table, false, locations, tablets);
+ String tableId = Tables.getNameToIdMap(zki).get(tableName);
+ MetadataServicer.forTableId(zki, credentials, tableId).getTabletLocations(tabletLocations);
InetAddress localaddress = InetAddress.getLocalHost();
List<KeyExtent> candidates = new ArrayList<KeyExtent>();
- for (Entry<KeyExtent,String> entry : locations.entrySet()) {
- boolean isLocal = AddressUtil.parseAddress(entry.getValue(), 4).getAddress().equals(localaddress);
-
- if (selectLocalTablets && isLocal) {
- candidates.add(entry.getKey());
- } else if (!selectLocalTablets && !isLocal) {
- candidates.add(entry.getKey());
+ for (Entry<KeyExtent,String> entry : tabletLocations.entrySet()) {
+ String loc = entry.getValue();
+ if (loc != null) {
+ boolean isLocal = AddressUtil.parseAddress(entry.getValue(), 4).getAddress().equals(localaddress);
+
+ if (selectLocalTablets && isLocal) {
+ candidates.add(entry.getKey());
+ } else if (!selectLocalTablets && !isLocal) {
+ candidates.add(entry.getKey());
+ }
}
}
return candidates;
@@ -373,7 +383,7 @@ public class CollectTabletStats {
}
private static List<FileRef> getTabletFiles(TCredentials token, Instance zki, String tableId, KeyExtent ke) throws IOException {
- return new ArrayList<FileRef>(MetadataTable.getDataFileSizes(ke, token).keySet());
+ return new ArrayList<FileRef>(MetadataTableUtil.getDataFileSizes(ke, token).keySet());
}
private static void reportHdfsBlockLocations(List<FileRef> files) throws Exception {
@@ -456,9 +466,8 @@ public class CollectTabletStats {
return columnSet;
}
- private static int readFilesUsingIterStack(VolumeManager fs, ServerConfiguration aconf, List<FileRef> files, Authorizations auths, KeyExtent ke, String[] columns,
- boolean useTableIterators)
- throws Exception {
+ private static int readFilesUsingIterStack(VolumeManager fs, ServerConfiguration aconf, List<FileRef> files, Authorizations auths, KeyExtent ke,
+ String[] columns, boolean useTableIterators) throws Exception {
SortedKeyValueIterator<Key,Value> reader;
@@ -472,7 +481,7 @@ public class CollectTabletStats {
List<IterInfo> emptyIterinfo = Collections.emptyList();
Map<String,Map<String,String>> emptySsio = Collections.emptyMap();
TableConfiguration tconf = aconf.getTableConfiguration(ke.getTableId().toString());
- reader = createScanIterator(ke, readers,auths, new byte[] {}, new HashSet<Column>(), emptyIterinfo, emptySsio, useTableIterators, tconf);
+ reader = createScanIterator(ke, readers, auths, new byte[] {}, new HashSet<Column>(), emptyIterinfo, emptySsio, useTableIterators, tconf);
HashSet<ByteSequence> columnSet = createColumnBSS(columns);
@@ -489,7 +498,8 @@ public class CollectTabletStats {
}
- private static int scanTablet(Connector conn, String table, Authorizations auths, int batchSize, Text prevEndRow, Text endRow, String[] columns) throws Exception {
+ private static int scanTablet(Connector conn, String table, Authorizations auths, int batchSize, Text prevEndRow, Text endRow, String[] columns)
+ throws Exception {
Scanner scanner = conn.createScanner(table, auths);
scanner.setBatchSize(batchSize);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/446a37a9/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/AddSplits.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/AddSplits.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/AddSplits.java
index c7a82eb..aa976f7 100644
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/AddSplits.java
+++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/AddSplits.java
@@ -25,7 +25,7 @@ import java.util.TreeSet;
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.client.TableNotFoundException;
import org.apache.accumulo.core.client.TableOfflineException;
-import org.apache.accumulo.core.util.MetadataTable;
+import org.apache.accumulo.core.metadata.MetadataTable;
import org.apache.accumulo.test.randomwalk.State;
import org.apache.accumulo.test.randomwalk.Test;
import org.apache.hadoop.io.Text;
http://git-wip-us.apache.org/repos/asf/accumulo/blob/446a37a9/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CheckBalance.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CheckBalance.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CheckBalance.java
index 7a77b46..f0a93ac 100644
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CheckBalance.java
+++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CheckBalance.java
@@ -24,8 +24,9 @@ import java.util.Properties;
import org.apache.accumulo.core.client.Scanner;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.core.metadata.MetadataTable;
+import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection;
import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.core.util.MetadataTable;
import org.apache.accumulo.test.randomwalk.State;
import org.apache.accumulo.test.randomwalk.Test;
@@ -42,7 +43,7 @@ public class CheckBalance extends Test {
log.debug("checking balance");
Map<String,Long> counts = new HashMap<String,Long>();
Scanner scanner = state.getConnector().createScanner(MetadataTable.NAME, Authorizations.EMPTY);
- scanner.fetchColumnFamily(MetadataTable.CURRENT_LOCATION_COLUMN_FAMILY);
+ scanner.fetchColumnFamily(TabletsSection.CurrentLocationColumnFamily.NAME);
for (Entry<Key,Value> entry : scanner) {
String location = entry.getKey().getColumnQualifier().toString();
Long count = counts.get(location);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/446a37a9/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Merge.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Merge.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Merge.java
index b0d7ae1..8fcfab5 100644
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Merge.java
+++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Merge.java
@@ -24,7 +24,7 @@ import java.util.Random;
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.client.TableNotFoundException;
import org.apache.accumulo.core.client.TableOfflineException;
-import org.apache.accumulo.core.util.MetadataTable;
+import org.apache.accumulo.core.metadata.MetadataTable;
import org.apache.accumulo.test.randomwalk.State;
import org.apache.accumulo.test.randomwalk.Test;
import org.apache.hadoop.io.Text;
http://git-wip-us.apache.org/repos/asf/accumulo/blob/446a37a9/test/src/test/java/org/apache/accumulo/test/MetaSplitTest.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/MetaSplitTest.java b/test/src/test/java/org/apache/accumulo/test/MetaSplitTest.java
index 4a9c3f5..d3ebd0f 100644
--- a/test/src/test/java/org/apache/accumulo/test/MetaSplitTest.java
+++ b/test/src/test/java/org/apache/accumulo/test/MetaSplitTest.java
@@ -21,9 +21,11 @@ import static org.junit.Assert.assertEquals;
import java.util.SortedSet;
import java.util.TreeSet;
+import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.client.admin.TableOperations;
-import org.apache.accumulo.core.util.MetadataTable;
+import org.apache.accumulo.core.metadata.MetadataTable;
+import org.apache.accumulo.core.metadata.RootTable;
import org.apache.accumulo.minicluster.MiniAccumuloCluster;
import org.apache.accumulo.minicluster.MiniAccumuloConfig;
import org.apache.hadoop.io.Text;
@@ -44,7 +46,6 @@ public class MetaSplitTest {
MiniAccumuloConfig cfg = new MiniAccumuloConfig(folder.newFolder("miniAccumulo"), secret);
cluster = new MiniAccumuloCluster(cfg);
cluster.start();
-
}
@AfterClass
@@ -53,6 +54,22 @@ public class MetaSplitTest {
folder.delete();
}
+ @Test(expected = AccumuloException.class)
+ public void testRootTableSplit() throws Exception {
+ Connector connector = cluster.getConnector("root", secret);
+ TableOperations opts = connector.tableOperations();
+ SortedSet<Text> splits = new TreeSet<Text>();
+ splits.add(new Text("5"));
+ opts.addSplits(RootTable.NAME, splits);
+ }
+
+ @Test
+ public void testRootTableMerge() throws Exception {
+ Connector connector = cluster.getConnector("root", secret);
+ TableOperations opts = connector.tableOperations();
+ opts.merge(RootTable.NAME, null, null);
+ }
+
private void addSplits(TableOperations opts, String... points) throws Exception {
SortedSet<Text> splits = new TreeSet<Text>();
for (String point : points) {
@@ -62,7 +79,7 @@ public class MetaSplitTest {
}
@Test(timeout = 60000)
- public void testMetaSplit() throws Exception {
+ public void testMetadataTableSplit() throws Exception {
Connector connector = cluster.getConnector("root", secret);
TableOperations opts = connector.tableOperations();
for (int i = 1; i <= 10; i++) {
http://git-wip-us.apache.org/repos/asf/accumulo/blob/446a37a9/test/src/test/java/org/apache/accumulo/test/TestAccumuloSplitRecovery.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/TestAccumuloSplitRecovery.java b/test/src/test/java/org/apache/accumulo/test/TestAccumuloSplitRecovery.java
index 31eaf41..c481f91 100644
--- a/test/src/test/java/org/apache/accumulo/test/TestAccumuloSplitRecovery.java
+++ b/test/src/test/java/org/apache/accumulo/test/TestAccumuloSplitRecovery.java
@@ -30,9 +30,11 @@ import org.apache.accumulo.core.data.KeyExtent;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.core.metadata.MetadataTable;
+import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection;
+import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.DataFileColumnFamily;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.security.TablePermission;
-import org.apache.accumulo.core.util.MetadataTable;
import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.accumulo.minicluster.MiniAccumuloCluster;
import org.apache.hadoop.io.Text;
@@ -71,7 +73,7 @@ public class TestAccumuloSplitRecovery {
String tableId = connector.tableOperations().tableIdMap().get(tablename);
Scanner scanner = connector.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
scanner.setRange(new Range(new Text(tableId + ";"), new Text(tableId + "<")));
- scanner.fetchColumnFamily(MetadataTable.CURRENT_LOCATION_COLUMN_FAMILY);
+ scanner.fetchColumnFamily(TabletsSection.CurrentLocationColumnFamily.NAME);
for (@SuppressWarnings("unused")
Entry<Key,Value> entry : scanner) {
return false;
@@ -104,8 +106,8 @@ public class TestAccumuloSplitRecovery {
KeyExtent extent = new KeyExtent(new Text(tableId), null, new Text("b"));
Mutation m = extent.getPrevRowUpdateMutation();
- MetadataTable.SPLIT_RATIO_COLUMN.put(m, new Value(Double.toString(0.5).getBytes()));
- MetadataTable.OLD_PREV_ROW_COLUMN.put(m, KeyExtent.encodePrevEndRow(null));
+ TabletsSection.TabletColumnFamily.SPLIT_RATIO_COLUMN.put(m, new Value(Double.toString(0.5).getBytes()));
+ TabletsSection.TabletColumnFamily.OLD_PREV_ROW_COLUMN.put(m, KeyExtent.encodePrevEndRow(null));
bw = connector.createBatchWriter(MetadataTable.NAME, new BatchWriterConfig());
bw.addMutation(m);
@@ -115,15 +117,15 @@ public class TestAccumuloSplitRecovery {
Scanner scanner = connector.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
scanner.setRange(extent.toMetadataRange());
- scanner.fetchColumnFamily(MetadataTable.DATAFILE_COLUMN_FAMILY);
+ scanner.fetchColumnFamily(DataFileColumnFamily.NAME);
KeyExtent extent2 = new KeyExtent(new Text(tableId), new Text("b"), null);
m = extent2.getPrevRowUpdateMutation();
- MetadataTable.DIRECTORY_COLUMN.put(m, new Value("/t2".getBytes()));
- MetadataTable.TIME_COLUMN.put(m, new Value("M0".getBytes()));
+ TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.put(m, new Value("/t2".getBytes()));
+ TabletsSection.ServerColumnFamily.TIME_COLUMN.put(m, new Value("M0".getBytes()));
for (Entry<Key,Value> entry : scanner) {
- m.put(MetadataTable.DATAFILE_COLUMN_FAMILY, entry.getKey().getColumnQualifier(), entry.getValue());
+ m.put(DataFileColumnFamily.NAME, entry.getKey().getColumnQualifier(), entry.getValue());
}
bw.addMutation(m);
http://git-wip-us.apache.org/repos/asf/accumulo/blob/446a37a9/test/src/test/java/org/apache/accumulo/test/VolumeTest.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/VolumeTest.java b/test/src/test/java/org/apache/accumulo/test/VolumeTest.java
index 896f387..18b0c9a 100644
--- a/test/src/test/java/org/apache/accumulo/test/VolumeTest.java
+++ b/test/src/test/java/org/apache/accumulo/test/VolumeTest.java
@@ -33,8 +33,8 @@ import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.DataFileColumnFamily;
import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.core.util.MetadataTable;
import org.apache.accumulo.minicluster.MiniAccumuloCluster;
import org.apache.accumulo.minicluster.MiniAccumuloConfig;
import org.apache.hadoop.fs.Path;
@@ -104,7 +104,7 @@ public class VolumeTest {
// verify the new files are written to the different volumes
scanner = connector.createScanner("!METADATA", Authorizations.EMPTY);
scanner.setRange(new Range("1", "1<"));
- scanner.fetchColumnFamily(MetadataTable.DATAFILE_COLUMN_FAMILY);
+ scanner.fetchColumnFamily(DataFileColumnFamily.NAME);
int fileCount = 0;
for (Entry<Key,Value> entry : scanner) {
boolean inV1 = entry.getKey().getColumnQualifier().toString().contains(v1.toString());
http://git-wip-us.apache.org/repos/asf/accumulo/blob/446a37a9/test/src/test/java/org/apache/accumulo/test/functional/CompactionIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/CompactionIT.java b/test/src/test/java/org/apache/accumulo/test/functional/CompactionIT.java
index 0a55566..5b1a83f 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/CompactionIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/CompactionIT.java
@@ -33,9 +33,10 @@ import org.apache.accumulo.core.client.Scanner;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.core.metadata.MetadataTable;
+import org.apache.accumulo.core.metadata.schema.MetadataSchema;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.util.CachedConfiguration;
-import org.apache.accumulo.core.util.MetadataTable;
import org.apache.accumulo.minicluster.MiniAccumuloConfig;
import org.apache.accumulo.server.util.Admin;
import org.apache.accumulo.test.VerifyIngest;
@@ -44,17 +45,16 @@ import org.junit.Test;
public class CompactionIT extends MacTest {
-
@Override
public void configure(MiniAccumuloConfig cfg) {
- Map<String, String> map = new HashMap<String, String>();
+ Map<String,String> map = new HashMap<String,String>();
map.put(Property.TSERV_MAJC_THREAD_MAXOPEN.getKey(), "4");
map.put(Property.TSERV_MAJC_DELAY.getKey(), "1");
map.put(Property.TSERV_MAJC_MAXCONCURRENT.getKey(), "1");
cfg.setSiteConfig(map);
}
- @Test(timeout=120*1000)
+ @Test(timeout = 120 * 1000)
public void test() throws Exception {
final Connector c = getConnector();
c.tableOperations().create("test_ingest");
@@ -68,9 +68,10 @@ public class CompactionIT extends MacTest {
for (int count = 0; count < 5; count++) {
List<Thread> threads = new ArrayList<Thread>();
final int span = 500000 / 59;
- for (int i = 0; i < 500000; i += 500000/59 ) {
+ for (int i = 0; i < 500000; i += 500000 / 59) {
final int finalI = i;
Thread t = new Thread() {
+ @Override
public void run() {
try {
VerifyIngest.Opts opts = new VerifyIngest.Opts();
@@ -97,13 +98,14 @@ public class CompactionIT extends MacTest {
assertTrue(finalCount < beforeCount);
assertEquals(0, cluster.exec(Admin.class, "stopAll").waitFor());
}
-
+
private int countFiles(Connector c) throws Exception {
Scanner s = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
- s.fetchColumnFamily(MetadataTable.TABLET_COLUMN_FAMILY);
- s.fetchColumnFamily(MetadataTable.DATAFILE_COLUMN_FAMILY);
+ s.fetchColumnFamily(MetadataSchema.TabletsSection.TabletColumnFamily.NAME);
+ s.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
int i = 0;
- for (@SuppressWarnings("unused") Entry<Key,Value> entry : s)
+ for (@SuppressWarnings("unused")
+ Entry<Key,Value> entry : s)
i++;
return i;
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/446a37a9/test/src/test/java/org/apache/accumulo/test/functional/DynamicThreadPoolsIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/DynamicThreadPoolsIT.java b/test/src/test/java/org/apache/accumulo/test/functional/DynamicThreadPoolsIT.java
index 96e425c..6e4e1a7 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/DynamicThreadPoolsIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/DynamicThreadPoolsIT.java
@@ -44,7 +44,7 @@ public class DynamicThreadPoolsIT extends MacTest {
cfg.setSiteConfig(Collections.singletonMap(Property.TSERV_MAJC_DELAY.getKey(), "1"));
}
- @Test(timeout=90*1000)
+ @Test(timeout = 90 * 1000)
public void test() throws Exception {
Connector c = getConnector();
TestIngest.Opts opts = new TestIngest.Opts();
@@ -74,7 +74,7 @@ public class DynamicThreadPoolsIT extends MacTest {
if (client != null)
MasterClient.close(client);
}
- for (TabletServerStatus server: stats.tServerInfo) {
+ for (TabletServerStatus server : stats.tServerInfo) {
for (TableInfo table : server.tableMap.values()) {
count += table.majors.running;
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/446a37a9/test/src/test/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java b/test/src/test/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java
index 1466153..4af2c96 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java
@@ -37,8 +37,9 @@ import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.core.metadata.MetadataTable;
+import org.apache.accumulo.core.metadata.schema.MetadataSchema;
import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.core.util.MetadataTable;
import org.apache.accumulo.minicluster.MiniAccumuloCluster;
import org.apache.accumulo.minicluster.MiniAccumuloCluster.LogWriter;
import org.apache.accumulo.test.TestIngest;
@@ -51,8 +52,8 @@ public class FunctionalTestUtils {
Scanner scanner = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
String tableId = c.tableOperations().tableIdMap().get(tableName);
scanner.setRange(new Range(new Text(tableId + ";"), true, new Text(tableId + "<"), true));
- scanner.fetchColumnFamily(MetadataTable.DATAFILE_COLUMN_FAMILY);
- MetadataTable.PREV_ROW_COLUMN.fetch(scanner);
+ scanner.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME);
+ MetadataSchema.TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.fetch(scanner);
HashMap<Text,Integer> tabletFileCounts = new HashMap<Text,Integer>();
@@ -63,7 +64,7 @@ public class FunctionalTestUtils {
Integer count = tabletFileCounts.get(row);
if (count == null)
count = 0;
- if (entry.getKey().getColumnFamily().equals(MetadataTable.DATAFILE_COLUMN_FAMILY)) {
+ if (entry.getKey().getColumnFamily().equals(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME)) {
count = count + 1;
}
@@ -88,7 +89,7 @@ public class FunctionalTestUtils {
fs.delete(failPath, true);
fs.mkdirs(failPath);
- c.tableOperations().importDirectory(table, dir, failDir, false);
+ c.tableOperations().importDirectory(table, dir, failDir, false);
if (fs.listStatus(failPath).length > 0) {
throw new Exception("Some files failed to bulk import");
@@ -159,6 +160,5 @@ public class FunctionalTestUtils {
static Mutation nm(String row, String cf, String cq, String value) {
return nm(row, cf, cq, new Value(value.getBytes()));
}
-
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/446a37a9/test/src/test/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java b/test/src/test/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java
index eb5c0fa..3d1e787 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java
@@ -28,9 +28,10 @@ import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.conf.Property;
import org.apache.accumulo.core.data.Mutation;
import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.core.metadata.MetadataTable;
+import org.apache.accumulo.core.metadata.schema.MetadataSchema;
import org.apache.accumulo.core.security.TablePermission;
import org.apache.accumulo.core.util.CachedConfiguration;
-import org.apache.accumulo.core.util.MetadataTable;
import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.accumulo.minicluster.MemoryUnit;
import org.apache.accumulo.minicluster.MiniAccumuloConfig;
@@ -47,15 +48,15 @@ public class GarbageCollectorIT extends MacTest {
@Override
public void configure(MiniAccumuloConfig cfg) {
- Map<String, String> settings = new HashMap<String, String>();
+ Map<String,String> settings = new HashMap<String,String>();
settings.put(Property.GC_CYCLE_START.getKey(), "1");
settings.put(Property.GC_CYCLE_DELAY.getKey(), "1");
settings.put(Property.TSERV_MAXMEM.getKey(), "5K");
settings.put(Property.TSERV_MAJC_DELAY.getKey(), "1");
cfg.setSiteConfig(settings);
}
-
- @Test(timeout=60*1000)
+
+ @Test(timeout = 60 * 1000)
public void gcTest() throws Exception {
Connector c = getConnector();
c.tableOperations().create("test_ingest");
@@ -75,31 +76,32 @@ public class GarbageCollectorIT extends MacTest {
before = more;
}
Process gc = cluster.exec(SimpleGarbageCollector.class);
- UtilWaitThread.sleep(5*1000);
+ UtilWaitThread.sleep(5 * 1000);
int after = countFiles();
VerifyIngest.verifyIngest(c, vopts, new ScannerOpts());
assertTrue(after < before);
gc.destroy();
}
- @Test(timeout=60*1000)
+ @Test(timeout = 60 * 1000)
public void gcLotsOfCandidatesIT() throws Exception {
log.info("Filling !METADATA table with bogus delete flags");
Connector c = getConnector();
addEntries(c, new BatchWriterOpts());
cluster.getConfig().setDefaultMemory(10, MemoryUnit.MEGABYTE);
Process gc = cluster.exec(SimpleGarbageCollector.class);
- UtilWaitThread.sleep(10*1000);
+ UtilWaitThread.sleep(10 * 1000);
String output = FunctionalTestUtils.readAll(cluster, SimpleGarbageCollector.class, gc);
gc.destroy();
assertTrue(output.contains("delete candidates has exceeded"));
}
-
+
private int countFiles() throws Exception {
FileSystem fs = FileSystem.get(CachedConfiguration.getInstance());
int result = 0;
- Path path = new Path(cluster.getConfig().getDir()+"/accumulo/tables/1/*/*.rf");
- for (@SuppressWarnings("unused") FileStatus entry : fs.globStatus(path)) {
+ Path path = new Path(cluster.getConfig().getDir() + "/accumulo/tables/1/*/*.rf");
+ for (@SuppressWarnings("unused")
+ FileStatus entry : fs.globStatus(path)) {
result++;
}
return result;
@@ -111,7 +113,7 @@ public class GarbageCollectorIT extends MacTest {
for (int i = 0; i < 100000; ++i) {
final Text emptyText = new Text("");
- Text row = new Text(String.format("%s%s%020d%s", MetadataTable.DELETED_RANGE.getStartKey().getRow().toString(), "/", i,
+ Text row = new Text(String.format("%s%s%020d%s", MetadataSchema.DeletesSection.getRowPrefix(), "/", i,
"aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeeeffffffffffgggggggggghhhhhhhhhhiiiiiiiiiijjjjjjjjjj"));
Mutation delFlag = new Mutation(row);
delFlag.put(emptyText, emptyText, new Value(new byte[] {}));
http://git-wip-us.apache.org/repos/asf/accumulo/blob/446a37a9/test/src/test/java/org/apache/accumulo/test/functional/MergeMetaIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/MergeMetaIT.java b/test/src/test/java/org/apache/accumulo/test/functional/MergeMetaIT.java
index bbfdcbe..2041232 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/MergeMetaIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/MergeMetaIT.java
@@ -16,7 +16,8 @@
*/
package org.apache.accumulo.test.functional;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import java.util.Map.Entry;
import java.util.SortedSet;
@@ -26,16 +27,17 @@ import org.apache.accumulo.core.client.Connector;
import org.apache.accumulo.core.client.Scanner;
import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Value;
+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.security.Authorizations;
-import org.apache.accumulo.core.util.MetadataTable;
-import org.apache.accumulo.core.util.RootTable;
import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.hadoop.io.Text;
import org.junit.Test;
public class MergeMetaIT extends MacTest {
- @Test(timeout=30*1000)
+ @Test(timeout = 30 * 1000)
public void mergeMeta() throws Exception {
Connector c = getConnector();
SortedSet<Text> splits = new TreeSet<Text>();
@@ -47,11 +49,12 @@ public class MergeMetaIT extends MacTest {
c.tableOperations().create(tableName);
}
c.tableOperations().merge(MetadataTable.NAME, null, null);
- UtilWaitThread.sleep(2*1000);
+ UtilWaitThread.sleep(2 * 1000);
Scanner s = c.createScanner(RootTable.NAME, Authorizations.EMPTY);
- s.setRange(MetadataTable.DELETED_RANGE);
+ s.setRange(MetadataSchema.DeletesSection.getRange());
int count = 0;
- for (@SuppressWarnings("unused") Entry<Key,Value> e : s) {
+ for (@SuppressWarnings("unused")
+ Entry<Key,Value> e : s) {
count++;
}
assertTrue(count > 0);