Github user ShawnWalker commented on a diff in the pull request:
https://github.com/apache/accumulo/pull/121#discussion_r68977594
--- Diff:
server/base/src/main/java/org/apache/accumulo/server/master/state/TabletLocationState.java
---
@@ -93,6 +95,9 @@ public TServerInstance getServer() {
}
public TabletState getState(Set<TServerInstance> liveServers) {
+ if (suspend != null) {
--- End diff --
Offline discussion with @keith-turner turned up a race condition here:
1. Tablet is assigned to tserver
2. `TabletGroupWatcher` reads tablet's location state, sees a
`TabletLocationState` in which `current` is null, `future` is set, `suspend` is
null)
3. Tserver begins hosting tablet (`current` is set, `future` is null,
`suspend` is null)
4. Tserver dies, lock is lost
5. `TabletGroupWatcher` still thinks `current` is set, `future` is null,
`suspend` is null, and also thinks tserver is dead, so state
ASSIGNED_TO_DEAD_SERVER. `TabletGroupWatcher` suspends tablet.
7. Now `current` is set, `future` is null, `suspend` is set (state
SUSPENDED).
8. Tserver comes back.
9. On next scan, `TabletGroupWatcher` assigns the tablet back to tserver,
setting `future` (and clearing `suspend`). Now `TabletLocationState` is in the
illegal situation where both `current` is `future` are simultaneously set.
While this race seems a bit unlikely, it is a possible concern. To address
this concern, I believe that if either `current` or `future` is set, we should
favor returning state ASSIGNED_TO_DEAD_SERVER over state SUSPENDED. That way,
on the first pass, `TabletGroupWatcher` suspends the tablet, clearing `future`
(which is a no-op, since `future` is already clear). On the second pass,
`TabletGroupWatcher` suspends the tablet again, this time clearing `current`.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---