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

Method secondCompact

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

Source from the content-addressed store, hash-verified

765 }
766
767 @Test
768 public void secondCompact() throws Exception {
769 // In this test the row has already been compacted, and another data
770 // point was written in the mean time.
771 ArrayList<KeyValue> kvs = new ArrayList<KeyValue>(2);
772 ArrayList<Annotation> annotations = new ArrayList<Annotation>(0);
773 // This is 2 values already compacted together.
774 final byte[] qual1 = { 0x00, 0x07 };
775 final byte[] val1 = Bytes.fromLong(4L);
776 final byte[] qual2 = { 0x00, 0x27 };
777 final byte[] val2 = Bytes.fromLong(5L);
778 final byte[] qual12 = MockBase.concatByteArrays(qual1, qual2);
779 kvs.add(makekv(qual12, MockBase.concatByteArrays(val1, val2, ZERO)));
780 // This data point came late. Note that its time delta falls in between
781 // that of the two data points above.
782 final byte[] qual3 = { 0x00, 0x17 };
783 final byte[] val3 = Bytes.fromLong(6L);
784 kvs.add(makekv(qual3, val3));
785
786 final KeyValue kv = compactionq.compact(kvs, annotations, null);
787 assertArrayEquals(MockBase.concatByteArrays(qual1, qual3, qual2),
788 kv.qualifier());
789 assertArrayEquals(MockBase.concatByteArrays(val1, val3, val2, ZERO),
790 kv.value());
791
792 // We had one row to compact, so one put to do.
793 verify(tsdb, times(1)).put(KEY, MockBase.concatByteArrays(qual1, qual3, qual2),
794 MockBase.concatByteArrays(val1, val3, val2, ZERO), kvCount - 1);
795 // And we had to delete the individual cell + pre-existing compacted cell.
796 verify(tsdb, times(1)).delete(eq(KEY), eqAnyOrder(new byte[][] { qual12, qual3 }));
797 }
798
799 @Test
800 public void secondCompactWAnnotation() throws Exception {

Callers

nothing calls this directly

Calls 9

concatByteArraysMethod · 0.95
makekvMethod · 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