Scanner scanner = client.createScanner(targetSystemTable, Authorizations.EMPTY); scanner.setRange(scanRange); TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.fetch(scanner); TabletsSection.ServerColumnFamily.TIME_COLUMN.fetch(scanner); TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.fetch(scanner); scanner.fetchColumnFamily(DataFileColumnFamily.NAME); Mutation m = new Mutation(stopRow); m.put(key.getColumnFamily(), key.getColumnQualifier(), value); fileCount++; } else if (TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.hasColumns(key) && firstPrevRowValue == null) { Master.log.debug("prevRow entry for lowest tablet is {}", value); firstPrevRowValue = new Value(value); } else if (TabletsSection.ServerColumnFamily.TIME_COLUMN.hasColumns(key)) { maxLogicalTime = TabletTime.maxMetadataTime(maxLogicalTime, value.toString()); } else if (TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.hasColumns(key)) { bw.addMutation(MetadataTableUtil.createDeleteMutation(master.getContext(), range.getTableId(), entry.getValue().toString())); TabletsSection.ServerColumnFamily.TIME_COLUMN.fetch(scanner); for (Entry<Key,Value> entry : scanner) { if (TabletsSection.ServerColumnFamily.TIME_COLUMN.hasColumns(entry.getKey())) { maxLogicalTime = TabletTime.maxMetadataTime(maxLogicalTime, entry.getValue().toString()); TabletsSection.ServerColumnFamily.TIME_COLUMN.put(m, new Value(maxLogicalTime.getBytes())); ChoppedColumnFamily.CHOPPED_COLUMN.putDelete(m); bw.addMutation(m);
TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.fetch(scanner); scanner.fetchColumnFamily(TabletsSection.CurrentLocationColumnFamily.NAME); if (TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.equals(colf, colq)) { KeyExtent tabletKe = new KeyExtent(entry.getKey().getRow(), entry.getValue()); tablets.add(tabletKe);
private static boolean isValidColumn(ColumnUpdate cu) { if (validColumnFams.contains(new Text(cu.getColumnFamily()))) return true; return validColumnQuals.contains(new ColumnFQ(cu)); }
public static void clearSuspension(Mutation m) { m.putDelete(SUSPEND_COLUMN.getColumnFamily(), SUSPEND_COLUMN.getColumnQualifier()); }
public static void splitTablet(KeyExtent extent, Text oldPrevEndRow, double splitRatio, ServerContext context, ZooLock zooLock) { Mutation m = extent.getPrevRowUpdateMutation(); // TabletsSection.TabletColumnFamily.SPLIT_RATIO_COLUMN.put(m, new Value(Double.toString(splitRatio).getBytes(UTF_8))); TabletsSection.TabletColumnFamily.OLD_PREV_ROW_COLUMN.put(m, KeyExtent.encodePrevEndRow(oldPrevEndRow)); ChoppedColumnFamily.CHOPPED_COLUMN.putDelete(m); update(context, zooLock, m, extent); }
scanner.fetchColumnFamily(MetadataSchema.TabletsSection.DataFileColumnFamily.NAME); scanner.fetchColumnFamily(MetadataSchema.TabletsSection.LogColumnFamily.NAME); MetadataSchema.TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.fetch(scanner); getLogURIs(volumes, le); } else if (MetadataSchema.TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN .hasColumns(entry.getKey())) { volumes.add(getTableURI(entry.getValue().toString()));
/** * If a migrating tablet splits, and the tablet dies before sending the master a message, the * migration will refer to a non-existing tablet, so it can never complete. Periodically scan * the metadata table and remove any migrating tablets that no longer exist. */ private void cleanupNonexistentMigrations(final AccumuloClient accumuloClient) throws TableNotFoundException { Scanner scanner = accumuloClient.createScanner(MetadataTable.NAME, Authorizations.EMPTY); TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.fetch(scanner); Set<KeyExtent> found = new HashSet<>(); for (Entry<Key,Value> entry : scanner) { KeyExtent extent = new KeyExtent(entry.getKey().getRow(), entry.getValue()); if (migrations.containsKey(extent)) { found.add(extent); } } migrations.keySet().retainAll(found); }
continue; if (ServerColumnFamily.TIME_COLUMN.hasColumns(entry.getKey())) { if (time == null) { time = value.toString(); FileRef ref = new FileRef(fs, key); dataFiles.put(ref, new DataFileValue(entry.getValue().get())); } else if (DIRECTORY_COLUMN.hasColumns(key)) { directory = value.toString(); } else if (family.equals(LogColumnFamily.NAME)) { } else if (family.equals(ScanFileColumnFamily.NAME)) { scanFiles.add(new FileRef(fs, key)); } else if (FLUSH_COLUMN.hasColumns(key)) { flushID = Long.parseLong(value.toString()); } else if (COMPACT_COLUMN.hasColumns(key)) { compactID = Long.parseLong(entry.getValue().toString()); } else if (family.equals(LastLocationColumnFamily.NAME)) { } else if (PREV_ROW_COLUMN.hasColumns(key)) { KeyExtent check = new KeyExtent(key.getRow(), value); if (!check.equals(extent)) {
TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.put(m, new Value(absolutePath.getBytes(UTF_8))); currentRow = metadataRow; TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.put(m, new Value(absolutePath.getBytes(UTF_8))); && TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.hasColumns(key)) { mbw.addMutation(m); break; // its the last column in the last row
public static void configureScanner(ScannerBase scanner, CurrentState state) { TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.fetch(scanner); scanner.fetchColumnFamily(TabletsSection.CurrentLocationColumnFamily.NAME); scanner.fetchColumnFamily(TabletsSection.FutureLocationColumnFamily.NAME); scanner.fetchColumnFamily(TabletsSection.LastLocationColumnFamily.NAME); scanner .fetchColumnFamily(TabletsSection.SuspendLocationColumn.SUSPEND_COLUMN.getColumnFamily()); scanner.fetchColumnFamily(LogColumnFamily.NAME); scanner.fetchColumnFamily(ChoppedColumnFamily.NAME); scanner.addScanIterator(new IteratorSetting(1000, "wholeRows", WholeRowIterator.class)); IteratorSetting tabletChange = new IteratorSetting(1001, "tabletChange", TabletStateChangeIterator.class); if (state != null) { TabletStateChangeIterator.setCurrentServers(tabletChange, state.onlineTabletServers()); TabletStateChangeIterator.setOnlineTables(tabletChange, state.onlineTables()); TabletStateChangeIterator.setMerges(tabletChange, state.merges()); TabletStateChangeIterator.setMigrations(tabletChange, state.migrationsSnapshot()); TabletStateChangeIterator.setMasterState(tabletChange, state.getMasterState()); TabletStateChangeIterator.setShuttingDown(tabletChange, state.shutdownServers()); } scanner.addScanIterator(tabletChange); }
public static void addTablet(KeyExtent extent, String path, ServerContext context, char timeType, ZooLock lock) { Mutation m = extent.getPrevRowUpdateMutation(); TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.put(m, new Value(path.getBytes(UTF_8))); TabletsSection.ServerColumnFamily.TIME_COLUMN.put(m, new Value((timeType + "0").getBytes(UTF_8))); update(context, lock, m, extent); }
MetadataSchema.TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.fetch(s); String tableId = conn.tableOperations().tableIdMap().get(table); Assert.assertTrue("File does not exist: " + p, fs.exists(p)); } else if (cf.equals( MetadataSchema.TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.getColumnFamily())) { Assert.assertEquals("Saw unexpected cq", MetadataSchema.TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.getColumnQualifier(), cq); Path tabletDir = new Path(entry.getValue().toString());
} else if (TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.equals(colf, colq)) { prevRow = new Value(val);
if (new ColumnFQ(update).equals(TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN)) { isSplitMutation = true; } else if (new Text(update.getColumnFamily()) if (!isValidColumn(columnUpdate)) { violations = addViolation(violations, 2); } else if (new ColumnFQ(columnUpdate) .equals(TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN) && columnUpdate.getValue().length > 0 && (violations == null || !violations.contains((short) 4))) { violations = addViolation(violations, 3); } else if (new ColumnFQ(columnUpdate) .equals(TabletsSection.ServerColumnFamily.LOCK_COLUMN)) { if (zooCache == null) { zooCache = new ZooCache(context.getZooReaderWriter(), null);
public static void rollBackSplit(Text metadataEntry, Text oldPrevEndRow, ServerContext context, ZooLock zooLock) { KeyExtent ke = new KeyExtent(metadataEntry, oldPrevEndRow); Mutation m = ke.getPrevRowUpdateMutation(); TabletsSection.TabletColumnFamily.SPLIT_RATIO_COLUMN.putDelete(m); TabletsSection.TabletColumnFamily.OLD_PREV_ROW_COLUMN.putDelete(m); update(context, zooLock, m, new KeyExtent(metadataEntry, (Text) null)); }
final Scanner scanner = shellState.getAccumuloClient().createScanner(systemTableToCheck, Authorizations.EMPTY); TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.fetch(scanner); final Text start = new Text( shellState.getAccumuloClient().tableOperations().tableIdMap().get(tableName)); for (Iterator<Entry<Key,Value>> iterator = scanner.iterator(); iterator.hasNext();) { final Entry<Key,Value> next = iterator.next(); if (TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.hasColumns(next.getKey())) { KeyExtent extent = new KeyExtent(next.getKey().getRow(), next.getValue()); final String pr = encode(encode, extent.getPrevEndRow());
new TServerInstance(entry.getValue(), key.getColumnQualifier())); return null; } else if (TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.hasColumns(key)) { prevEndRow = entry.getValue(); } else if (TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.hasColumns(key)) { dir = entry.getValue(); } else if (TabletsSection.ServerColumnFamily.TIME_COLUMN.hasColumns(key)) { time = entry.getValue();
static public void configureScanner(ScannerBase scanner, CurrentState state) { TabletsSection.TabletColumnFamily.PREV_ROW_COLUMN.fetch(scanner); scanner.fetchColumnFamily(TabletsSection.CurrentLocationColumnFamily.NAME); scanner.fetchColumnFamily(TabletsSection.FutureLocationColumnFamily.NAME); scanner.fetchColumnFamily(TabletsSection.LastLocationColumnFamily.NAME); scanner .fetchColumnFamily(TabletsSection.SuspendLocationColumn.SUSPEND_COLUMN.getColumnFamily()); scanner.fetchColumnFamily(LogColumnFamily.NAME); scanner.fetchColumnFamily(ChoppedColumnFamily.NAME); scanner.addScanIterator(new IteratorSetting(1000, "wholeRows", WholeRowIterator.class)); IteratorSetting tabletChange = new IteratorSetting(1001, "tabletChange", TabletStateChangeIterator.class); if (state != null) { TabletStateChangeIterator.setCurrentServers(tabletChange, state.onlineTabletServers()); TabletStateChangeIterator.setOnlineTables(tabletChange, state.onlineTables()); TabletStateChangeIterator.setMerges(tabletChange, state.merges()); TabletStateChangeIterator.setMigrations(tabletChange, state.migrationsSnapshot()); TabletStateChangeIterator.setMasterState(tabletChange, state.getMasterState()); TabletStateChangeIterator.setShuttingDown(tabletChange, state.shutdownServers()); } scanner.addScanIterator(tabletChange); }
public static void updateTabletDir(KeyExtent extent, String newDir, ServerContext context, ZooLock lock) { Mutation m = new Mutation(extent.getMetadataEntry()); TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.put(m, new Value(newDir.getBytes(UTF_8))); update(context, lock, m, extent); }