private void setGCDeletes(TimeValue timeValue) { this.gcDeletesInMillis = timeValue.getMillis(); }
@Override public Result evaluate(final Stats stats) { long indexAge = System.currentTimeMillis() - stats.indexCreated; return new Result(this, this.value.getMillis() <= indexAge); }
@Override public void writeTo(StreamOutput out) throws IOException { //TODO here we should just use TimeValue#writeTo and same for de-serialization in the constructor, we lose information this way out.writeLong(value.getMillis()); }
@Override public void onResponse(BulkResponse response) { BulkItemResponse[] items = response.getItems(); for (int i = 0; i < items.length; i++) { itemResponses.add(originalSlots[i], response.getItems()[i]); } actionListener.onResponse(new BulkResponse( itemResponses.toArray(new BulkItemResponse[itemResponses.size()]), response.getTook().getMillis(), ingestTookInMillis)); }
if (nodeLatch.await(fetchTimeout.getMillis(), TimeUnit.MILLISECONDS) == false) { logger.warn("Failed to update node information for ClusterInfoUpdateJob within {} timeout", fetchTimeout); if (indicesLatch.await(fetchTimeout.getMillis(), TimeUnit.MILLISECONDS) == false) { logger.warn("Failed to update shard information for ClusterInfoUpdateJob within {} timeout", fetchTimeout);
@Override protected PipelineAggregator createInternal(Map<String, Object> metaData) throws IOException { DocValueFormat formatter; if (format != null) { formatter = new DocValueFormat.Decimal(format); } else { formatter = DocValueFormat.RAW; } Long xAxisUnits = null; if (units != null) { DateTimeUnit dateTimeUnit = DateHistogramAggregationBuilder.DATE_FIELD_UNITS.get(units); if (dateTimeUnit != null) { xAxisUnits = dateTimeUnit.field(DateTimeZone.UTC).getDurationField().getUnitMillis(); } else { TimeValue timeValue = TimeValue.parseTimeValue(units, null, getClass().getSimpleName() + ".unit"); if (timeValue != null) { xAxisUnits = timeValue.getMillis(); } } } return new DerivativePipelineAggregator(name, bucketsPaths, formatter, gapPolicy, xAxisUnits, metaData); }
ActionListener<BulkResponse> wrapActionListenerIfNeeded(long ingestTookInMillis, ActionListener<BulkResponse> actionListener) { if (itemResponses.isEmpty()) { return ActionListener.wrap( response -> actionListener.onResponse(new BulkResponse(response.getItems(), response.getTook().getMillis(), ingestTookInMillis)), actionListener::onFailure); } else { return new IngestBulkResponseListener(ingestTookInMillis, originalSlots, itemResponses, actionListener); } }
double scale = val.getMillis(); val = TimeValue.parseTimeValue(offsetString, TimeValue.timeValueHours(24), DecayFunctionParser.class.getSimpleName() + ".offset"); double offset = val.getMillis(); IndexNumericFieldData numericFieldData = context.getForField(dateFieldType); return new NumericFieldDataScoreFunction(origin, scale, decay, offset, getDecayFunction(), numericFieldData, mode);
public void onSettingsChanged() { mergeScheduler.refreshConfig(); // config().isEnableGcDeletes() or config.getGcDeletesInMillis() may have changed: maybePruneDeletes(); if (engineConfig.isAutoGeneratedIDsOptimizationEnabled() == false) { // this is an anti-viral settings you can only opt out for the entire index // only if a shard starts up again due to relocation or if the index is closed // the setting will be re-interpreted if it's set to true updateAutoIdTimestamp(Long.MAX_VALUE, true); } final TranslogDeletionPolicy translogDeletionPolicy = translog.getDeletionPolicy(); final IndexSettings indexSettings = engineConfig.getIndexSettings(); translogDeletionPolicy.setRetentionAgeInMillis(indexSettings.getTranslogRetentionAge().getMillis()); translogDeletionPolicy.setRetentionSizeInBytes(indexSettings.getTranslogRetentionSize().getBytes()); softDeletesPolicy.setRetentionOperations(indexSettings.getSoftDeleteRetentionOperations()); }
private boolean isTranslogClean(ShardPath shardPath, String translogUUID) throws IOException { // perform clean check of translog instead of corrupted marker file boolean clean = true; try { final Path translogPath = shardPath.resolveTranslog(); final long translogGlobalCheckpoint = Translog.readGlobalCheckpoint(translogPath, translogUUID); final IndexMetaData indexMetaData = IndexMetaData.FORMAT.loadLatestState(logger, namedXContentRegistry, shardPath.getDataPath().getParent()); final IndexSettings indexSettings = new IndexSettings(indexMetaData, Settings.EMPTY); final TranslogConfig translogConfig = new TranslogConfig(shardPath.getShardId(), translogPath, indexSettings, BigArrays.NON_RECYCLING_INSTANCE); long primaryTerm = indexSettings.getIndexMetaData().primaryTerm(shardPath.getShardId().id()); final TranslogDeletionPolicy translogDeletionPolicy = new TranslogDeletionPolicy(indexSettings.getTranslogRetentionSize().getBytes(), indexSettings.getTranslogRetentionAge().getMillis()); try (Translog translog = new Translog(translogConfig, translogUUID, translogDeletionPolicy, () -> translogGlobalCheckpoint, () -> primaryTerm); Translog.Snapshot snapshot = translog.newSnapshot()) { while (snapshot.next() != null) { // just iterate over snapshot } } } catch (TranslogCorruptedException e) { clean = false; } return clean; }
@Override public Result evaluate(final Stats stats) { long indexAge = System.currentTimeMillis() - stats.indexCreated; return new Result(this, this.value.getMillis() <= indexAge); }
MetaData metadata = allocation.metaData(); IndexMetaData indexMetaData = metadata.index(unassignedShard.index()); totalDelayMillis = INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING.get(indexMetaData.getSettings()).getMillis(); long remainingDelayNanos = unassignedInfo.getRemainingDelay(System.nanoTime(), indexMetaData.getSettings()); remainingDelayMillis = TimeValue.timeValueNanos(remainingDelayNanos).millis();
final TranslogDeletionPolicy translogDeletionPolicy = new TranslogDeletionPolicy( engineConfig.getIndexSettings().getTranslogRetentionSize().getBytes(), engineConfig.getIndexSettings().getTranslogRetentionAge().getMillis() ); store.incRef();
public ReloadableKeywordMarkerFilterFactory(final IndexSettings indexSettings, final Environment environment, final String name, final Settings settings) { super(indexSettings, name, settings); final String path = settings.get("keywords_path"); if (path != null) { keywordPath = environment.configFile().resolve(path); } else { keywordPath = null; } reloadInterval = settings.getAsTime("reload_interval", TimeValue.timeValueMinutes(1)).getMillis(); }
ActionListener<BulkResponse> wrapActionListenerIfNeeded(long ingestTookInMillis, ActionListener<BulkResponse> actionListener) { if (itemResponses.isEmpty()) { return ActionListener.wrap( response -> actionListener.onResponse(new BulkResponse(response.getItems(), response.getTook().getMillis(), ingestTookInMillis)), actionListener::onFailure); } else { return new IngestBulkResponseListener(ingestTookInMillis, originalSlots, itemResponses, actionListener); } }
generationThresholdSize = scopedSettings.get(INDEX_TRANSLOG_GENERATION_THRESHOLD_SIZE_SETTING); mergeSchedulerConfig = new MergeSchedulerConfig(this); gcDeletesInMillis = scopedSettings.get(INDEX_GC_DELETES_SETTING).getMillis(); softDeleteEnabled = version.onOrAfter(Version.V_6_5_0) && scopedSettings.get(INDEX_SOFT_DELETES_SETTING); softDeleteRetentionOperations = scopedSettings.get(INDEX_SOFT_DELETES_RETENTION_OPERATIONS_SETTING);