meatballspaghetti commented on code in PR #4996:
URL: https://github.com/apache/accumulo/pull/4996#discussion_r1817401508
##########
server/base/src/main/java/org/apache/accumulo/server/init/ZooKeeperInitializer.java:
##########
@@ -116,9 +117,10 @@ void initialize(final ServerContext context, final boolean
clearInstanceName,
ZooUtil.NodeExistsPolicy.FAIL);
TableManager.prepareNewNamespaceState(context, Namespace.DEFAULT.id(),
Namespace.DEFAULT.name(),
- ZooUtil.NodeExistsPolicy.FAIL);
+ ZooUtil.NodeExistsPolicy.OVERWRITE);
Review Comment:
Updated, changed it back to FAIL.
##########
core/src/main/java/org/apache/accumulo/core/clientImpl/NamespaceMapping.java:
##########
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.accumulo.core.clientImpl;
+
+import static java.nio.charset.StandardCharsets.UTF_8;
+import static java.util.Collections.emptySortedMap;
+
+import java.lang.reflect.Type;
+import java.util.Collections;
+import java.util.Map;
+import java.util.SortedMap;
+
+import org.apache.accumulo.core.Constants;
+import org.apache.accumulo.core.data.NamespaceId;
+import org.apache.accumulo.core.fate.zookeeper.ZooCache;
+import org.apache.accumulo.core.fate.zookeeper.ZooReaderWriter;
+import org.apache.accumulo.core.fate.zookeeper.ZooUtil;
+import org.apache.zookeeper.KeeperException;
+
+import com.google.common.collect.ImmutableSortedMap;
+import com.google.common.reflect.TypeToken;
+import com.google.gson.Gson;
+
+public class NamespaceMapping {
+ private static final Gson gson = new Gson();
+ private final ClientContext context;
+ private volatile SortedMap<NamespaceId,String> currentNamespaceMap =
emptySortedMap();
+ private volatile SortedMap<String,NamespaceId> currentNamespaceReverseMap =
emptySortedMap();
+ private volatile long lastMzxid;
+
+ public NamespaceMapping(ClientContext context) {
+ this.context = context;
+ }
+
+ public static void initializeNamespaceMap(ZooReaderWriter zoo, String zPath)
+ throws InterruptedException, KeeperException {
+ Map<String,String> map = Map.of(Namespace.DEFAULT.id().canonical(),
Namespace.DEFAULT.name(),
+ Namespace.ACCUMULO.id().canonical(), Namespace.ACCUMULO.name());
+ zoo.putPersistentData(zPath, serialize(map),
ZooUtil.NodeExistsPolicy.OVERWRITE);
+ }
+
+ public static byte[] writeNamespaceToMap(ZooReaderWriter zoo, String zPath,
+ NamespaceId namespaceId, String namespaceName) throws
InterruptedException, KeeperException {
+ byte[] updatedMap = new byte[0];
+ if (!Namespace.DEFAULT.id().equals(namespaceId)
Review Comment:
Updated.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]