ctubbsii commented on a change in pull request #1584: Moved ThriftClientHandler out of TabletServer for #1581 URL: https://github.com/apache/accumulo/pull/1584#discussion_r406939887
########## File path: server/tserver/src/main/java/org/apache/accumulo/tserver/AssignmentHandler.java ########## @@ -0,0 +1,243 @@ +/* + * 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 + * + * http://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 static org.apache.accumulo.server.problems.ProblemType.TABLET_LOAD; + +import java.util.Arrays; +import java.util.Set; +import java.util.SortedSet; +import java.util.TimerTask; +import java.util.TreeSet; + +import org.apache.accumulo.core.data.TableId; +import org.apache.accumulo.core.dataImpl.KeyExtent; +import org.apache.accumulo.core.master.thrift.TabletLoadState; +import org.apache.accumulo.core.metadata.schema.TabletMetadata; +import org.apache.accumulo.core.util.Daemon; +import org.apache.accumulo.fate.util.LoggingRunnable; +import org.apache.accumulo.server.master.state.Assignment; +import org.apache.accumulo.server.master.state.TabletStateStore; +import org.apache.accumulo.server.problems.ProblemReport; +import org.apache.accumulo.server.problems.ProblemReports; +import org.apache.accumulo.server.util.MasterMetadataUtil; +import org.apache.accumulo.server.util.time.SimpleTimer; +import org.apache.accumulo.tserver.TabletServerResourceManager.TabletResourceManager; +import org.apache.accumulo.tserver.mastermessage.TabletStatusMessage; +import org.apache.accumulo.tserver.tablet.Tablet; +import org.apache.accumulo.tserver.tablet.TabletData; +import org.apache.hadoop.io.Text; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class AssignmentHandler implements Runnable { + private static final Logger log = LoggerFactory.getLogger(AssignmentHandler.class); + private final KeyExtent extent; + private final int retryAttempt; + private final SortedSet<KeyExtent> unopenedTablets; + private final SortedSet<KeyExtent> openingTablets; + private final OnlineTablets onlineTablets; + private final TabletServer server; + + public AssignmentHandler(TabletServer server, KeyExtent extent) { + this(server, extent, 0); + } + + public AssignmentHandler(TabletServer server, KeyExtent extent, int retryAttempt) { + this.server = server; + this.onlineTablets = server.getOnlineTabletsRaw(); + this.unopenedTablets = server.getUnopenedTablets(); + this.openingTablets = server.getOpeningTablets(); Review comment: I don't think they will need to be tested in isolation for now. They may make sense to be added in future, but for now, I think keeping the code smaller will help enable subsequent improvements. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
