Refine search
Text value = new Text(); Field rowField = row.getField(rowIdOrdinal); if (rowField.isNull()) { Mutation mutation = new Mutation(value); mutation.put(ROW_ID_COLUMN, ROW_ID_COLUMN, new Value(value.copyBytes())); for (AccumuloColumnHandle columnHandle : columns) { mutation.put(columnHandle.getFamily().get(), columnHandle.getQualifier().get(), new Value(value.copyBytes()));
protected void deserializeData(AccumuloRowSerializer serializer, byte[] data) { Mutation m = new Mutation("row"); m.put(b("a"), b("a"), data); Key key = new Key(b("row"), b("a"), b("b"), b(), 0, false); Value value = new Value(data); serializer.setMapping(COLUMN_NAME, "a", "b"); serializer.deserialize(new SimpleImmutableEntry<>(key, value)); }
private static void createEntriesForTablet(TreeMap<Key,Value> map, Tablet tablet) { Value EMPTY_SIZE = new DataFileValue(0, 0).encodeAsValue(); Text extent = new Text(TabletsSection.getRow(tablet.tableId, tablet.endRow)); addEntry(map, extent, DIRECTORY_COLUMN, new Value(tablet.dir.getBytes(UTF_8))); addEntry(map, extent, TIME_COLUMN, new Value((TabletTime.LOGICAL_TIME_ID + "0").getBytes(UTF_8))); addEntry(map, extent, PREV_ROW_COLUMN, KeyExtent.encodePrevEndRow(tablet.prevEndRow)); for (String file : tablet.files) { addEntry(map, extent, new ColumnFQ(DataFileColumnFamily.NAME, new Text(file)), EMPTY_SIZE); } }
Map<Key,Value> future = new HashMap<>(); Map<Key,Value> assigned = new HashMap<>(); KeyExtent extent = new KeyExtent(row, new Value(new byte[] {0})); String table = MetadataTable.NAME; if (extent.isMeta()) BatchWriter bw = this.master.getContext().createBatchWriter(table, new BatchWriterConfig()); Mutation m = new Mutation(entry.getKey().getRow()); m.putDelete(entry.getKey().getColumnFamily(), entry.getKey().getColumnQualifier()); bw.addMutation(m);
public static void addNewTablet(ServerContext context, KeyExtent extent, String path, TServerInstance location, Map<FileRef,DataFileValue> datafileSizes, Map<Long,? extends Collection<FileRef>> bulkLoadedFiles, String time, long lastFlushID, long lastCompactID, ZooLock zooLock) { Mutation m = extent.getPrevRowUpdateMutation(); TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.put(m, new Value(path.getBytes(UTF_8))); TabletsSection.ServerColumnFamily.TIME_COLUMN.put(m, new Value(time.getBytes(UTF_8))); if (lastFlushID > 0) TabletsSection.ServerColumnFamily.FLUSH_COLUMN.put(m, new Value(("" + lastFlushID).getBytes())); if (lastCompactID > 0) TabletsSection.ServerColumnFamily.COMPACT_COLUMN.put(m, new Value(("" + lastCompactID).getBytes())); if (location != null) { location.putLocation(m); location.clearFutureLocation(m); } for (Entry<FileRef,DataFileValue> entry : datafileSizes.entrySet()) { m.put(DataFileColumnFamily.NAME, entry.getKey().meta(), new Value(entry.getValue().encode())); } for (Entry<Long,? extends Collection<FileRef>> entry : bulkLoadedFiles.entrySet()) { Value tidBytes = new Value(Long.toString(entry.getKey()).getBytes()); for (FileRef ref : entry.getValue()) { m.put(TabletsSection.BulkFileColumnFamily.NAME, ref.meta(), new Value(tidBytes)); } } MetadataTableUtil.update(context, zooLock, m, extent); }
@Override public Mutation next() { Text row_value = new Text( Long.toString(((r.nextLong() & 0x7fffffffffffffffL) / 177) % 100000000000L)); Mutation m = new Mutation(row_value); for (int column = 0; column < num_columns_per_row; column++) { Text column_fam = new Text("col_fam"); byte[] bytes = new byte[num_payload_bytes]; r.nextBytes(bytes); m.put(column_fam, new Text("" + column), new Value(bytes)); } mutations_so_far++; if (mutations_so_far % 1000000 == 0) { log.info("Created {} mutations so far", mutations_so_far); } return m; }
public static void updateTabletDataFile(long tid, KeyExtent extent, Map<FileRef,DataFileValue> estSizes, String time, ServerContext context, ZooLock zooLock) { Mutation m = new Mutation(extent.getMetadataEntry()); byte[] tidBytes = Long.toString(tid).getBytes(UTF_8); for (Entry<FileRef,DataFileValue> entry : estSizes.entrySet()) { Text file = entry.getKey().meta(); m.put(DataFileColumnFamily.NAME, file, new Value(entry.getValue().encode())); m.put(TabletsSection.BulkFileColumnFamily.NAME, file, new Value(tidBytes)); } TabletsSection.ServerColumnFamily.TIME_COLUMN.put(m, new Value(time.getBytes(UTF_8))); update(context, zooLock, m, extent); }
Mutation m = new Mutation(k.getRow()); m.putDelete(k.getColumnFamily(), k.getColumnQualifier()); VolumeChooserEnvironment chooserEnv = new VolumeChooserEnvironment(tableId, context); + Constants.HDFS_TABLES_DIR + Path.SEPARATOR + tableId + Path.SEPARATOR + new String( FastFormat.toZeroPaddedString(dirCount++, 8, 16, Constants.CLONE_PREFIX_BYTES)); TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.put(m, new Value(dir.getBytes(UTF_8)));
private static Mutation createTablet(String tid, String endRow, String prevRow, String dir, String file) throws Exception { KeyExtent ke = new KeyExtent(tid, endRow == null ? null : new Text(endRow), prevRow == null ? null : new Text(prevRow)); Mutation mut = ke.getPrevRowUpdateMutation(); TabletsSection.ServerColumnFamily.TIME_COLUMN.put(mut, new Value("M0".getBytes())); TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.put(mut, new Value(dir.getBytes())); mut.put(DataFileColumnFamily.NAME.toString(), file, new DataFileValue(10, 200).encodeAsString()); return mut; }
public static void addBulkLoadInProgressFlag(ServerContext context, String path) { Mutation m = new Mutation(MetadataSchema.BlipSection.getRowPrefix() + path); m.put(EMPTY_TEXT, EMPTY_TEXT, new Value(new byte[] {})); // new KeyExtent is only added to force update to write to the metadata table, not the root // table // because bulk loads aren't supported to the metadata table update(context, m, new KeyExtent(Table.ID.of("anythingNotMetadata"), null, null)); }
public static void updateTabletFlushID(KeyExtent extent, long flushID, ServerContext context, ZooLock zooLock) { if (!extent.isRootTablet()) { Mutation m = new Mutation(extent.getMetadataEntry()); TabletsSection.ServerColumnFamily.FLUSH_COLUMN.put(m, new Value((flushID + "").getBytes(UTF_8))); update(context, zooLock, m, extent); } }
public static Mutation createDeleteMutation(ServerContext context, Table.ID tableId, String pathToRemove) { Path path = context.getVolumeManager().getFullPath(tableId, pathToRemove); Mutation delFlag = new Mutation(new Text(MetadataSchema.DeletesSection.getRowPrefix() + path)); delFlag.put(EMPTY_TEXT, EMPTY_TEXT, new Value(new byte[] {})); return delFlag; }
private void prepKeys() throws IOException { if (topKey != null) return; Text currentRow; Text currentCf; do { if (!sourceIter.hasTop()) return; currentRow = new Text(sourceIter.getTopKey().getRow()); currentCf = new Text(sourceIter.getTopKey().getColumnFamily()); keys.clear(); values.clear(); while (sourceIter.hasTop() && sourceIter.getTopKey().getRow().equals(currentRow) && sourceIter.getTopKey().getColumnFamily().equals(currentCf)) { keys.add(new Key(sourceIter.getTopKey())); values.add(new Value(sourceIter.getTopValue())); sourceIter.next(); } } while (!filter(currentRow, keys, values)); topKey = new Key(currentRow, currentCf); topValue = encodeColumnFamily(keys, values); }