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/03 20:32:53 UTC
svn commit: r1499510 [6/7] - in /accumulo/trunk:
core/src/main/java/org/apache/accumulo/core/client/
core/src/main/java/org/apache/accumulo/core/client/admin/
core/src/main/java/org/apache/accumulo/core/client/impl/
core/src/main/java/org/apache/accumu...
Modified: accumulo/trunk/server/src/test/java/org/apache/accumulo/server/util/CloneTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/test/java/org/apache/accumulo/server/util/CloneTest.java?rev=1499510&r1=1499509&r2=1499510&view=diff
==============================================================================
--- accumulo/trunk/server/src/test/java/org/apache/accumulo/server/util/CloneTest.java (original)
+++ accumulo/trunk/server/src/test/java/org/apache/accumulo/server/util/CloneTest.java Wed Jul 3 18:32:51 2013
@@ -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) {}
Modified: accumulo/trunk/server/src/test/java/org/apache/accumulo/server/util/TabletIteratorTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/test/java/org/apache/accumulo/server/util/TabletIteratorTest.java?rev=1499510&r1=1499509&r2=1499510&view=diff
==============================================================================
--- accumulo/trunk/server/src/test/java/org/apache/accumulo/server/util/TabletIteratorTest.java (original)
+++ accumulo/trunk/server/src/test/java/org/apache/accumulo/server/util/TabletIteratorTest.java Wed Jul 3 18:32:51 2013
@@ -31,8 +31,10 @@ 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.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
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
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);
Modified: accumulo/trunk/test/src/main/java/org/apache/accumulo/test/QueryMetadataTable.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/main/java/org/apache/accumulo/test/QueryMetadataTable.java?rev=1499510&r1=1499509&r2=1499510&view=diff
==============================================================================
--- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/QueryMetadataTable.java (original)
+++ accumulo/trunk/test/src/main/java/org/apache/accumulo/test/QueryMetadataTable.java Wed Jul 3 18:32:51 2013
@@ -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();
}
Modified: accumulo/trunk/test/src/main/java/org/apache/accumulo/test/TestMultiTableIngest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/main/java/org/apache/accumulo/test/TestMultiTableIngest.java?rev=1499510&r1=1499509&r2=1499510&view=diff
==============================================================================
--- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/TestMultiTableIngest.java (original)
+++ accumulo/trunk/test/src/main/java/org/apache/accumulo/test/TestMultiTableIngest.java Wed Jul 3 18:32:51 2013
@@ -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;
}
Modified: accumulo/trunk/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousStatsCollector.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousStatsCollector.java?rev=1499510&r1=1499509&r2=1499510&view=diff
==============================================================================
--- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousStatsCollector.java (original)
+++ accumulo/trunk/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousStatsCollector.java Wed Jul 3 18:32:51 2013
@@ -36,8 +36,9 @@ import org.apache.accumulo.core.master.t
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());
Modified: accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/FunctionalTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/FunctionalTest.java?rev=1499510&r1=1499509&r2=1499510&view=diff
==============================================================================
--- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/FunctionalTest.java (original)
+++ accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/FunctionalTest.java Wed Jul 3 18:32:51 2013
@@ -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;
}
Modified: accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/SplitRecoveryTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/SplitRecoveryTest.java?rev=1499510&r1=1499509&r2=1499510&view=diff
==============================================================================
--- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/SplitRecoveryTest.java (original)
+++ accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/SplitRecoveryTest.java Wed Jul 3 18:32:51 2013
@@ -36,9 +36,12 @@ 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.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.securi
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 F
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 F
}
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 F
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 F
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 F
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 F
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);
}
Modified: accumulo/trunk/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java?rev=1499510&r1=1499509&r2=1499510&view=diff
==============================================================================
--- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java (original)
+++ accumulo/trunk/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java Wed Jul 3 18:32:51 2013
@@ -35,9 +35,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.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);
Modified: accumulo/trunk/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java?rev=1499510&r1=1499509&r2=1499510&view=diff
==============================================================================
--- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java (original)
+++ accumulo/trunk/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java Wed Jul 3 18:32:51 2013
@@ -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.iterator
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.T
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);
Modified: accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/AddSplits.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/AddSplits.java?rev=1499510&r1=1499509&r2=1499510&view=diff
==============================================================================
--- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/AddSplits.java (original)
+++ accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/AddSplits.java Wed Jul 3 18:32:51 2013
@@ -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;
Modified: accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CheckBalance.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CheckBalance.java?rev=1499510&r1=1499509&r2=1499510&view=diff
==============================================================================
--- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CheckBalance.java (original)
+++ accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CheckBalance.java Wed Jul 3 18:32:51 2013
@@ -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);
Modified: accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Merge.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Merge.java?rev=1499510&r1=1499509&r2=1499510&view=diff
==============================================================================
--- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Merge.java (original)
+++ accumulo/trunk/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Merge.java Wed Jul 3 18:32:51 2013
@@ -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;
Modified: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/MetaSplitTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/MetaSplitTest.java?rev=1499510&r1=1499509&r2=1499510&view=diff
==============================================================================
--- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/MetaSplitTest.java (original)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/MetaSplitTest.java Wed Jul 3 18:32:51 2013
@@ -21,9 +21,11 @@ import static org.junit.Assert.assertEqu
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++) {
Modified: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/TestAccumuloSplitRecovery.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/TestAccumuloSplitRecovery.java?rev=1499510&r1=1499509&r2=1499510&view=diff
==============================================================================
--- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/TestAccumuloSplitRecovery.java (original)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/TestAccumuloSplitRecovery.java Wed Jul 3 18:32:51 2013
@@ -30,9 +30,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.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);
Modified: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/VolumeTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/VolumeTest.java?rev=1499510&r1=1499509&r2=1499510&view=diff
==============================================================================
--- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/VolumeTest.java (original)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/VolumeTest.java Wed Jul 3 18:32:51 2013
@@ -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());
Modified: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/CompactionIT.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/CompactionIT.java?rev=1499510&r1=1499509&r2=1499510&view=diff
==============================================================================
--- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/CompactionIT.java (original)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/CompactionIT.java Wed Jul 3 18:32:51 2013
@@ -33,9 +33,10 @@ import org.apache.accumulo.core.client.S
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 MacTes
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 MacTes
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;
}
Modified: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/DynamicThreadPoolsIT.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/DynamicThreadPoolsIT.java?rev=1499510&r1=1499509&r2=1499510&view=diff
==============================================================================
--- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/DynamicThreadPoolsIT.java (original)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/DynamicThreadPoolsIT.java Wed Jul 3 18:32:51 2013
@@ -44,7 +44,7 @@ public class DynamicThreadPoolsIT extend
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 extend
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;
}
Modified: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java?rev=1499510&r1=1499509&r2=1499510&view=diff
==============================================================================
--- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java (original)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/FunctionalTestUtils.java Wed Jul 3 18:32:51 2013
@@ -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()));
}
-
}
Modified: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java?rev=1499510&r1=1499509&r2=1499510&view=diff
==============================================================================
--- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java (original)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java Wed Jul 3 18:32:51 2013
@@ -28,9 +28,10 @@ import org.apache.accumulo.core.client.C
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
@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
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
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[] {}));
Modified: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/MergeMetaIT.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/MergeMetaIT.java?rev=1499510&r1=1499509&r2=1499510&view=diff
==============================================================================
--- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/MergeMetaIT.java (original)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/MergeMetaIT.java Wed Jul 3 18:32:51 2013
@@ -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.C
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);
Modified: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/PermissionsIT.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/PermissionsIT.java?rev=1499510&r1=1499509&r2=1499510&view=diff
==============================================================================
--- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/PermissionsIT.java (original)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/PermissionsIT.java Wed Jul 3 18:32:51 2013
@@ -40,10 +40,10 @@ import org.apache.accumulo.core.conf.Pro
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.core.metadata.MetadataTable;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.security.SystemPermission;
import org.apache.accumulo.core.security.TablePermission;
-import org.apache.accumulo.core.util.MetadataTable;
import org.apache.hadoop.io.Text;
import org.junit.Test;
@@ -51,7 +51,7 @@ public class PermissionsIT extends MacTe
private static final String TEST_USER = "test_user";
private static final PasswordToken TEST_PASS = new PasswordToken("test_password");
- @Test(timeout=60*1000)
+ @Test(timeout = 60 * 1000)
public void systemPermissionsTest() throws Exception {
// verify that the test is being run by root
Connector c = getConnector();
@@ -87,16 +87,16 @@ public class PermissionsIT extends MacTe
}
}
- static Map<String, String> map(Iterable<Entry<String,String>> i) {
- Map<String, String> result = new HashMap<String, String>();
- for (Entry<String, String> e : i) {
+ static Map<String,String> map(Iterable<Entry<String,String>> i) {
+ Map<String,String> result = new HashMap<String,String>();
+ for (Entry<String,String> e : i) {
result.put(e.getKey(), e.getValue());
}
return result;
}
private static void testMissingSystemPermission(Connector root_conn, Connector test_user_conn, SystemPermission perm) throws AccumuloException,
- TableExistsException, AccumuloSecurityException, TableNotFoundException {
+ TableExistsException, AccumuloSecurityException, TableNotFoundException {
String tableName, user, password = "password";
log.debug("Confirming that the lack of the " + perm + " permission properly restricts the user");
@@ -196,7 +196,7 @@ public class PermissionsIT extends MacTe
}
private static void testGrantedSystemPermission(Connector root_conn, Connector test_user_conn, SystemPermission perm) throws AccumuloException,
- AccumuloSecurityException, TableNotFoundException, TableExistsException {
+ AccumuloSecurityException, TableNotFoundException, TableExistsException {
String tableName, user, password = "password";
log.debug("Confirming that the presence of the " + perm + " permission properly permits the user");
@@ -260,7 +260,7 @@ public class PermissionsIT extends MacTe
}
private static void verifyHasOnlyTheseSystemPermissions(Connector root_conn, String user, SystemPermission... perms) throws AccumuloException,
- AccumuloSecurityException {
+ AccumuloSecurityException {
List<SystemPermission> permList = Arrays.asList(perms);
for (SystemPermission p : SystemPermission.values()) {
if (permList.contains(p)) {
@@ -276,7 +276,7 @@ public class PermissionsIT extends MacTe
}
private static void verifyHasNoSystemPermissions(Connector root_conn, String user, SystemPermission... perms) throws AccumuloException,
- AccumuloSecurityException {
+ AccumuloSecurityException {
for (SystemPermission p : perms)
if (root_conn.securityOperations().hasSystemPermission(user, p))
throw new IllegalStateException(user + " SHOULD NOT have system permission " + p);
@@ -292,8 +292,7 @@ public class PermissionsIT extends MacTe
Connector test_user_conn = c.getInstance().getConnector(TEST_USER, TEST_PASS);
// check for read-only access to metadata table
- verifyHasOnlyTheseTablePermissions(c, c.whoami(), MetadataTable.NAME, TablePermission.READ,
- TablePermission.ALTER_TABLE);
+ verifyHasOnlyTheseTablePermissions(c, c.whoami(), MetadataTable.NAME, TablePermission.READ, TablePermission.ALTER_TABLE);
verifyHasOnlyTheseTablePermissions(c, TEST_USER, MetadataTable.NAME, TablePermission.READ);
// test each permission
@@ -313,8 +312,7 @@ public class PermissionsIT extends MacTe
}
}
- private void createTestTable(Connector c) throws Exception,
- MutationsRejectedException {
+ private void createTestTable(Connector c) throws Exception, MutationsRejectedException {
if (!c.tableOperations().exists(TEST_TABLE)) {
// create the test table
c.tableOperations().create(TEST_TABLE);
@@ -364,8 +362,7 @@ public class PermissionsIT extends MacTe
writer.close();
} catch (MutationsRejectedException e1) {
if (e1.getAuthorizationFailuresMap().size() > 0)
- throw new AccumuloSecurityException(test_user_conn.whoami(), org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode.PERMISSION_DENIED,
- e1);
+ throw new AccumuloSecurityException(test_user_conn.whoami(), org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode.PERMISSION_DENIED, e1);
}
throw new IllegalStateException("Should NOT be able to write to a table");
} catch (AccumuloSecurityException e) {
@@ -411,7 +408,7 @@ public class PermissionsIT extends MacTe
}
private static void testGrantedTablePermission(Connector root_conn, Connector test_user_conn, TablePermission perm) throws AccumuloException,
- TableExistsException, AccumuloSecurityException, TableNotFoundException, MutationsRejectedException {
+ TableExistsException, AccumuloSecurityException, TableNotFoundException, MutationsRejectedException {
Scanner scanner;
BatchWriter writer;
Mutation m;
@@ -451,7 +448,7 @@ public class PermissionsIT extends MacTe
}
private static void verifyHasOnlyTheseTablePermissions(Connector root_conn, String user, String table, TablePermission... perms) throws AccumuloException,
- AccumuloSecurityException {
+ AccumuloSecurityException {
List<TablePermission> permList = Arrays.asList(perms);
for (TablePermission p : TablePermission.values()) {
if (permList.contains(p)) {
@@ -467,7 +464,7 @@ public class PermissionsIT extends MacTe
}
private static void verifyHasNoTablePermissions(Connector root_conn, String user, String table, TablePermission... perms) throws AccumuloException,
- AccumuloSecurityException {
+ AccumuloSecurityException {
for (TablePermission p : perms)
if (root_conn.securityOperations().hasTablePermission(user, table, p))
throw new IllegalStateException(user + " SHOULD NOT have table permission " + p + " for table " + table);
Modified: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ReadWriteIT.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ReadWriteIT.java?rev=1499510&r1=1499509&r2=1499510&view=diff
==============================================================================
--- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ReadWriteIT.java (original)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ReadWriteIT.java Wed Jul 3 18:32:51 2013
@@ -44,8 +44,9 @@ import org.apache.accumulo.core.data.Mut
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
import org.apache.accumulo.core.file.rfile.PrintInfo;
+import org.apache.accumulo.core.metadata.MetadataTable;
+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.server.monitor.Monitor;
import org.apache.accumulo.server.util.Admin;
import org.apache.accumulo.test.TestIngest;
@@ -60,7 +61,7 @@ public class ReadWriteIT extends MacTest
static final int COLS = 1;
static final String COLF = "colf";
- @Test(timeout=60*1000)
+ @Test(timeout = 60 * 1000)
public void sunnyDay() throws Exception {
// Start accumulo, create a table, insert some data, verify we can read it out.
// Shutdown cleanly.
@@ -99,6 +100,7 @@ public class ReadWriteIT extends MacTest
private static void verify(Connector connector, int rows, int cols, int width, int offset) throws Exception {
verify(connector, rows, cols, width, offset, COLF);
}
+
private static void verify(Connector connector, int rows, int cols, int width, int offset, String colf) throws Exception {
ScannerOpts scannerOpts = new ScannerOpts();
VerifyIngest.Opts opts = new VerifyIngest.Opts();
@@ -110,11 +112,11 @@ public class ReadWriteIT extends MacTest
VerifyIngest.verifyIngest(connector, opts, scannerOpts);
}
- public static String[] args(String ...args) {
+ public static String[] args(String... args) {
return args;
}
- @Test(timeout=60*1000)
+ @Test(timeout = 60 * 1000)
public void multiTableTest() throws Exception {
// Write to multiple tables
String instance = cluster.getInstanceName();
@@ -123,7 +125,7 @@ public class ReadWriteIT extends MacTest
TestMultiTableIngest.main(args("--count", "" + ROWS, "--readonly", "-u", "root", "-i", instance, "-z", keepers, "-p", PASSWORD));
}
- @Test(timeout=60*1000)
+ @Test(timeout = 60 * 1000)
public void largeTest() throws Exception {
// write a few large values
Connector connector = getConnector();
@@ -131,13 +133,13 @@ public class ReadWriteIT extends MacTest
verify(connector, 2, 1, 500000, 0);
}
- @Test(timeout=60*1000)
+ @Test(timeout = 60 * 1000)
public void interleaved() throws Exception {
// read and write concurrently
final Connector connector = getConnector();
interleaveTest(connector);
}
-
+
static void interleaveTest(final Connector connector) throws Exception {
final AtomicBoolean fail = new AtomicBoolean(false);
final int CHUNKSIZE = ROWS / 10;
@@ -146,6 +148,7 @@ public class ReadWriteIT extends MacTest
for (i = 0; i < ROWS; i += CHUNKSIZE) {
final int start = i;
Thread verify = new Thread() {
+ @Override
public void run() {
try {
verify(connector, CHUNKSIZE, 1, 50, start);
@@ -161,7 +164,9 @@ public class ReadWriteIT extends MacTest
verify(connector, CHUNKSIZE, 1, 50, i);
}
- public static Text t(String s) { return new Text(s); }
+ public static Text t(String s) {
+ return new Text(s);
+ }
public static Mutation m(String row, String cf, String cq, String value) {
Mutation m = new Mutation(t(row));
@@ -169,10 +174,9 @@ public class ReadWriteIT extends MacTest
return m;
}
-
- @Test(timeout=60*1000)
+ @Test(timeout = 60 * 1000)
public void localityGroupPerf() throws Exception {
- // verify that locality groups can make look-ups faster
+ // verify that locality groups can make look-ups faster
final Connector connector = getConnector();
connector.tableOperations().create("test_ingest");
connector.tableOperations().setProperty("test_ingest", "table.group.g1", "colf");
@@ -185,25 +189,27 @@ public class ReadWriteIT extends MacTest
long now = System.currentTimeMillis();
Scanner scanner = connector.createScanner("test_ingest", Authorizations.EMPTY);
scanner.fetchColumnFamily(new Text("colf"));
- for (@SuppressWarnings("unused") Entry<Key,Value> entry : scanner)
+ for (@SuppressWarnings("unused")
+ Entry<Key,Value> entry : scanner)
;
long diff = System.currentTimeMillis() - now;
now = System.currentTimeMillis();
scanner = connector.createScanner("test_ingest", Authorizations.EMPTY);
scanner.fetchColumnFamily(new Text("colf2"));
- for (@SuppressWarnings("unused") Entry<Key,Value> entry : scanner)
+ for (@SuppressWarnings("unused")
+ Entry<Key,Value> entry : scanner)
;
bw.close();
long diff2 = System.currentTimeMillis() - now;
assertTrue(diff2 < diff);
}
- @Test(timeout=60*1000)
+ @Test(timeout = 60 * 1000)
public void sunnyLG() throws Exception {
// create a locality group, write to it and ensure it exists in the RFiles that result
final Connector connector = getConnector();
connector.tableOperations().create("test_ingest");
- Map<String, Set<Text>> groups = new TreeMap<String, Set<Text>>();
+ Map<String,Set<Text>> groups = new TreeMap<String,Set<Text>>();
groups.put("g1", Collections.singleton(t("colf")));
connector.tableOperations().setLocalityGroups("test_ingest", groups);
ingest(connector, 2000, 1, 50, 0);
@@ -212,9 +218,9 @@ public class ReadWriteIT extends MacTest
BatchScanner bscanner = connector.createBatchScanner(MetadataTable.NAME, Authorizations.EMPTY, 1);
String tableId = connector.tableOperations().tableIdMap().get("test_ingest");
bscanner.setRanges(Collections.singletonList(new Range(new Text(tableId + ";"), new Text(tableId + "<"))));
- bscanner.fetchColumnFamily(MetadataTable.DATAFILE_COLUMN_FAMILY);
+ bscanner.fetchColumnFamily(DataFileColumnFamily.NAME);
boolean foundFile = false;
- for (Entry<Key,Value> entry: bscanner) {
+ for (Entry<Key,Value> entry : bscanner) {
foundFile = true;
Process info = cluster.exec(PrintInfo.class, entry.getKey().getColumnQualifier().toString());
assertEquals(0, info.waitFor());
@@ -226,34 +232,24 @@ public class ReadWriteIT extends MacTest
assertTrue(foundFile);
}
- @Test(timeout=90*1000)
+ @Test(timeout = 90 * 1000)
public void localityGroupChange() throws Exception {
// Make changes to locality groups and ensure nothing is lostssh
final Connector connector = getConnector();
TableOperations to = connector.tableOperations();
to.create("test_ingest");
- String[] config = new String[] {
- "lg1:colf",
- null,
- "lg1:colf,xyz",
- "lg1:colf,xyz;lg2:c1,c2"
- };
+ String[] config = new String[] {"lg1:colf", null, "lg1:colf,xyz", "lg1:colf,xyz;lg2:c1,c2"};
int i = 0;
for (String cfg : config) {
to.setLocalityGroups("test_ingest", getGroups(cfg));
- ingest(connector, ROWS * (i+1), 1, 50, ROWS * i);
+ ingest(connector, ROWS * (i + 1), 1, 50, ROWS * i);
to.flush("test_ingest", null, null, true);
- verify(connector, 0, 1, 50, ROWS * (i+1));
+ verify(connector, 0, 1, 50, ROWS * (i + 1));
i++;
}
to.delete("test_ingest");
to.create("test_ingest");
- config = new String[] {
- "lg1:colf",
- null,
- "lg1:colf,xyz",
- "lg1:colf;lg2:colf",
- };
+ config = new String[] {"lg1:colf", null, "lg1:colf,xyz", "lg1:colf;lg2:colf",};
i = 1;
for (String cfg : config) {
ingest(connector, ROWS * i, 1, 50, 0);
@@ -265,11 +261,11 @@ public class ReadWriteIT extends MacTest
i++;
}
}
-
+
private Map<String,Set<Text>> getGroups(String cfg) {
- Map<String, Set<Text>> groups = new TreeMap<String, Set<Text>>();
+ Map<String,Set<Text>> groups = new TreeMap<String,Set<Text>>();
if (cfg != null) {
- for (String group: cfg.split(";")) {
+ for (String group : cfg.split(";")) {
String[] parts = group.split(":");
Set<Text> cols = new HashSet<Text>();
for (String col : parts[1].split(",")) {
@@ -280,5 +276,5 @@ public class ReadWriteIT extends MacTest
}
return groups;
}
-
+
}
Modified: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/SplitIT.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/SplitIT.java?rev=1499510&r1=1499509&r2=1499510&view=diff
==============================================================================
--- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/SplitIT.java (original)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/SplitIT.java Wed Jul 3 18:32:51 2013
@@ -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.HashMap;
import java.util.Map;
@@ -30,8 +31,9 @@ import org.apache.accumulo.core.conf.Pro
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.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.core.util.UtilWaitThread;
import org.apache.accumulo.minicluster.MiniAccumuloConfig;
import org.apache.accumulo.server.util.CheckForMetadataProblems;
@@ -44,13 +46,13 @@ public class SplitIT extends MacTest {
@Override
public void configure(MiniAccumuloConfig cfg) {
- Map<String, String> siteConfig = new HashMap<String, String>();
+ Map<String,String> siteConfig = new HashMap<String,String>();
siteConfig.put(Property.TSERV_MAXMEM.getKey(), "5K");
- siteConfig.put(Property.TSERV_MAJC_DELAY.getKey(), "1");
+ siteConfig.put(Property.TSERV_MAJC_DELAY.getKey(), "1s");
cfg.setSiteConfig(siteConfig);
}
-
- @Test(timeout=60*1000)
+
+ @Test(timeout = 120 * 1000)
public void tabletShouldSplit() throws Exception {
Connector c = getConnector();
c.tableOperations().create("test_ingest");
@@ -62,12 +64,12 @@ public class SplitIT extends MacTest {
VerifyIngest.Opts vopts = new VerifyIngest.Opts();
vopts.rows = opts.rows;
VerifyIngest.verifyIngest(c, vopts, new ScannerOpts());
- UtilWaitThread.sleep(10*1000);
+ UtilWaitThread.sleep(15 * 1000);
String id = c.tableOperations().tableIdMap().get("test_ingest");
Scanner s = c.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
KeyExtent extent = new KeyExtent(new Text(id), null, null);
s.setRange(extent.toMetadataRange());
- MetadataTable.PREV_ROW_COLUMN.fetch(s);
+ MetadataSchema.TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.fetch(s);
int count = 0;
int shortened = 0;
for (Entry<Key,Value> entry : s) {
@@ -78,20 +80,23 @@ public class SplitIT extends MacTest {
}
assertTrue(shortened > 0);
assertTrue(count > 10);
- assertEquals(0, cluster.exec(CheckForMetadataProblems.class, "-i", cluster.getInstanceName(), "-u", "root", "-p", MacTest.PASSWORD, "-z", cluster.getZooKeepers()).waitFor());
+ assertEquals(0,
+ cluster.exec(CheckForMetadataProblems.class, "-i", cluster.getInstanceName(), "-u", "root", "-p", MacTest.PASSWORD, "-z", cluster.getZooKeepers())
+ .waitFor());
}
- @Test(timeout=60*1000)
+ @Test(timeout = 60 * 1000)
public void interleaveSplit() throws Exception {
Connector c = getConnector();
c.tableOperations().create("test_ingest");
c.tableOperations().setProperty("test_ingest", Property.TABLE_SPLIT_THRESHOLD.getKey(), "10K");
+ c.tableOperations().setProperty("test_ingest", Property.TABLE_FILE_COMPRESSION_TYPE.getKey(), "none");
ReadWriteIT.interleaveTest(c);
- UtilWaitThread.sleep(10*1000);
- assertTrue(c.tableOperations().listSplits("test_ingest").size() > 20);
+ UtilWaitThread.sleep(5 * 1000);
+ assertTrue(c.tableOperations().listSplits("test_ingest").size() > 10);
}
- @Test(timeout=120*1000)
+ @Test(timeout = 120 * 1000)
public void deleteSplit() throws Exception {
Connector c = getConnector();
c.tableOperations().create("test_ingest");