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 2019/05/06 22:40:29 UTC
[accumulo] branch master updated (8511c43 -> 1a65e6d)
This is an automated email from the ASF dual-hosted git repository.
kturner pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/accumulo.git.
from 8511c43 Cleanup monitor CSS (#1147)
add c56eada fix #1141 adding checks for extra FATE RPC arguments (#1145)
new 1a65e6d Merge branch '1.9'
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../apache/accumulo/master/FateServiceHandler.java | 32 +++++++++++++++++++++-
1 file changed, 31 insertions(+), 1 deletion(-)
[accumulo] 01/01: Merge branch '1.9'
Posted by kt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
kturner pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/accumulo.git
commit 1a65e6dddc3a560a6e3362b3cd639875ca63b5c4
Merge: 8511c43 c56eada
Author: Keith Turner <kt...@apache.org>
AuthorDate: Mon May 6 18:39:38 2019 -0400
Merge branch '1.9'
.../apache/accumulo/master/FateServiceHandler.java | 32 +++++++++++++++++++++-
1 file changed, 31 insertions(+), 1 deletion(-)
diff --cc server/master/src/main/java/org/apache/accumulo/master/FateServiceHandler.java
index 3ec1320,c9b20cf..c19ee7b
--- a/server/master/src/main/java/org/apache/accumulo/master/FateServiceHandler.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/FateServiceHandler.java
@@@ -109,9 -103,10 +109,10 @@@ class FateServiceHandler implements Fat
switch (op) {
case NAMESPACE_CREATE: {
TableOperation tableOp = TableOperation.CREATE;
+ validateArgumentCount(arguments, tableOp, 1);
String namespace = validateNamespaceArgument(arguments.get(0), tableOp, null);
- if (!master.security.canCreateNamespace(c, namespace))
+ if (!master.security.canCreateNamespace(c))
throw new ThriftSecurityException(c.getPrincipal(), SecurityErrorCode.PERMISSION_DENIED);
master.fate.seedTransaction(opid,
@@@ -150,25 -147,11 +153,31 @@@
}
case TABLE_CREATE: {
TableOperation tableOp = TableOperation.CREATE;
- validateArgumentCount(arguments, tableOp, 2);
++ int SPLIT_OFFSET = 4; // offset where split data begins in arguments list
++ if (arguments.size() < SPLIT_OFFSET) {
++ throw new ThriftTableOperationException(null, null, tableOp,
++ TableOperationExceptionType.OTHER,
++ "Expected at least " + SPLIT_OFFSET + " arguments, saw :" + arguments.size());
++ }
String tableName = validateTableNameArgument(arguments.get(0), tableOp, NOT_SYSTEM);
TimeType timeType = TimeType.valueOf(ByteBufferUtil.toString(arguments.get(1)));
-
- String namespaceId;
+ InitialTableState initialTableState =
+ InitialTableState.valueOf(ByteBufferUtil.toString(arguments.get(2)));
+ int splitCount = Integer.parseInt(ByteBufferUtil.toString(arguments.get(3)));
++ validateArgumentCount(arguments, tableOp, SPLIT_OFFSET + splitCount);
+ String splitFile = null;
+ String splitDirsFile = null;
+ if (splitCount > 0) {
- int SPLIT_OFFSET = 4; // offset where split data begins in arguments list
+ try {
+ splitFile = writeSplitsToFile(opid, arguments, splitCount, SPLIT_OFFSET);
+ splitDirsFile = createSplitDirsFile(opid);
+ } catch (IOException e) {
+ throw new ThriftTableOperationException(null, tableName, tableOp,
+ TableOperationExceptionType.OTHER,
+ "Exception thrown while writing splits to file system");
+ }
+ }
+ NamespaceId namespaceId;
try {
namespaceId =
@@@ -239,12 -223,13 +249,13 @@@
}
case TABLE_CLONE: {
TableOperation tableOp = TableOperation.CLONE;
+ validateArgumentCount(arguments, tableOp, 2);
- String srcTableId = validateTableIdArgument(arguments.get(0), tableOp, NOT_ROOT_ID);
+ TableId srcTableId = validateTableIdArgument(arguments.get(0), tableOp, NOT_ROOT_ID);
String tableName = validateTableNameArgument(arguments.get(1), tableOp, NOT_SYSTEM);
- String namespaceId;
+ NamespaceId namespaceId;
try {
namespaceId =
- Namespaces.getNamespaceId(master.getInstance(), Tables.qualify(tableName).getFirst());
+ Namespaces.getNamespaceId(master.getContext(), Tables.qualify(tableName).getFirst());
} catch (NamespaceNotFoundException e) {
// shouldn't happen, but possible once cloning between namespaces is supported
throw new ThriftTableOperationException(null, tableName, tableOp,
@@@ -290,11 -275,12 +301,12 @@@
}
case TABLE_DELETE: {
TableOperation tableOp = TableOperation.DELETE;
+ validateArgumentCount(arguments, tableOp, 1);
String tableName = validateTableNameArgument(arguments.get(0), tableOp, NOT_SYSTEM);
- final String tableId =
- ClientServiceHandler.checkTableId(master.getInstance(), tableName, tableOp);
- String namespaceId = getNamespaceIdFromTableId(tableOp, tableId);
+ final TableId tableId =
+ ClientServiceHandler.checkTableId(master.getContext(), tableName, tableOp);
+ NamespaceId namespaceId = getNamespaceIdFromTableId(tableOp, tableId);
final boolean canDeleteTable;
try {
@@@ -312,8 -298,9 +324,9 @@@
}
case TABLE_ONLINE: {
TableOperation tableOp = TableOperation.ONLINE;
+ validateArgumentCount(arguments, tableOp, 1);
- final String tableId = validateTableIdArgument(arguments.get(0), tableOp, NOT_ROOT_ID);
- String namespaceId = getNamespaceIdFromTableId(tableOp, tableId);
+ final TableId tableId = validateTableIdArgument(arguments.get(0), tableOp, NOT_ROOT_ID);
+ NamespaceId namespaceId = getNamespaceIdFromTableId(tableOp, tableId);
final boolean canOnlineOfflineTable;
try {
@@@ -333,8 -320,9 +346,9 @@@
}
case TABLE_OFFLINE: {
TableOperation tableOp = TableOperation.OFFLINE;
+ validateArgumentCount(arguments, tableOp, 1);
- final String tableId = validateTableIdArgument(arguments.get(0), tableOp, NOT_ROOT_ID);
- String namespaceId = getNamespaceIdFromTableId(tableOp, tableId);
+ final TableId tableId = validateTableIdArgument(arguments.get(0), tableOp, NOT_ROOT_ID);
+ NamespaceId namespaceId = getNamespaceIdFromTableId(tableOp, tableId);
final boolean canOnlineOfflineTable;
try {
@@@ -438,7 -427,8 +455,8 @@@
}
case TABLE_COMPACT: {
TableOperation tableOp = TableOperation.COMPACT;
+ validateArgumentCount(arguments, tableOp, 5);
- String tableId = validateTableIdArgument(arguments.get(0), tableOp, null);
+ TableId tableId = validateTableIdArgument(arguments.get(0), tableOp, null);
byte[] startRow = ByteBufferUtil.toBytes(arguments.get(1));
byte[] endRow = ByteBufferUtil.toBytes(arguments.get(2));
List<IteratorSetting> iterators =
@@@ -464,8 -454,9 +482,9 @@@
}
case TABLE_CANCEL_COMPACT: {
TableOperation tableOp = TableOperation.COMPACT_CANCEL;
+ validateArgumentCount(arguments, tableOp, 1);
- String tableId = validateTableIdArgument(arguments.get(0), tableOp, null);
- String namespaceId = getNamespaceIdFromTableId(tableOp, tableId);
+ TableId tableId = validateTableIdArgument(arguments.get(0), tableOp, null);
+ NamespaceId namespaceId = getNamespaceIdFromTableId(tableOp, tableId);
final boolean canCancelCompact;
try {
@@@ -484,12 -475,13 +503,13 @@@
}
case TABLE_IMPORT: {
TableOperation tableOp = TableOperation.IMPORT;
+ validateArgumentCount(arguments, tableOp, 2);
String tableName = validateTableNameArgument(arguments.get(0), tableOp, NOT_SYSTEM);
String exportDir = ByteBufferUtil.toString(arguments.get(1));
- String namespaceId;
+ NamespaceId namespaceId;
try {
namespaceId =
- Namespaces.getNamespaceId(master.getInstance(), Tables.qualify(tableName).getFirst());
+ Namespaces.getNamespaceId(master.getContext(), Tables.qualify(tableName).getFirst());
} catch (NamespaceNotFoundException e) {
throw new ThriftTableOperationException(null, tableName, tableOp,
TableOperationExceptionType.NAMESPACE_NOTFOUND, "");
@@@ -536,35 -529,6 +557,36 @@@
autoCleanup);
break;
}
+ case TABLE_BULK_IMPORT2:
+ TableOperation tableOp = TableOperation.BULK_IMPORT;
++ validateArgumentCount(arguments, tableOp, 3);
+ TableId tableId = validateTableIdArgument(arguments.get(0), tableOp, NOT_ROOT_ID);
+ String dir = ByteBufferUtil.toString(arguments.get(1));
+
+ boolean setTime = Boolean.parseBoolean(ByteBufferUtil.toString(arguments.get(2)));
+
+ NamespaceId namespaceId = getNamespaceIdFromTableId(tableOp, tableId);
+
+ final boolean canBulkImport;
+ try {
+ String tableName = Tables.getTableName(master.getContext(), tableId);
+ canBulkImport =
+ master.security.canBulkImport(c, tableId, tableName, dir, null, namespaceId);
+ } catch (ThriftSecurityException e) {
+ throwIfTableMissingSecurityException(e, tableId, "", TableOperation.BULK_IMPORT);
+ throw e;
+ } catch (TableNotFoundException e) {
+ throw new ThriftTableOperationException(tableId.canonical(), null,
+ TableOperation.BULK_IMPORT, TableOperationExceptionType.NOTFOUND,
+ "Table no longer exists");
+ }
+
+ if (!canBulkImport)
+ throw new ThriftSecurityException(c.getPrincipal(), SecurityErrorCode.PERMISSION_DENIED);
+
+ master.fate.seedTransaction(opid,
+ new TraceRepo<>(new PrepBulkImport(tableId, dir, setTime)), autoCleanup);
+ break;
default:
throw new UnsupportedOperationException();
}