MCPcopy Create free account
hub / github.com/OpenTSDB/opentsdb / fixQualifierFlags

Method fixQualifierFlags

test/core/TestCompactionQueue.java:615–638  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

613 }
614
615 @Test
616 public void fixQualifierFlags() throws Exception {
617 ArrayList<KeyValue> kvs = new ArrayList<KeyValue>(2);
618 ArrayList<Annotation> annotations = new ArrayList<Annotation>(0);
619 // Note: here the flags pretend the value is on 4 bytes, but it's actually
620 // on 8 bytes, so we expect the code to fix the flags as it's compacting.
621 final byte[] qual1 = { 0x00, 0x03 }; // Pretends 4 bytes...
622 final byte[] val1 = Bytes.fromLong(4L); // ... 8 bytes actually.
623 final byte[] cqual1 = { 0x00, 0x07 }; // Should have been this.
624 kvs.add(makekv(qual1, val1));
625 final byte[] qual2 = { 0x00, 0x17 };
626 final byte[] val2 = Bytes.fromLong(5L);
627 kvs.add(makekv(qual2, val2));
628
629 final KeyValue kv = compactionq.compact(kvs, annotations, null);
630 assertArrayEquals(MockBase.concatByteArrays(cqual1, qual2), kv.qualifier());
631 assertArrayEquals(MockBase.concatByteArrays(val1, val2, ZERO), kv.value());
632
633 // We had one row to compact, so one put to do.
634 verify(tsdb, times(1)).put(KEY, MockBase.concatByteArrays(cqual1, qual2),
635 MockBase.concatByteArrays(val1, val2, ZERO), kvCount - 1);
636 // And we had to delete individual cells.
637 verify(tsdb, times(1)).delete(eq(KEY), eqAnyOrder(new byte[][] { qual1, qual2 }));
638 }
639
640 @Test
641 public void fixFloatingPoint() throws Exception {

Callers

nothing calls this directly

Calls 9

makekvMethod · 0.95
concatByteArraysMethod · 0.95
eqAnyOrderMethod · 0.95
putMethod · 0.80
addMethod · 0.45
compactMethod · 0.45
qualifierMethod · 0.45
valueMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected