You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by kt...@apache.org on 2013/03/15 02:09:24 UTC
svn commit: r1456738 [1/3] - in /accumulo/branches/1.5:
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/accumulo/core/client/mock/
core/src/main/java/org/a...
Author: kturner
Date: Fri Mar 15 01:09:23 2013
New Revision: 1456738
URL: http://svn.apache.org/r1456738
Log:
ACCUMULO-1056 Made getSplits more robust and renamed it to listSplits so it could throw another exception
Added:
accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/ListSplits.java
Modified:
accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperations.java
accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java
accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocator.java
accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableOperations.java
accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateTableCommand.java
accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/GetSplitsCommand.java
accumulo/branches/1.5/core/src/test/java/org/apache/accumulo/core/client/admin/TableOperationsHelperTest.java
accumulo/branches/1.5/core/src/test/java/org/apache/accumulo/core/client/mock/MockTableOperationsTest.java
accumulo/branches/1.5/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/bulk/BulkIngestExample.java
accumulo/branches/1.5/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java
accumulo/branches/1.5/proxy/src/main/java/org/apache/accumulo/proxy/thrift/AccumuloProxy.java
accumulo/branches/1.5/proxy/src/main/thrift/proxy.thrift
accumulo/branches/1.5/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java
accumulo/branches/1.5/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyTableOperations.java
accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/functional/AddSplitTest.java
accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/functional/BatchScanSplitTest.java
accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/functional/BulkSplitOptimizationTest.java
accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/functional/DeleteRowsTest.java
accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/functional/FunctionalTest.java
accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/functional/MergeTest.java
accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/randomwalk/image/TableOp.java
accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/randomwalk/shard/BulkInsert.java
accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/randomwalk/shard/ExportIndex.java
accumulo/branches/1.5/test/src/main/java/org/apache/accumulo/test/randomwalk/shard/Merge.java
accumulo/branches/1.5/test/system/randomwalk/conf/modules/Concurrent.xml
Modified: accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperations.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperations.java?rev=1456738&r1=1456737&r2=1456738&view=diff
==============================================================================
--- accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperations.java (original)
+++ accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperations.java Fri Mar 15 01:09:23 2013
@@ -147,20 +147,52 @@ public interface TableOperations {
* @return the split points (end-row names) for the table's current split profile
* @throws TableNotFoundException
* if the table does not exist
+ * @deprecated since 1.5.0; use {@link #listSplits(String)} instead.
*/
+ @Deprecated
public Collection<Text> getSplits(String tableName) throws TableNotFoundException;
/**
* @param tableName
* the name of the table
+ * @return the split points (end-row names) for the table's current split profile
+ * @throws TableNotFoundException
+ * if the table does not exist
+ * @throws AccumuloException
+ * if a general error occurs
+ * @throws AccumuloSecurityException
+ * if the user does not have permission
+ * @since 1.5
+ */
+ public Collection<Text> listSplits(String tableName) throws TableNotFoundException, AccumuloSecurityException, AccumuloException;
+
+ /**
+ * @param tableName
+ * the name of the table
* @param maxSplits
* specifies the maximum number of splits to return
* @return the split points (end-row names) for the table's current split profile, grouped into fewer splits so as not to exceed maxSplits
* @throws TableNotFoundException
+ * @deprecated since 1.5.0; use {@link #listSplits(String, int))} instead.
*/
+ @Deprecated
public Collection<Text> getSplits(String tableName, int maxSplits) throws TableNotFoundException;
/**
+ * @param tableName
+ * the name of the table
+ * @param maxSplits
+ * specifies the maximum number of splits to return
+ * @throws AccumuloException
+ * if a general error occurs
+ * @throws AccumuloSecurityException
+ * if the user does not have permission
+ * @return the split points (end-row names) for the table's current split profile, grouped into fewer splits so as not to exceed maxSplits
+ * @throws TableNotFoundException
+ */
+ public Collection<Text> listSplits(String tableName, int maxSplits) throws TableNotFoundException, AccumuloSecurityException, AccumuloException;
+
+ /**
* Finds the max row within a given range. To find the max row in a table, pass null for start and end row.
*
* @param tableName
Modified: accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java?rev=1456738&r1=1456737&r2=1456738&view=diff
==============================================================================
--- accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java (original)
+++ accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsImpl.java Fri Mar 15 01:09:23 2013
@@ -526,24 +526,33 @@ public class TableOperationsImpl extends
* @return the split points (end-row names) for the table's current split profile
*/
@Override
- public Collection<Text> getSplits(String tableName) throws TableNotFoundException {
+ public Collection<Text> listSplits(String tableName) throws TableNotFoundException, AccumuloSecurityException {
ArgumentChecker.notNull(tableName);
- if (!exists(tableName)) {
- throw new TableNotFoundException(null, tableName, "Unknown table for getSplits");
- }
+ String tableId = Tables.getTableId(instance, tableName);
SortedSet<KeyExtent> tablets = new TreeSet<KeyExtent>();
Map<KeyExtent,String> locations = new TreeMap<KeyExtent,String>();
-
+
while (true) {
try {
tablets.clear();
locations.clear();
- MetadataTable.getEntries(instance, credentials, tableName, false, locations, tablets);
+ // the following method throws AccumuloException for some conditions that should be retried
+ MetadataTable.getEntries(instance, credentials, tableId, true, locations, tablets);
break;
+ } catch (AccumuloSecurityException ase) {
+ throw ase;
} catch (Throwable t) {
+ if (!Tables.exists(instance, tableId)) {
+ throw new TableNotFoundException(tableId, tableName, null);
+ }
+
+ if (t instanceof RuntimeException && t.getCause() instanceof AccumuloSecurityException) {
+ throw (AccumuloSecurityException) t.getCause();
+ }
+
log.info(t.getMessage() + " ... retrying ...");
UtilWaitThread.sleep(3000);
}
@@ -558,6 +567,15 @@ public class TableOperationsImpl extends
return endRows;
}
+ @Override
+ public Collection<Text> getSplits(String tableName) throws TableNotFoundException {
+ try {
+ return listSplits(tableName);
+ } catch (AccumuloSecurityException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
/**
* @param tableName
* the name of the table
@@ -567,8 +585,8 @@ public class TableOperationsImpl extends
* @throws TableNotFoundException
*/
@Override
- public Collection<Text> getSplits(String tableName, int maxSplits) throws TableNotFoundException {
- Collection<Text> endRows = getSplits(tableName);
+ public Collection<Text> listSplits(String tableName, int maxSplits) throws TableNotFoundException, AccumuloSecurityException {
+ Collection<Text> endRows = listSplits(tableName);
if (endRows.size() <= maxSplits)
return endRows;
@@ -591,6 +609,15 @@ public class TableOperationsImpl extends
return subset;
}
+ @Override
+ public Collection<Text> getSplits(String tableName, int maxSplits) throws TableNotFoundException {
+ try {
+ return listSplits(tableName, maxSplits);
+ } catch (AccumuloSecurityException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
/**
* Delete a table
*
Modified: accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocator.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocator.java?rev=1456738&r1=1456737&r2=1456738&view=diff
==============================================================================
--- accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocator.java (original)
+++ accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/client/impl/TabletLocator.java Fri Mar 15 01:09:23 2013
@@ -103,6 +103,7 @@ public abstract class TabletLocator {
if (tableId.toString().equals(Constants.METADATA_TABLE_ID)) {
RootTabletLocator rootTabletLocator = new RootTabletLocator(instance);
tl = new TabletLocatorImpl(new Text(Constants.METADATA_TABLE_ID), rootTabletLocator, mlo) {
+ @Override
public TabletLocation _locateTablet(Text row, boolean skipRow, boolean retry, boolean lock, TCredentials credentials) throws AccumuloException, AccumuloSecurityException,
TableNotFoundException {
// add a special case for the root tablet itself to the cache of information in the root tablet
Modified: accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableOperations.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableOperations.java?rev=1456738&r1=1456737&r2=1456738&view=diff
==============================================================================
--- accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableOperations.java (original)
+++ accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableOperations.java Fri Mar 15 01:09:23 2013
@@ -105,14 +105,24 @@ public class MockTableOperations extends
@Override
public Collection<Text> getSplits(String tableName) throws TableNotFoundException {
+ return listSplits(tableName);
+ }
+
+ @Override
+ public Collection<Text> getSplits(String tableName, int maxSplits) throws TableNotFoundException {
+ return listSplits(tableName);
+ }
+
+ @Override
+ public Collection<Text> listSplits(String tableName) throws TableNotFoundException {
if (!exists(tableName))
throw new TableNotFoundException(tableName, tableName, "");
return acu.getSplits(tableName);
}
-
+
@Override
- public Collection<Text> getSplits(String tableName, int maxSplits) throws TableNotFoundException {
- return getSplits(tableName);
+ public Collection<Text> listSplits(String tableName, int maxSplits) throws TableNotFoundException {
+ return listSplits(tableName);
}
@Override
Modified: accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateTableCommand.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateTableCommand.java?rev=1456738&r1=1456737&r2=1456738&view=diff
==============================================================================
--- accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateTableCommand.java (original)
+++ accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/CreateTableCommand.java Fri Mar 15 01:09:23 2013
@@ -86,7 +86,7 @@ public class CreateTableCommand extends
if (!shellState.getConnector().tableOperations().exists(oldTable)) {
throw new TableNotFoundException(null, oldTable, null);
}
- partitions.addAll(shellState.getConnector().tableOperations().getSplits(oldTable));
+ partitions.addAll(shellState.getConnector().tableOperations().listSplits(oldTable));
}
if (cl.hasOption(createTableOptCopyConfig.getOpt())) {
Modified: accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/GetSplitsCommand.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/GetSplitsCommand.java?rev=1456738&r1=1456737&r2=1456738&view=diff
==============================================================================
--- accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/GetSplitsCommand.java (original)
+++ accumulo/branches/1.5/core/src/main/java/org/apache/accumulo/core/util/shell/commands/GetSplitsCommand.java Fri Mar 15 01:09:23 2013
@@ -63,8 +63,8 @@ public class GetSplitsCommand extends Co
try {
if (!verbose) {
- for (Text row : maxSplits > 0 ? shellState.getConnector().tableOperations().getSplits(tableName, maxSplits) : shellState.getConnector()
- .tableOperations().getSplits(tableName)) {
+ for (Text row : maxSplits > 0 ? shellState.getConnector().tableOperations().listSplits(tableName, maxSplits) : shellState.getConnector()
+ .tableOperations().listSplits(tableName)) {
p.print(encode(encode, row));
}
} else {
Modified: accumulo/branches/1.5/core/src/test/java/org/apache/accumulo/core/client/admin/TableOperationsHelperTest.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/core/src/test/java/org/apache/accumulo/core/client/admin/TableOperationsHelperTest.java?rev=1456738&r1=1456737&r2=1456738&view=diff
==============================================================================
--- accumulo/branches/1.5/core/src/test/java/org/apache/accumulo/core/client/admin/TableOperationsHelperTest.java (original)
+++ accumulo/branches/1.5/core/src/test/java/org/apache/accumulo/core/client/admin/TableOperationsHelperTest.java Fri Mar 15 01:09:23 2013
@@ -80,6 +80,16 @@ public class TableOperationsHelperTest {
}
@Override
+ public Collection<Text> listSplits(String tableName) throws TableNotFoundException {
+ return null;
+ }
+
+ @Override
+ public Collection<Text> listSplits(String tableName, int maxSplits) throws TableNotFoundException {
+ return null;
+ }
+
+ @Override
public Text getMaxRow(String tableName, Authorizations auths, Text startRow, boolean startInclusive, Text endRow, boolean endInclusive)
throws TableNotFoundException, AccumuloException, AccumuloSecurityException {
return null;
Modified: accumulo/branches/1.5/core/src/test/java/org/apache/accumulo/core/client/mock/MockTableOperationsTest.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/core/src/test/java/org/apache/accumulo/core/client/mock/MockTableOperationsTest.java?rev=1456738&r1=1456737&r2=1456738&view=diff
==============================================================================
--- accumulo/branches/1.5/core/src/test/java/org/apache/accumulo/core/client/mock/MockTableOperationsTest.java (original)
+++ accumulo/branches/1.5/core/src/test/java/org/apache/accumulo/core/client/mock/MockTableOperationsTest.java Fri Mar 15 01:09:23 2013
@@ -150,7 +150,7 @@ public class MockTableOperationsTest {
Assert.fail();
} catch (TableNotFoundException e) {}
try {
- conn.tableOperations().getSplits(t);
+ conn.tableOperations().listSplits(t);
Assert.fail();
} catch (TableNotFoundException e) {}
try {
Modified: accumulo/branches/1.5/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/bulk/BulkIngestExample.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/bulk/BulkIngestExample.java?rev=1456738&r1=1456737&r2=1456738&view=diff
==============================================================================
--- accumulo/branches/1.5/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/bulk/BulkIngestExample.java (original)
+++ accumulo/branches/1.5/examples/simple/src/main/java/org/apache/accumulo/examples/simple/mapreduce/bulk/BulkIngestExample.java Fri Mar 15 01:09:23 2013
@@ -128,7 +128,7 @@ public class BulkIngestExample extends C
FileSystem fs = FileSystem.get(conf);
out = new PrintStream(new BufferedOutputStream(fs.create(new Path(opts.workDir + "/splits.txt"))));
- Collection<Text> splits = connector.tableOperations().getSplits(opts.tableName, 100);
+ Collection<Text> splits = connector.tableOperations().listSplits(opts.tableName, 100);
for (Text split : splits)
out.println(new String(Base64.encodeBase64(TextUtil.getBytes(split))));
Modified: accumulo/branches/1.5/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java
URL: http://svn.apache.org/viewvc/accumulo/branches/1.5/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java?rev=1456738&r1=1456737&r2=1456738&view=diff
==============================================================================
--- accumulo/branches/1.5/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java (original)
+++ accumulo/branches/1.5/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java Fri Mar 15 01:09:23 2013
@@ -342,9 +342,9 @@ public class ProxyServer implements Accu
}
@Override
- public List<ByteBuffer> getSplits(ByteBuffer login, String tableName, int maxSplits) throws TException {
+ public List<ByteBuffer> listSplits(ByteBuffer login, String tableName, int maxSplits) throws TException {
try {
- Collection<Text> splits = getConnector(login).tableOperations().getSplits(tableName, maxSplits);
+ Collection<Text> splits = getConnector(login).tableOperations().listSplits(tableName, maxSplits);
List<ByteBuffer> ret = new ArrayList<ByteBuffer>();
for (Text split : splits) {
ret.add(TextUtil.getByteBuffer(split));