public SegmentZKMetadata(ZNRecord znRecord) { _segmentName = znRecord.getSimpleField(CommonConstants.Segment.SEGMENT_NAME); _tableName = znRecord.getSimpleField(CommonConstants.Segment.TABLE_NAME); _crypterName = znRecord.getSimpleField(CommonConstants.Segment.CRYPTER_NAME); _segmentType = znRecord.getEnumField(CommonConstants.Segment.SEGMENT_TYPE, SegmentType.class, SegmentType.OFFLINE); _startTime = znRecord.getLongField(CommonConstants.Segment.START_TIME, -1); _endTime = znRecord.getLongField(CommonConstants.Segment.END_TIME, -1); if (znRecord.getSimpleFields().containsKey(CommonConstants.Segment.TIME_UNIT) && !znRecord .getSimpleField(CommonConstants.Segment.TIME_UNIT).equals(NULL)) { setTimeUnit(znRecord.getEnumField(CommonConstants.Segment.TIME_UNIT, TimeUnit.class, TimeUnit.DAYS)); } _indexVersion = znRecord.getSimpleField(CommonConstants.Segment.INDEX_VERSION); _totalRawDocs = znRecord.getLongField(CommonConstants.Segment.TOTAL_DOCS, -1); _crc = znRecord.getLongField(CommonConstants.Segment.CRC, -1); _creationTime = znRecord.getLongField(CommonConstants.Segment.CREATION_TIME, -1); try { String partitionMetadataJson = znRecord.getSimpleField(CommonConstants.Segment.PARTITION_METADATA); if (partitionMetadataJson != null) { _partitionMetadata = SegmentPartitionMetadata.fromJsonString(partitionMetadataJson); } } catch (IOException e) { LOGGER.error( "Exception caught while reading partition info from zk metadata for segment '{}', partition info dropped.", _segmentName, e); } _segmentUploadStartTime = znRecord.getLongField(CommonConstants.Segment.SEGMENT_UPLOAD_START_TIME, -1); _customMap = znRecord.getMapField(CommonConstants.Segment.CUSTOM_MAP); }
/** * Get the rebalancing mode on this resource * @return {@link IdealStateModeProperty} */ @Deprecated public IdealStateModeProperty getIdealStateMode() { return _record.getEnumField(IdealStateProperty.IDEAL_STATE_MODE.toString(), IdealStateModeProperty.class, IdealStateModeProperty.AUTO); }
/** * Get the rebalancing mode on this resource * @return {@link IdealStateModeProperty} */ @Deprecated public IdealStateModeProperty getIdealStateMode() { return _record.getEnumField(IdealStateProperty.IDEAL_STATE_MODE.toString(), IdealStateModeProperty.class, IdealStateModeProperty.AUTO); }
/** * Get the type of instance that the source is * @return {@link InstanceType} */ public InstanceType getSrcInstanceType() { return _record.getEnumField(Attributes.SRC_INSTANCE_TYPE.toString(), InstanceType.class, InstanceType.PARTICIPANT); }
/** * Get the type of instance that the source is * @return {@link InstanceType} */ public InstanceType getSrcInstanceType() { return _record.getEnumField(Attributes.SRC_INSTANCE_TYPE.toString(), InstanceType.class, InstanceType.PARTICIPANT); }
/** * Get the rebalancing mode on this resource * @return {@link RebalanceMode} */ public RebalanceMode getRebalanceMode() { RebalanceMode property = _record.getEnumField(IdealStateProperty.REBALANCE_MODE.toString(), RebalanceMode.class, RebalanceMode.NONE); if (property == RebalanceMode.NONE) { property = normalizeRebalanceMode(getIdealStateMode()); setRebalanceMode(property); } return property; }
/** * Get the rebalancing mode on this resource * @return {@link RebalanceMode} */ public RebalanceMode getRebalanceMode() { RebalanceMode property = _record.getEnumField(IdealStateProperty.REBALANCE_MODE.toString(), RebalanceMode.class, RebalanceMode.NONE); if (property == RebalanceMode.NONE) { property = normalizeRebalanceMode(getIdealStateMode()); setRebalanceMode(property); } return property; }
/** * Instantiate from an znRecord * * @param znRecord */ public RebalanceConfig(ZNRecord znRecord) { _rebalanceDelay = znRecord.getLongField(RebalanceConfigProperty.REBALANCE_DELAY.name(), -1); _rebalanceMode = znRecord .getEnumField(RebalanceConfigProperty.REBALANCE_MODE.name(), RebalanceMode.class, RebalanceMode.NONE); _rebalancerClassName = znRecord.getSimpleField(RebalanceConfigProperty.REBALANCER_CLASS_NAME.name()); _rebalanceStrategy = znRecord.getSimpleField(RebalanceConfigProperty.REBALANCE_STRATEGY.name()); _delayRebalanceDisabled = znRecord.getBooleanField(RebalanceConfigProperty.DELAY_REBALANCE_DISABLED.name(), false); _rebalanceTimerPeriod = znRecord.getLongField(RebalanceConfigProperty.REBALANCE_TIMER_PERIOD.name(), -1); }
/** * Instantiate from an znRecord * * @param znRecord */ public RebalanceConfig(ZNRecord znRecord) { _rebalanceDelay = znRecord.getLongField(RebalanceConfigProperty.REBALANCE_DELAY.name(), -1); _rebalanceMode = znRecord .getEnumField(RebalanceConfigProperty.REBALANCE_MODE.name(), RebalanceMode.class, RebalanceMode.NONE); _rebalancerClassName = znRecord.getSimpleField(RebalanceConfigProperty.REBALANCER_CLASS_NAME.name()); _rebalanceStrategy = znRecord.getSimpleField(RebalanceConfigProperty.REBALANCE_STRATEGY.name()); _delayRebalanceDisabled = znRecord.getBooleanField(RebalanceConfigProperty.DELAY_REBALANCE_DISABLED.name(), false); _rebalanceTimerPeriod = znRecord.getLongField(RebalanceConfigProperty.REBALANCE_TIMER_PERIOD.name(), -1); }