if (state.getState(liveServers) == TabletState.ASSIGNED_TO_DEAD_SERVER) { Set<UUID> idsToIgnore = candidates.remove(state.current); if (idsToIgnore != null) {
TabletLocationState result = new TabletLocationState(RootTable.EXTENT, futureSession, currentSession, lastSession, null, logs, false); log.debug("Returning root tablet state: {}", result);
TServerInstance server = tls.getServer(); TabletState state = tls.getState(currentTServers.keySet()); if (Master.log.isTraceEnabled()) { Master.log.trace("Goal state {} current {} for {}", goal, state, tls.extent); if (server.equals(this.master.migrations.get(tls.extent))) this.master.migrations.remove(tls.extent); TServerInstance tserver = tls.futureOrCurrent(); if (!logsForDeadServers.containsKey(tserver)) { logsForDeadServers.put(tserver, wals.getWalsInUse(tserver)); case ASSIGNED_TO_DEAD_SERVER: assignedToDeadServers.add(tls); if (!logsForDeadServers.containsKey(tls.futureOrCurrent())) { logsForDeadServers.put(tls.futureOrCurrent(), wals.getWalsInUse(tls.futureOrCurrent()));
@Override public void unassign(Collection<TabletLocationState> tablets, Map<TServerInstance,List<Path>> logsForDeadServers) throws DistributedStoreException { if (tablets.size() != 1) throw new IllegalArgumentException("There is only one root tablet"); TabletLocationState tls = tablets.iterator().next(); if (tls.extent.compareTo(RootTable.EXTENT) != 0) throw new IllegalArgumentException("You can only store the root tablet location"); if (logsForDeadServers != null) { List<Path> logs = logsForDeadServers.get(tls.futureOrCurrent()); if (logs != null) { for (Path entry : logs) { LogEntry logEntry = new LogEntry(RootTable.EXTENT, System.currentTimeMillis(), tls.futureOrCurrent().getLocation().toString(), entry.toString()); byte[] value; try { value = logEntry.toBytes(); } catch (IOException ex) { throw new DistributedStoreException(ex); } store.put(RootTable.ZROOT_TABLET_WALOGS + "/" + logEntry.getUniqueID(), value); } } } store.remove(RootTable.ZROOT_TABLET_LOCATION); store.remove(RootTable.ZROOT_TABLET_FUTURE_LOCATION); log.debug("unassign root tablet location"); }
public TabletState getState(Set<TServerInstance> liveServers) { TServerInstance server = getServer(); if (server == null) return TabletState.UNASSIGNED; if (server.equals(current) || server.equals(future)) { if (liveServers.contains(server)) if (server.equals(future)) { return TabletState.ASSIGNED; } else { return TabletState.HOSTED; } else { return TabletState.ASSIGNED_TO_DEAD_SERVER; } } // server == last return TabletState.UNASSIGNED; }
@Override public void unassign(Collection<TabletLocationState> tablets, Map<TServerInstance,List<Path>> logsForDeadServers) throws DistributedStoreException { if (tablets.size() != 1) throw new IllegalArgumentException("There is only one root tablet"); TabletLocationState tls = tablets.iterator().next(); if (tls.extent.compareTo(RootTable.EXTENT) != 0) throw new IllegalArgumentException("You can only store the root tablet location"); if (logsForDeadServers != null) { List<Path> logs = logsForDeadServers.get(tls.futureOrCurrent()); if (logs != null) { for (Path entry : logs) { LogEntry logEntry = new LogEntry(RootTable.EXTENT, System.currentTimeMillis(), tls.futureOrCurrent().getLocation().toString(), entry.toString()); byte[] value; try { value = logEntry.toBytes(); } catch (IOException ex) { throw new DistributedStoreException(ex); } store.put(RootTable.ZROOT_TABLET_WALOGS + "/" + logEntry.getUniqueID(), value); } } } store.remove(RootTable.ZROOT_TABLET_LOCATION); store.remove(RootTable.ZROOT_TABLET_FUTURE_LOCATION); log.debug("unassign root tablet location"); }
private static int checkTablets(ServerContext context, Iterator<TabletLocationState> scanner, LiveTServerSet tservers) { int offline = 0; while (scanner.hasNext() && !System.out.checkError()) { TabletLocationState locationState = scanner.next(); TabletState state = locationState.getState(tservers.getCurrentServers()); if (state != null && state != TabletState.HOSTED && context.getTableManager() .getTableState(locationState.extent.getTableId()) != TableState.OFFLINE) { System.out .println(locationState + " is " + state + " #walogs:" + locationState.walogs.size()); offline++; } } return offline; } }
TServerInstance server = tls.getServer(); TabletState state = tls.getState(currentTServers.keySet()); if (Master.log.isTraceEnabled()) { Master.log.trace("Goal state " + goal + " current " + state + " for " + tls.extent); if (server.equals(this.master.migrations.get(tls.extent))) this.master.migrations.remove(tls.extent); TServerInstance tserver = tls.futureOrCurrent(); if (!logsForDeadServers.containsKey(tserver)) { logsForDeadServers.put(tserver, wals.getWalsInUse(tserver)); case ASSIGNED_TO_DEAD_SERVER: assignedToDeadServers.add(tls); if (!logsForDeadServers.containsKey(tls.futureOrCurrent())) { logsForDeadServers.put(tls.futureOrCurrent(), wals.getWalsInUse(tls.futureOrCurrent()));
TabletLocationState tls = null; try { tls = new TabletLocationState(extent, null, instance, null, null, null, false); } catch (BadLocationStateException e) { log.error("Unexpected error", e);
throw new BadLocationStateException(msg, k.getRow()); return new TabletLocationState(extent, future, current, last, suspend, walogs, chopped);
return TabletGoalState.HOSTED; case WAITING_FOR_CHOPPED: if (tls.getState(tserverSet.getCurrentServers()).equals(TabletState.HOSTED)) { if (tls.chopped) return TabletGoalState.UNASSIGNED;
TabletLocationState tls = null; try { tls = new TabletLocationState(extent, null, instance, null, null, false); } catch (BadLocationStateException e) { log.error("Unexpected error ", e);
@Override public long isReady(long tid, Master master) throws Exception { if (!master.hasCycled(creationTime)) { return 50; } boolean done = true; Range tableRange = new KeyExtent(tableId, null, null).toMetadataRange(); Scanner scanner = master.getContext().createScanner(MetadataTable.NAME, Authorizations.EMPTY); MetaDataTableScanner.configureScanner(scanner, master); scanner.setRange(tableRange); for (Entry<Key,Value> entry : scanner) { TabletLocationState locationState = MetaDataTableScanner .createTabletLocationState(entry.getKey(), entry.getValue()); TabletState state = locationState.getState(master.onlineTabletServers()); 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; break; } } if (!done) return 50; return 0; }
TabletLocationState result = new TabletLocationState(RootTable.EXTENT, futureSession, currentSession, lastSession, null, logs, false); log.debug("Returning root tablet state: " + result);
if (tls.getState(master.onlineTabletServers()) != TabletState.UNASSIGNED && tls.getState(master.onlineTabletServers()) != TabletState.SUSPENDED) { log.debug("failing consistency: assigned or hosted {}", tls); return false; verify.update(tls.extent, tls.getState(master.onlineTabletServers()), tls.chopped, !tls.walogs.isEmpty());
return null; return new TabletLocationState(extent, future, current, last, walogs, chopped);
if (state.getState(liveServers) == TabletState.ASSIGNED_TO_DEAD_SERVER) { Set<UUID> idsToIgnore = candidates.remove(state.current); if (idsToIgnore != null) {
TabletLocationState result = new TabletLocationState(Constants.ROOT_TABLET_EXTENT, futureSession, currentSession, lastSession, logs, false); log.debug("Returning root tablet state: " + result); return result;