MCPcopy Index your code
hub / github.com/OpenTSDB/opentsdb / processNotRollupQuery

Method processNotRollupQuery

src/core/MultiGetQuery.java:428–487  ·  view source on GitHub ↗
(final byte[] key, 
        final ArrayList<KeyValue> row, 
        List<Annotation> notes,
        List<HistogramDataPoint> hists)

Source from the content-addressed store, hash-verified

426 }
427
428 private void processNotRollupQuery(final byte[] key,
429 final ArrayList<KeyValue> row,
430 List<Annotation> notes,
431 List<HistogramDataPoint> hists) {
432 KeyValue compacted = null;
433 try {
434 final long compaction_start = DateTime.nanoTime();
435 compacted = tsdb.compact(row, notes, hists);
436
437 // histogram row
438 if (hists.size() > 0) {
439 histograms.add(new SimpleEntry<byte[], List<HistogramDataPoint>>(key, hists));
440 mul_get_dps_post_filter += hists.size();
441 }
442
443 mul_get_compaction_time += (DateTime.nanoTime() - compaction_start);
444 if (compacted != null) {
445 final byte[] compact_value = compacted.value();
446 final byte[] compact_qualifier = compacted.qualifier();
447 mul_get_number_byte_fetched = mul_get_number_byte_fetched +
448 compacted.value().length + compacted.key().length;
449 number_byte_fetched.addAndGet(compacted.value().length + compacted.key().length);
450 if (number_byte_fetched.get() > max_bytes) {
451 handleException(
452 new QueryException(HttpResponseStatus.REQUEST_ENTITY_TOO_LARGE,
453 "Sorry, you have attempted to fetch more than our maximum "
454 + "amount of " + (max_bytes / 1024 / 1024) + "MB from storage. "
455 + "Please try reducing your time range or adjust the query filters."));
456 close(false);
457 return;
458 }
459 if (compact_qualifier.length % 2 == 0) {
460 // The length of the qualifier is even so this is a put type
461 // so the size of the data is the length of the qualifier by 2
462 if (compact_value[compact_value.length - 1] == 0) {
463 // LOG.debug("All data points we have here are either in seconds
464 // or Ms");
465 if (Internal.inMilliseconds(compact_qualifier[0])) {
466 mul_get_dps_post_filter += compact_qualifier.length / 4;
467 } else {
468 mul_get_dps_post_filter += compact_qualifier.length / 2;
469 }
470 } else {
471 // LOG.debug("Data Points we have here are stored in second and Ms
472 // precision");
473 // We wil make a estimate here as iterating over each qualifer
474 // could be expensive.
475 // We will just divide the qualifier by 3 to estimate the value
476 mul_get_dps_post_filter += compact_qualifier.length / 3;
477 }
478 }
479 }
480 } catch (IllegalDataException idex) {
481 LOG.error("Caught IllegalDataException exception while parsing the " + "row " + key + ", skipping index", idex);
482 }
483
484 if (compacted != null) { // Can be null if we ignored all KVs.
485 keyValues.add(compacted);

Callers 1

processMethod · 0.95

Calls 12

nanoTimeMethod · 0.95
closeMethod · 0.95
inMillisecondsMethod · 0.95
errorMethod · 0.80
sizeMethod · 0.65
keyMethod · 0.65
compactMethod · 0.45
addMethod · 0.45
valueMethod · 0.45
qualifierMethod · 0.45
getMethod · 0.45
handleExceptionMethod · 0.45

Tested by

no test coverage detected