use of io.datarouter.storage.node.op.raw.read.SortedStorageReader.PhysicalSortedStorageReaderNode in project datarouter by hotpads.
the class TableCountHandler method resample.
@Handler
private Mav resample(String clientName, String tableName) {
var node = (PhysicalSortedStorageReaderNode<?, ?, ?>) nodes.getPhysicalNodeForClientAndTable(clientName, tableName);
tableSpanSamplerJobletCreatorFactory.create(node, tableSamplerService.getSampleInterval(node), tableSamplerService.getBatchSize(node), true, true, System.currentTimeMillis()).createJoblets();
var dto = new DatarouterChangelogDtoBuilder("Nodewatch", clientName + "." + tableName, "resample", getSessionInfo().getNonEmptyUsernameOrElse("")).build();
changelogRecorder.record(dto);
return new InContextRedirectMav(request, paths.datarouter.nodewatch.tableCount.toSlashedString() + "?submitAction=singleTable&clientName=" + clientName + "&tableName=" + tableName);
}
use of io.datarouter.storage.node.op.raw.read.SortedStorageReader.PhysicalSortedStorageReaderNode in project datarouter by hotpads.
the class TableSpanSamplerJoblet method process.
@Override
public void process() {
TableSample dbSample = tableSampleDao.get(params.endSample.getKey());
if (dbSample == null) {
logger.warn("aborting because dbSample missing {}", params.endSample);
return;
}
if (ObjectTool.notEquals(params.samplerId, dbSample.getSamplerId())) {
logger.warn("aborting because wrong samplerId={}, {}", params.samplerId, params.endSample);
return;
}
// TODO make expiration a generic joblet feature
Duration age = jobletRequest.getKey().getAge();
if (ComparableTool.gt(age, TableSample.MAX_TIME_IN_QUEUE)) {
logger.warn("aborting expired joblet {} with age {}", jobletRequest, age);
datarouterJobletCounters.incNumJobletsExpired(1);
datarouterJobletCounters.incNumJobletsExpired(JOBLET_TYPE, 1);
return;
// the joblet creator will quickly create another one based on the stale dateScheduled
}
PhysicalNode<?, ?, ?> physicalNode = datarouterNodes.getPhysicalNodeForClientAndTable(params.nodeNames.getClientName(), params.nodeNames.getTableName());
SortedStorageReaderNode<?, ?, ?> node = (PhysicalSortedStorageReaderNode<?, ?, ?>) physicalNode;
Objects.requireNonNull(node, "node not found for " + params.nodeNames);
// TODO replace strings with more formal client detection
boolean clientSupportsOffsetting = physicalNode.getClientType().supportsOffsetSampling();
Instant deadline = Instant.now().plus(MAX_RUNNING_TIME);
samples = new TableSpanSampler<>(node, tableSampleDao, params.samplerId, params.nodeNames, params.startSampleKey, params.endSample, params.sampleEveryN, clientSupportsOffsetting && nodewatchSettingRoot.enableOffsetting.get(), params.batchSize, Instant.ofEpochMilli(params.createdTimeMs), params.scanUntilEnd, deadline).call();
}
Aggregations