keith-turner commented on code in PR #5734:
URL: https://github.com/apache/accumulo/pull/5734#discussion_r2201056971


##########
server/tserver/src/main/java/org/apache/accumulo/tserver/OpeningTablets.java:
##########
@@ -0,0 +1,90 @@
+/*
+ * 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.tserver;
+
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import org.apache.accumulo.core.dataImpl.KeyExtent;
+import org.apache.accumulo.core.metadata.schema.Ample;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.base.Preconditions;
+
+public class OpeningTablets {
+  private static final Logger log = 
LoggerFactory.getLogger(OpeningTablets.class);
+
+  // Tracks the set of data levels that are shutting down and can not load new 
tablets.
+  final Set<Ample.DataLevel> shutdownDataLevels = 
EnumSet.noneOf(Ample.DataLevel.class);
+  final SortedSet<KeyExtent> openingTablets = new TreeSet<>();
+
+  public synchronized boolean add(KeyExtent extent) {
+    if (shutdownDataLevels.contains(Ample.DataLevel.of(extent.tableId()))) {
+      log.info("ignoring request to load {} because the data level is 
shutdown", extent);

Review Comment:
   > What does the Manager do if the Tablet is not hosted for some amount of 
time?
   
   Oh yeah, graceful shutdown running for a long time in the manager could be 
really troublesome.  In the worst case it causes accumulo system tables to be 
unavailable for long periods. 
   
   We could attempt to make the manage ignore this tablet server for assignment 
and balancing.  However if the manager has set a future location w/ the tablet 
server already, then it will want to carry through w/ assigning until it 
completes or the tsever dies.  Trying to adjust the managers assignment, 
balancing, suspend, and future handling code for this case will introduce a lot 
of complexity that will be hard to properly test and may cause bugs in existing 
use cases in the manager unrelated to graceful shutdown.  I can look into this 
a bit more. 
   
   If the complexity of attempting to handle this correctly on the manager side 
is too much, it may be best to just limit the time graceful shutdown has on the 
tserver side.   Like when graceful shutdown is started on a tserver its also 
given a time limit.  If it can not complete the graceful shutdown in the 
timelimit then it halts.  
   
   
   



-- 
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]

Reply via email to