You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ed...@apache.org on 2021/07/23 17:39:36 UTC
[accumulo] branch main updated: Add checks to PopulateZK and FateSH
(#2211)
This is an automated email from the ASF dual-hosted git repository.
edcoleman pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/main by this push:
new f0fe4ac Add checks to PopulateZK and FateSH (#2211)
f0fe4ac is described below
commit f0fe4acc3d2e4b83c72f831ac8feec9b0897cabf
Author: Dom G <47...@users.noreply.github.com>
AuthorDate: Fri Jul 23 13:39:30 2021 -0400
Add checks to PopulateZK and FateSH (#2211)
---
.../org/apache/accumulo/manager/FateServiceHandler.java | 8 ++++++++
.../manager/tableOps/create/PopulateZookeeper.java | 15 +++++++++++----
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/server/manager/src/main/java/org/apache/accumulo/manager/FateServiceHandler.java b/server/manager/src/main/java/org/apache/accumulo/manager/FateServiceHandler.java
index a657b90..89ea798 100644
--- a/server/manager/src/main/java/org/apache/accumulo/manager/FateServiceHandler.java
+++ b/server/manager/src/main/java/org/apache/accumulo/manager/FateServiceHandler.java
@@ -201,6 +201,14 @@ class FateServiceHandler implements FateService.Iface {
if (!manager.security.canCreateTable(c, tableName, namespaceId))
throw new ThriftSecurityException(c.getPrincipal(), SecurityErrorCode.PERMISSION_DENIED);
+ for (Map.Entry<String,String> entry : options.entrySet()) {
+ if (!Property.isTablePropertyValid(entry.getKey(), entry.getValue())) {
+ throw new ThriftTableOperationException(null, tableName, tableOp,
+ TableOperationExceptionType.OTHER,
+ "Property or value not valid " + entry.getKey() + "=" + entry.getValue());
+ }
+ }
+
manager.fate.seedTransaction(opid,
new TraceRepo<>(new CreateTable(c.getPrincipal(), tableName, timeType, options,
splitsPath, splitCount, splitsDirsPath, initialTableState, namespaceId)),
diff --git a/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/create/PopulateZookeeper.java b/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/create/PopulateZookeeper.java
index 0554cea..4984447 100644
--- a/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/create/PopulateZookeeper.java
+++ b/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/create/PopulateZookeeper.java
@@ -22,6 +22,8 @@ import java.util.Map.Entry;
import org.apache.accumulo.core.clientImpl.Tables;
import org.apache.accumulo.core.clientImpl.thrift.TableOperation;
+import org.apache.accumulo.core.clientImpl.thrift.TableOperationExceptionType;
+import org.apache.accumulo.core.clientImpl.thrift.ThriftTableOperationException;
import org.apache.accumulo.fate.Repo;
import org.apache.accumulo.manager.Manager;
import org.apache.accumulo.manager.tableOps.ManagerRepo;
@@ -33,7 +35,7 @@ class PopulateZookeeper extends ManagerRepo {
private static final long serialVersionUID = 1L;
- private TableInfo tableInfo;
+ private final TableInfo tableInfo;
PopulateZookeeper(TableInfo ti) {
this.tableInfo = ti;
@@ -58,9 +60,14 @@ class PopulateZookeeper extends ManagerRepo {
manager.getTableManager().addTable(tableInfo.getTableId(), tableInfo.getNamespaceId(),
tableInfo.getTableName());
- for (Entry<String,String> entry : tableInfo.props.entrySet())
- TablePropUtil.setTableProperty(manager.getContext(), tableInfo.getTableId(), entry.getKey(),
- entry.getValue());
+ for (Entry<String,String> entry : tableInfo.props.entrySet()) {
+ if (!TablePropUtil.setTableProperty(manager.getContext(), tableInfo.getTableId(),
+ entry.getKey(), entry.getValue())) {
+ throw new ThriftTableOperationException(null, tableInfo.getTableName(),
+ TableOperation.CREATE, TableOperationExceptionType.OTHER,
+ "Property or value not valid " + entry.getKey() + "=" + entry.getValue());
+ }
+ }
Tables.clearCache(manager.getContext());
return new ChooseDir(tableInfo);