本文整理汇总了Java中org.apache.helix.store.zk.ZkHelixPropertyStore.get方法的典型用法代码示例。如果您正苦于以下问题:Java ZkHelixPropertyStore.get方法的具体用法?Java ZkHelixPropertyStore.get怎么用?Java ZkHelixPropertyStore.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.helix.store.zk.ZkHelixPropertyStore
的用法示例。
在下文中一共展示了ZkHelixPropertyStore.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRealtimeSegmentZKMetadata
import org.apache.helix.store.zk.ZkHelixPropertyStore; //导入方法依赖的package包/类
@Nullable
public static RealtimeSegmentZKMetadata getRealtimeSegmentZKMetadata(
@Nonnull ZkHelixPropertyStore<ZNRecord> propertyStore, @Nonnull String tableName, @Nonnull String segmentName) {
String realtimeTableName = TableNameBuilder.REALTIME.tableNameWithType(tableName);
ZNRecord znRecord = propertyStore.get(constructPropertyStorePathForSegment(realtimeTableName, segmentName), null,
AccessOption.PERSISTENT);
// It is possible that the segment metadata has just been deleted due to retention.
if (znRecord == null) {
return null;
}
if (SegmentName.isHighLevelConsumerSegmentName(segmentName)) {
return new RealtimeSegmentZKMetadata(znRecord);
} else {
return new LLCRealtimeSegmentZKMetadata(znRecord);
}
}
示例2: getInstanceZKMetadata
import org.apache.helix.store.zk.ZkHelixPropertyStore; //导入方法依赖的package包/类
public static InstanceZKMetadata getInstanceZKMetadata(ZkHelixPropertyStore<ZNRecord> propertyStore, String instanceId) {
ZNRecord znRecord = propertyStore.get(StringUtil.join("/", PROPERTYSTORE_INSTANCE_CONFIGS_PREFIX, instanceId), null, AccessOption.PERSISTENT);
if (znRecord == null) {
return null;
}
return new InstanceZKMetadata(znRecord);
}
示例3: getOfflineTableConfig
import org.apache.helix.store.zk.ZkHelixPropertyStore; //导入方法依赖的package包/类
public static AbstractTableConfig getOfflineTableConfig(ZkHelixPropertyStore<ZNRecord> propertyStore, String tableName) {
String offlineTableName = TableNameBuilder.OFFLINE_TABLE_NAME_BUILDER.forTable(tableName);
ZNRecord znRecord = propertyStore.get(constructPropertyStorePathForResourceConfig(offlineTableName), null, AccessOption.PERSISTENT);
if (znRecord == null) {
return null;
}
try {
return AbstractTableConfig.fromZnRecord(znRecord);
} catch (Exception e) {
LOGGER.warn("Caught exception while getting offline table configuration", e);
return null;
}
}
示例4: getRealtimeTableConfig
import org.apache.helix.store.zk.ZkHelixPropertyStore; //导入方法依赖的package包/类
public static AbstractTableConfig getRealtimeTableConfig(ZkHelixPropertyStore<ZNRecord> propertyStore, String tableName) {
String realtimeTableName = TableNameBuilder.REALTIME_TABLE_NAME_BUILDER.forTable(tableName);
ZNRecord znRecord = propertyStore.get(constructPropertyStorePathForResourceConfig(realtimeTableName), null, AccessOption.PERSISTENT);
if (znRecord == null) {
return null;
}
try {
return AbstractTableConfig.fromZnRecord(znRecord);
} catch (Exception e) {
LOGGER.warn("Caught exception while getting realtime table configuration", e);
return null;
}
}
示例5: getClusterTenantIsolationEnabled
import org.apache.helix.store.zk.ZkHelixPropertyStore; //导入方法依赖的package包/类
public static Boolean getClusterTenantIsolationEnabled(ZkHelixPropertyStore<ZNRecord> propertyStore) {
String controllerConfigPath = constructPropertyStorePathForControllerConfig(CLUSTER_TENANT_ISOLATION_ENABLED_KEY);
if (propertyStore.exists(controllerConfigPath, AccessOption.PERSISTENT)) {
ZNRecord znRecord = propertyStore.get(controllerConfigPath, null, AccessOption.PERSISTENT);
if (znRecord.getSimpleFields().keySet().contains(CLUSTER_TENANT_ISOLATION_ENABLED_KEY)) {
return znRecord.getBooleanField(CLUSTER_TENANT_ISOLATION_ENABLED_KEY, true);
} else {
return true;
}
} else {
return true;
}
}
示例6: onBecomeMasterFromSlave
import org.apache.helix.store.zk.ZkHelixPropertyStore; //导入方法依赖的package包/类
/**
* When the node becomes master, it will start accepting writes and increments
* the epoch and starts logging the changes in a file
* @param message
* @param context
* @throws Exception
*/
@Transition(from = "SLAVE", to = "MASTER")
public void onBecomeMasterFromSlave(final Message message, NotificationContext context)
throws Exception {
replicator.stop();
System.out.println(_serverId + " transitioning from " + message.getFromState() + " to "
+ message.getToState() + " for " + _partition);
ZkHelixPropertyStore<ZNRecord> helixPropertyStore =
context.getManager().getHelixPropertyStore();
String checkpointDirPath = instanceConfig.getRecord().getSimpleField("check_point_dir");
CheckpointFile checkpointFile = new CheckpointFile(checkpointDirPath);
final ChangeRecord lastRecordProcessed = checkpointFile.findLastRecordProcessed();
DataUpdater<ZNRecord> updater = new HighWaterMarkUpdater(message, lastRecordProcessed);
helixPropertyStore.update("/TRANSACTION_ID_METADATA" + "/" + message.getResourceName(),
updater, AccessOption.PERSISTENT);
Stat stat = new Stat();
;
ZNRecord znRecord =
helixPropertyStore.get("/TRANSACTION_ID_METADATA" + "/" + message.getResourceName(), stat,
AccessOption.PERSISTENT);
int startGen = Integer.parseInt(znRecord.getSimpleField("currentGen"));
int startSeq = Integer.parseInt(znRecord.getSimpleField("currentGenStartSeq"));
String fileStoreDir = instanceConfig.getRecord().getSimpleField("file_store_dir");
String changeLogDir = instanceConfig.getRecord().getSimpleField("change_log_dir");
generator = new ChangeLogGenerator(changeLogDir, startGen, startSeq);
// To indicate that we need callbacks for changes that happen starting now
long now = System.currentTimeMillis();
service = new FileSystemWatchService(fileStoreDir, now, generator);
service.start();
System.out.println(_serverId + " transitioned from " + message.getFromState() + " to "
+ message.getToState() + " for " + _partition);
}
示例7: getTableConfig
import org.apache.helix.store.zk.ZkHelixPropertyStore; //导入方法依赖的package包/类
private TableConfig getTableConfig(String tableName)
throws IOException, JSONException {
ZNRecordSerializer serializer = new ZNRecordSerializer();
String path = PropertyPathConfig.getPath(PropertyType.PROPERTYSTORE, zkPath);
ZkHelixPropertyStore<ZNRecord> propertyStore = new ZkHelixPropertyStore<>(zkHost, serializer, path);
ZNRecord tcZnRecord = propertyStore.get("/CONFIGS/TABLE/" + tableName, null, 0);
TableConfig tableConfig = TableConfig.fromZnRecord(tcZnRecord);
LOGGER.debug("Loaded table config");
return tableConfig;
}
示例8: getInstanceZKMetadata
import org.apache.helix.store.zk.ZkHelixPropertyStore; //导入方法依赖的package包/类
public static InstanceZKMetadata getInstanceZKMetadata(ZkHelixPropertyStore<ZNRecord> propertyStore, String instanceId) {
ZNRecord znRecord = propertyStore.get(StringUtil.join("/", PROPERTYSTORE_INSTANCE_CONFIGS_PREFIX, instanceId), null,
AccessOption.PERSISTENT);
if (znRecord == null) {
return null;
}
return new InstanceZKMetadata(znRecord);
}
示例9: getZnRecord
import org.apache.helix.store.zk.ZkHelixPropertyStore; //导入方法依赖的package包/类
@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;
}
示例10: getOfflineSegmentZKMetadata
import org.apache.helix.store.zk.ZkHelixPropertyStore; //导入方法依赖的package包/类
@Nullable
public static OfflineSegmentZKMetadata getOfflineSegmentZKMetadata(
@Nonnull ZkHelixPropertyStore<ZNRecord> propertyStore, @Nonnull String tableName, @Nonnull String segmentName) {
String offlineTableName = TableNameBuilder.OFFLINE.tableNameWithType(tableName);
ZNRecord znRecord = propertyStore.get(constructPropertyStorePathForSegment(offlineTableName, segmentName), null,
AccessOption.PERSISTENT);
if (znRecord == null) {
return null;
}
return new OfflineSegmentZKMetadata(znRecord);
}
示例11: getPartitionToReplicaGroupMappingZKMedata
import org.apache.helix.store.zk.ZkHelixPropertyStore; //导入方法依赖的package包/类
@Nullable
public static PartitionToReplicaGroupMappingZKMetadata getPartitionToReplicaGroupMappingZKMedata(
@Nonnull ZkHelixPropertyStore<ZNRecord> propertyStore, @Nonnull String tableName) {
// Segment Assignment Strategy is triggered only for offline table.
String offlineTableName = TableNameBuilder.OFFLINE.tableNameWithType(tableName);
ZNRecord znRecord = propertyStore.get(constructPropertyStorePathForInstancePartitions(offlineTableName), null,
AccessOption.PERSISTENT);
if (znRecord == null) {
return null;
}
return new PartitionToReplicaGroupMappingZKMetadata(znRecord);
}
示例12: getTableConfig
import org.apache.helix.store.zk.ZkHelixPropertyStore; //导入方法依赖的package包/类
@Nullable
public static TableConfig getTableConfig(@Nonnull ZkHelixPropertyStore<ZNRecord> propertyStore,
@Nonnull String tableNameWithType) {
ZNRecord znRecord = propertyStore.get(constructPropertyStorePathForResourceConfig(tableNameWithType), null,
AccessOption.PERSISTENT);
if (znRecord == null) {
return null;
}
try {
return TableConfig.fromZnRecord(znRecord);
} catch (Exception e) {
LOGGER.error("Caught exception while getting table configuration for table: {}", tableNameWithType, e);
return null;
}
}
示例13: getSchema
import org.apache.helix.store.zk.ZkHelixPropertyStore; //导入方法依赖的package包/类
@Nullable
public static Schema getSchema(@Nonnull ZkHelixPropertyStore<ZNRecord> propertyStore, @Nonnull String schemaName) {
try {
ZNRecord schemaZNRecord =
propertyStore.get(constructPropertyStorePathForSchema(schemaName), null, AccessOption.PERSISTENT);
if (schemaZNRecord == null) {
return null;
}
return SchemaUtils.fromZNRecord(schemaZNRecord);
} catch (Exception e) {
LOGGER.error("Caught exception while getting schema: {}", schemaName, e);
return null;
}
}
示例14: getOfflineSegmentZKMetadata
import org.apache.helix.store.zk.ZkHelixPropertyStore; //导入方法依赖的package包/类
public static OfflineSegmentZKMetadata getOfflineSegmentZKMetadata(ZkHelixPropertyStore<ZNRecord> propertyStore, String tableName, String segmentName) {
String offlineTableName = TableNameBuilder.OFFLINE_TABLE_NAME_BUILDER.forTable(tableName);
return new OfflineSegmentZKMetadata(propertyStore.get(constructPropertyStorePathForSegment(offlineTableName, segmentName), null, AccessOption.PERSISTENT));
}
示例15: getRealtimeSegmentZKMetadata
import org.apache.helix.store.zk.ZkHelixPropertyStore; //导入方法依赖的package包/类
public static RealtimeSegmentZKMetadata getRealtimeSegmentZKMetadata(ZkHelixPropertyStore<ZNRecord> propertyStore, String tableName, String segmentName) {
String realtimeTableName = TableNameBuilder.REALTIME_TABLE_NAME_BUILDER.forTable(tableName);
return new RealtimeSegmentZKMetadata(propertyStore.get(constructPropertyStorePathForSegment(realtimeTableName, segmentName), null, AccessOption.PERSISTENT));
}