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 void setLocations(Collection<Assignment> assignments) throws DistributedStoreException { BatchWriter writer = createBatchWriter(); try { for (Assignment assignment : assignments) { Mutation m = new Mutation(assignment.tablet.getMetadataEntry()); assignment.server.putLocation(m); assignment.server.clearFutureLocation(m); SuspendingTServer.clearSuspension(m); writer.addMutation(m); } } catch (Exception ex) { throw new DistributedStoreException(ex); } finally { try { writer.close(); } catch (MutationsRejectedException e) { throw new DistributedStoreException(e); } } }
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); bw.addMutation(mut);
moved.current.putLocation(assignment); bw.addMutation(assignment); bw.close(); moved.current.putLocation(assignment); bw.addMutation(assignment); bw.close();
@Override public void setLocations(Collection<Assignment> assignments) throws DistributedStoreException { BatchWriter writer = createBatchWriter(); try { for (Assignment assignment : assignments) { Mutation m = new Mutation(assignment.tablet.getMetadataEntry()); assignment.server.putLocation(m); assignment.server.clearFutureLocation(m); SuspendingTServer.clearSuspension(m); writer.addMutation(m); } } catch (Exception ex) { throw new DistributedStoreException(ex); } finally { try { writer.close(); } catch (MutationsRejectedException e) { throw new DistributedStoreException(e); } } }