keith-turner closed pull request #727: fixes #587 Wait for tablets assigned to
dead servers before deleting table
URL: https://github.com/apache/accumulo/pull/727
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git
a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/InputConfigurator.java
b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/InputConfigurator.java
index ac7ae286bd..6c06d89a8a 100644
---
a/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/InputConfigurator.java
+++
b/core/src/main/java/org/apache/accumulo/core/client/mapreduce/lib/impl/InputConfigurator.java
@@ -671,7 +671,8 @@ public static void setInputTableConfigs(Class<?>
implementingClass, Configuratio
*/
public static Map<String,InputTableConfig> getInputTableConfigs(Class<?>
implementingClass,
Configuration conf) {
- return getInputTableConfigs(implementingClass, conf,
getInputTableName(implementingClass, conf));
+ return getInputTableConfigs(implementingClass, conf,
+ getInputTableName(implementingClass, conf));
}
/**
@@ -726,7 +727,8 @@ public static void setInputTableConfigs(Class<?>
implementingClass, Configuratio
*/
public static InputTableConfig getInputTableConfig(Class<?>
implementingClass, Configuration conf,
String tableName) {
- Map<String,InputTableConfig> queryConfigs =
getInputTableConfigs(implementingClass, conf, tableName);
+ Map<String,InputTableConfig> queryConfigs =
getInputTableConfigs(implementingClass, conf,
+ tableName);
return queryConfigs.get(tableName);
}
diff --git
a/server/base/src/main/java/org/apache/accumulo/server/tables/TableManager.java
b/server/base/src/main/java/org/apache/accumulo/server/tables/TableManager.java
index fce50bcb77..95f791cf68 100644
---
a/server/base/src/main/java/org/apache/accumulo/server/tables/TableManager.java
+++
b/server/base/src/main/java/org/apache/accumulo/server/tables/TableManager.java
@@ -49,6 +49,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.google.common.base.Preconditions;
+
public class TableManager {
private static SecurityPermission TABLE_MANAGER_PERMISSION = new
SecurityPermission(
"tableManagerPermission");
@@ -163,6 +165,7 @@ public String getMessage() {
}
public synchronized void transitionTableState(final String tableId, final
TableState newState) {
+ Preconditions.checkArgument(newState != TableState.UNKNOWN);
String statePath = ZooUtil.getRoot(HdfsZooInstance.getInstance()) +
Constants.ZTABLES + "/"
+ tableId + Constants.ZTABLE_STATE;
@@ -174,6 +177,11 @@ public synchronized void transitionTableState(final String
tableId, final TableS
TableState oldState = TableState.UNKNOWN;
if (oldData != null)
oldState = TableState.valueOf(new String(oldData, UTF_8));
+
+ // this check makes the transition operation idempotent
+ if (oldState == newState)
+ return null; // already at desired state, so nothing to do
+
boolean transition = true;
// +--------+
// v |
diff --git
a/server/master/src/main/java/org/apache/accumulo/master/tableOps/CleanUp.java
b/server/master/src/main/java/org/apache/accumulo/master/tableOps/CleanUp.java
index f4f974afd6..1479ff484e 100644
---
a/server/master/src/main/java/org/apache/accumulo/master/tableOps/CleanUp.java
+++
b/server/master/src/main/java/org/apache/accumulo/master/tableOps/CleanUp.java
@@ -99,7 +99,9 @@ public long isReady(long tid, Master master) throws Exception
{
TabletLocationState locationState = MetaDataTableScanner
.createTabletLocationState(entry.getKey(), entry.getValue());
TabletState state = locationState.getState(master.onlineTabletServers());
- if (state.equals(TabletState.ASSIGNED) ||
state.equals(TabletState.HOSTED)) {
+ if (!state.equals(TabletState.UNASSIGNED)) {
+ // This code will even wait on tablets that are assigned to dead
tablets servers. This is
+ // intentional because the master may make metadata writes for these
tablets. See #587
log.debug("Still waiting for table to be deleted: " + tableId + "
locationState: "
+ locationState);
done = false;
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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