本文整理了Java中com.addthis.hydra.data.query.Query.uuid
方法的一些代码示例,展示了Query.uuid
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.uuid
方法的具体详情如下:
包路径:com.addthis.hydra.data.query.Query
类名称:Query
方法名:uuid
暂无
代码示例来源:origin: addthis/hydra
static void sendTimeout(QueryEntry entry, long timeout) {
String message = "[timeout.watcher] timeout: " + timeout +
" has been exceeded, canceling query: " + entry.query.uuid();
if (!entry.tryFailure(new TimeoutException(message))) {
log.warn("QUERY TIMEOUT FAILURE: query: {}", entry.query.uuid());
}
}
}
代码示例来源:origin: addthis/hydra
@Override
public void cancel(String message) {
log.warn(query.uuid() + " cancel called on handle " + consumer + " message: " + message);
if (engine != null) {
interrupt();
}
}
}
代码示例来源:origin: addthis/hydra
@Override
public void run() {
try {
long currentTime = System.currentTimeMillis();
for (QueryEntry queryEntry : running.values()) {
if (queryEntry.waitTime <= 0) {
continue;
}
long queryDuration = currentTime - queryEntry.startTime;
// wait time is in seconds
double queryDurationInSeconds = queryDuration / 1000.0;
if (queryDurationInSeconds < queryEntry.waitTime) {
log.info("query: {} running for: {} timeout is: {}",
queryEntry.query.uuid(), queryDurationInSeconds, queryEntry.waitTime);
} else {
log.warn("QUERY TIMEOUT query: {} running for: {} timeout is: {}",
queryEntry.query.uuid(), queryDurationInSeconds, queryEntry.waitTime);
// sanity check duration
if (queryDurationInSeconds > (2 * queryEntry.waitTime)) {
log.warn("query: {} query duration was insane, resetting to waitTime for logging. startTime: {}",
queryEntry.query.uuid(), queryEntry.startTime);
}
sendTimeout(queryEntry, queryEntry.waitTime);
}
}
} catch (Throwable ex) {
log.error("error while running timeout watcher; swallowing to keep thread alive", ex);
}
}
代码示例来源:origin: addthis/hydra
Handle(Query query, DataChannelOutput consumer) {
setName("EngineSource " + query.uuid());
this.query = query;
this.consumer = consumer;
start();
}
代码示例来源:origin: addthis/hydra
void checkForStragglersMeans() {
int totalTasks = sourceAggregator.totalTasks;
int numRemaining = totalTasks - sourceAggregator.completed;
int tasksDoneCutoff = Math.max(1, (int) Math.ceil(AggregateConfig.stragglerCheckHostPercentage * totalTasks));
long elapsedTime = JitterClock.globalTime() - sourceAggregator.startTime;
double timeCutoff = AggregateConfig.stragglerCheckMeanRuntimeFactor * getMeanRuntime();
if (numRemaining == 0) {
if (MeshSourceAggregator.log.isDebugEnabled() || sourceAggregator.query.isTraced()) {
Query.traceLog.info("Straggler checker for {} detected query done. Exiting.",
sourceAggregator.query.uuid());
}
} else if ((numRemaining <= tasksDoneCutoff) && (elapsedTime > timeCutoff)) {
handleStragglers();
}
}
代码示例来源:origin: addthis/hydra
/**
* Part 2 - ENGINE CACHE
* Get a QueryEngine for our query -- check the cache for a suitable candidate, otherwise make one.
* Most of this logic is handled by the QueryEngineCache.get() function.
*/
protected QueryEngine getEngine() throws Exception {
final long engineGetStartTime = System.currentTimeMillis();
// Use the canonical path stored in the canonicalDirString to create a QueryEngine. By that way
// if the alias changes new queries will use the latest available
// database and the old engines will be automatically closed after their TTL expires.
QueryEngine engine = MeshQuerySource.queryEngineCache.getAndLease(goldDirString);
final long engineGetDuration = System.currentTimeMillis() - engineGetStartTime;
MeshQuerySource.engineGetTimer.update(engineGetDuration, TimeUnit.MILLISECONDS);
if (engine == null) //Cache returned null -- this doesn't mean cache miss. It means something went fairly wrong
{
log.warn("[QueryReference] Unable to retrieve queryEngine for query: {}, key: {} after waiting: {}ms",
query.uuid(), goldDirString, engineGetDuration);
throw new DataChannelError("Unable to retrieve queryEngine for query: " + query.uuid() +
", key: " + goldDirString + " after waiting: " + engineGetDuration + "ms");
} //else we got an engine so we're good -- maybe this logic should be in the cache get
if ((engineGetDuration > MeshQuerySource.slowQueryThreshold) || log.isDebugEnabled() || query.isTraced()) {
Query.traceLog.info(
"[QueryReference] Retrieved queryEngine for query: {}, key:{} after waiting: {}ms. slow={}",
query.uuid(), goldDirString, engineGetDuration,
engineGetDuration > MeshQuerySource.slowQueryThreshold);
}
return engine;
}
代码示例来源:origin: addthis/hydra
protected void writeQuery(final ChannelHandlerContext ctx, Query msg, ChannelPromise promise)
throws Exception {
this.requestPromise = promise;
this.queryUser = new DataChannelOutputToNettyBridge(ctx, promise);
this.query = msg;
query.queryPromise = queryPromise;
// create a processor chain based in query ops terminating the query user
this.opProcessorConsumer = query.newProcessor(queryUser, opPromise);
queryEntry = new QueryEntry(query, opsLog, this, aggregator);
// Check if the uuid is repeated, then make a new one
if (queryTracker.running.putIfAbsent(query.uuid(), queryEntry) != null) {
throw new QueryException("Query uuid somehow already in use : " + query.uuid());
}
log.debug("Executing.... {} {}", query.uuid(), queryEntry);
ctx.pipeline().remove(this);
opPromise.addListener(this);
queryPromise.addListener(this);
requestPromise.addListener(this);
ctx.write(opProcessorConsumer, queryPromise);
}
代码示例来源:origin: addthis/hydra
void checkForStragglersStdDev() {
Query query = sourceAggregator.query;
int totalTasks = sourceAggregator.totalTasks;
int numRemaining = totalTasks - sourceAggregator.completed;
int tasksDoneCutoff = Math.max(1, (int) Math.ceil(AggregateConfig.stragglerCheckHostPercentage * totalTasks));
long elapsedTime = JitterClock.globalTime() - sourceAggregator.startTime;
if (numRemaining == 0) {
if (MeshSourceAggregator.log.isDebugEnabled() || query.isTraced()) {
Query.traceLog.info("Straggler checker for {} detected query done. Exiting.", query.uuid());
}
} else if ((numRemaining <= tasksDoneCutoff) &&
(elapsedTime > getStdDevsAwayRuntime(AggregateConfig.MULTIPLE_STD_DEVS))) {
if (MeshSourceAggregator.log.isTraceEnabled()) {
MeshSourceAggregator.log.trace("Running stragglers for query: {}", query.uuid());
MeshSourceAggregator.log.trace(
"numRemaining: {} taskDoneCutoff: {} deltaTime: {} {} stdDevsAway: {} Mean runtime: {}",
numRemaining, tasksDoneCutoff, elapsedTime, AggregateConfig.MULTIPLE_STD_DEVS,
getStdDevsAwayRuntime(AggregateConfig.MULTIPLE_STD_DEVS), getMeanRuntime());
}
handleStragglers();
}
}
代码示例来源:origin: addthis/hydra
/**
* Part 3 - SEARCH
* Run the search -- most of this logic is in QueryEngine.search(). We only take care of logging times and
* passing the sendComplete message along.
*/
protected void search() {
final long searchStartTime = System.currentTimeMillis();
finalEng.search(query, queryOpProcessor, bridge.getQueryPromise());
queryOpProcessor.sendComplete();
final long searchDuration = System.currentTimeMillis() - searchStartTime;
if (log.isDebugEnabled() || query.isTraced()) {
Query.traceLog.info("[QueryReference] search complete {} in {}ms directory: {} slow={} rowsIn: {}",
query.uuid(), searchDuration, goldDirString,
searchDuration > MeshQuerySource.slowQueryThreshold, queryOpProcessor.getInputRows());
}
MeshQuerySource.queryTimes.update(searchDuration, TimeUnit.MILLISECONDS);
}
}
代码示例来源:origin: addthis/hydra
@Override public void run() {
engine = null;
try {
engineGate.acquire(1);
engineGateHistogram.update(engineGate.availablePermits());
engine = getEngineLease();
engine.search(query, consumer,
new DefaultChannelProgressivePromise(null, ImmediateEventExecutor.INSTANCE));
consumer.sendComplete();
} catch (QueryException e) {
log.warn("query exception " + query.uuid() + " " + e + " " + consumer);
consumer.sourceError(e);
} catch (Exception e) {
log.warn("query error " + query.uuid() + " " + e + " " + consumer, e);
consumer.sourceError(new QueryException(e));
} finally {
engineGate.release();
engineGateHistogram.update(engineGate.availablePermits());
if (engine != null) {
try {
engine.release();
} catch (Throwable t) {
log.warn("[dispatch] error during db release of " + engine + " : " + t, t);
}
}
}
}
代码示例来源:origin: addthis/hydra
public void handleStragglers() {
for (QueryTaskSource taskSource : sourceAggregator.taskSources) {
if (taskSource.oneHasResponded() || (taskSource.options.length == 0)) {
continue;
}
for (QueryTaskSourceOption option : taskSource.options) {
if (!option.isActive()) {
if (option.tryActivate(sourceAggregator.meshy, sourceAggregator.queryOptions)) {
AggregateConfig.totalStragglerCheckerRequests.inc();
if (MeshSourceAggregator.log.isDebugEnabled() || sourceAggregator.query.isTraced()) {
Query.traceLog.info("Straggler detected for {} sending duplicate query to host: {}",
sourceAggregator.query.uuid(), option.queryReference.getHostUUID());
}
break;
}
}
}
}
}
}
代码示例来源:origin: addthis/hydra
.put("time", System.currentTimeMillis())
.put("job.id", query.getJob())
.put("query.id", query.uuid())
.put("sender", query.getParameter("sender"))
.put("format", format)
代码示例来源:origin: addthis/hydra
QueryEntry runE = queryTracker.running.remove(query.uuid());
if (runE == null) {
log.warn("failed to remove running for {}", query.uuid());
if (taskSourceInfos == null) {
log.warn("Failed to get detailed status for completed query {}; defaulting to brief",
query.uuid());
} else {
int exactLines = 0;
event.setValue(typeField, ValueFactory.create("complete"));
queryTracker.recentlyCompleted.put(query.uuid(), entryInfo);
queryTracker.queryMeter.update(entryInfo.runTime, TimeUnit.MILLISECONDS);
queryTracker.eventLog.send(event);
内容来源于网络,如有侵权,请联系作者删除!