/** * Returns a String representing the previous extent's entry in the Metadata table * */ public Mutation getPrevRowUpdateMutation() { return getPrevRowUpdateMutation(this); }
public static Mutation getPrevRowUpdateMutation(KeyExtent ke) { return org.apache.accumulo.core.data.impl.KeyExtent.getPrevRowUpdateMutation(ke.wrapped); }
public Mutation getPrevRowUpdateMutation() { return wrapped.getPrevRowUpdateMutation(); }
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 addTablet(KeyExtent extent, String path, ClientContext 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); }
public static void splitTablet(KeyExtent extent, Text oldPrevEndRow, double splitRatio, ClientContext 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); }
public static void rollBackSplit(Text metadataEntry, Text oldPrevEndRow, ClientContext 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)); }
public static void addNewTablet(ClientContext 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); }
Mutation mut = extent.getPrevRowUpdateMutation(); new TServerInstance(HostAndPort.fromParts("192.168.1.100", 4567), "DEADBEEF") .putLocation(mut);
for (String s : splits) { Text split = new Text(s); Mutation prevRow = KeyExtent.getPrevRowUpdateMutation(new KeyExtent(tableId, split, pr)); prevRow.put(TabletsSection.CurrentLocationColumnFamily.NAME, new Text("123456"), new Value("127.0.0.1:1234".getBytes())); Mutation defaultTablet = KeyExtent.getPrevRowUpdateMutation(new KeyExtent(tableId, null, pr)); defaultTablet.put(TabletsSection.CurrentLocationColumnFamily.NAME, new Text("123456"), new Value("127.0.0.1:1234".getBytes())); Mutation m = new KeyExtent(tableId, new Text("t"), new Text("p")).getPrevRowUpdateMutation(); TabletsSection.TabletColumnFamily.SPLIT_RATIO_COLUMN.put(m, new Value("0.5".getBytes())); TabletsSection.TabletColumnFamily.OLD_PREV_ROW_COLUMN.put(m, m = tablet.getPrevRowUpdateMutation(); TabletsSection.TabletColumnFamily.SPLIT_RATIO_COLUMN.put(m, new Value("0.5".getBytes())); update(connector, m); m = tablet.getPrevRowUpdateMutation(); ChoppedColumnFamily.CHOPPED_COLUMN.put(m, new Value("junk".getBytes())); update(connector, m); m = tablet.getPrevRowUpdateMutation(); Collection<Collection<String>> walogs = Collections.emptyList(); metaDataStateStore.unassign(
@Test public void testMerge() throws Exception { // create a fake metadata table String metadataTableName = getUniqueNames(1)[0]; getConnector().tableOperations().create(metadataTableName); KeyExtent ke1 = new KeyExtent("0", new Text("m"), null); Mutation mut1 = ke1.getPrevRowUpdateMutation(); TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.put(mut1, new Value("/d1".getBytes())); KeyExtent ke2 = new KeyExtent("0", null, null); Mutation mut2 = ke2.getPrevRowUpdateMutation(); TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.put(mut2, new Value("/d2".getBytes())); BatchWriter bw1 = getConnector().createBatchWriter(metadataTableName, new BatchWriterConfig()); bw1.addMutation(mut1); bw1.addMutation(mut2); bw1.close(); TestTabletIterator tabIter = new TestTabletIterator(getConnector(), metadataTableName); exception.expect(TabletDeletedException.class); while (tabIter.hasNext()) { tabIter.next(); } } }
Mutation mut = ke.getPrevRowUpdateMutation();
@Test public void testNoFiles() throws Exception { Connector conn = getConnector(); String tableName = getUniqueNames(1)[0]; conn.tableOperations().create(tableName); KeyExtent ke = new KeyExtent("0", null, null); Mutation mut = ke.getPrevRowUpdateMutation(); TabletsSection.ServerColumnFamily.TIME_COLUMN.put(mut, new Value("M0".getBytes())); TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.put(mut, new Value("/default_tablet".getBytes())); BatchWriter bw1 = conn.createBatchWriter(tableName, new BatchWriterConfig()); bw1.addMutation(mut); bw1.close(); BatchWriter bw2 = conn.createBatchWriter(tableName, new BatchWriterConfig()); MetadataTableUtil.initializeClone(tableName, "0", "1", conn, bw2); int rc = MetadataTableUtil.checkClone(tableName, "0", "1", conn, bw2); assertEquals(0, rc); // scan tables metadata entries and confirm the same }
Mutation m = extent.getPrevRowUpdateMutation(); m = extent2.getPrevRowUpdateMutation(); TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.put(m, new Value("/t2".getBytes())); TabletsSection.ServerColumnFamily.TIME_COLUMN.put(m, new Value("M0".getBytes()));
Mutation updatePrevRow = stop.getPrevRowUpdateMutation(); Master.log.debug("Setting the prevRow for last tablet: " + stop); bw.addMutation(updatePrevRow);