@Nullable public static ZNRecord getZnRecord(@Nonnull ZkHelixPropertyStore<ZNRecord> propertyStore, @Nonnull String path) { Stat stat = new Stat(); ZNRecord znRecord = propertyStore.get(path, stat, AccessOption.PERSISTENT); if (znRecord != null) { znRecord.setCreationTime(stat.getCtime()); znRecord.setModifiedTime(stat.getMtime()); znRecord.setVersion(stat.getVersion()); } return znRecord; }
/** * Read the segment merge lineage ZNRecord from the property store * * @param propertyStore a property store * @param tableNameWithType a table name with type * @return a ZNRecord of segment merge lineage, return null if znode does not exist */ public static ZNRecord getSegmentMergeLineageZNRecord(ZkHelixPropertyStore<ZNRecord> propertyStore, String tableNameWithType) { String path = ZKMetadataProvider.constructPropertyStorePathForSegmentMergeLineage(tableNameWithType); Stat stat = new Stat(); ZNRecord segmentMergeLineageZNRecord = propertyStore.get(path, stat, AccessOption.PERSISTENT); if (segmentMergeLineageZNRecord != null) { segmentMergeLineageZNRecord.setVersion(stat.getVersion()); } return segmentMergeLineageZNRecord; }
Stat stat = instanceConfigStatMap.get(instanceConfig.getInstanceName()); if (stat != null) { instanceConfig.getRecord().setVersion(stat.getVersion());
public static List<ZNRecord> getChildren(ZkClient client, String path) { // parent watch will be set by zkClient List<String> children = client.getChildren(path); if (children == null || children.size() == 0) { return Collections.emptyList(); } List<ZNRecord> childRecords = new ArrayList<ZNRecord>(); for (String child : children) { String childPath = path + "/" + child; Stat newStat = new Stat(); ZNRecord record = client.readDataAndStat(childPath, newStat, true); if (record != null) { record.setVersion(newStat.getVersion()); record.setCreationTime(newStat.getCtime()); record.setModifiedTime(newStat.getMtime()); childRecords.add(record); } } return childRecords; }
public static List<ZNRecord> getChildren(HelixZkClient client, String path) { // parent watch will be set by zkClient List<String> children = client.getChildren(path); if (children == null || children.size() == 0) { return Collections.emptyList(); } List<ZNRecord> childRecords = new ArrayList<ZNRecord>(); for (String child : children) { String childPath = path + "/" + child; Stat newStat = new Stat(); ZNRecord record = client.readDataAndStat(childPath, newStat, true); if (record != null) { record.setVersion(newStat.getVersion()); record.setCreationTime(newStat.getCtime()); record.setModifiedTime(newStat.getMtime()); record.setEphemeralOwner(newStat.getEphemeralOwner()); childRecords.add(record); } } return childRecords; }
record.setCreationTime(stat.getCtime()); record.setModifiedTime(stat.getMtime()); record.setVersion(stat.getVersion());
record.setCreationTime(stat.getCtime()); record.setModifiedTime(stat.getMtime()); record.setVersion(stat.getVersion()); record.setEphemeralOwner(stat.getEphemeralOwner());
record.setCreationTime(stat.getCtime()); record.setModifiedTime(stat.getMtime()); record.setVersion(stat.getVersion());
record.setCreationTime(stat.getCtime()); record.setModifiedTime(stat.getMtime()); record.setVersion(stat.getVersion()); record.setEphemeralOwner(stat.getEphemeralOwner());
copy.setVersion(record.getVersion()); copy.setCreationTime(record.getCreationTime()); copy.setModifiedTime(record.getModifiedTime());