1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.hadoop.hbase.codec.prefixtree.row.data;
20
21 import java.util.List;
22
23 import org.apache.hadoop.hbase.KeyValue;
24 import org.apache.hadoop.hbase.codec.prefixtree.PrefixTreeBlockMeta;
25 import org.apache.hadoop.hbase.codec.prefixtree.row.BaseTestRowData;
26 import org.apache.hadoop.hbase.util.Bytes;
27 import org.junit.Assert;
28
29 import com.google.common.collect.Lists;
30
31
32
33
34 public class TestRowDataDifferentTimestamps extends BaseTestRowData{
35
36 static byte[]
37 Arow = Bytes.toBytes("Arow"),
38 Brow = Bytes.toBytes("Brow"),
39 cf = Bytes.toBytes("fammy"),
40 cq0 = Bytes.toBytes("cq0"),
41 cq1 = Bytes.toBytes("cq1"),
42 v0 = Bytes.toBytes("v0");
43
44 static List<KeyValue> d = Lists.newArrayList();
45 static{
46 KeyValue kv0 = new KeyValue(Arow, cf, cq0, 0L, v0);
47 kv0.setSequenceId(123456789L);
48 d.add(kv0);
49
50 KeyValue kv1 = new KeyValue(Arow, cf, cq1, 1L, v0);
51 kv1.setSequenceId(3L);
52 d.add(kv1);
53
54 KeyValue kv2 = new KeyValue(Brow, cf, cq0, 12345678L, v0);
55 kv2.setSequenceId(65537L);
56 d.add(kv2);
57
58
59
60 KeyValue kv3 = new KeyValue(Brow, cf, cq1, Long.MAX_VALUE-1, v0);
61 kv3.setSequenceId(1L);
62 d.add(kv3);
63
64 KeyValue kv4 = new KeyValue(Brow, cf, cq1, 999999999, v0);
65
66 d.add(kv4);
67
68 KeyValue kv5 = new KeyValue(Brow, cf, cq1, 12345, v0);
69 kv5.setSequenceId(0L);
70 d.add(kv5);
71 }
72
73 @Override
74 public List<KeyValue> getInputs() {
75 return d;
76 }
77
78 @Override
79 public void individualBlockMetaAssertions(PrefixTreeBlockMeta blockMeta) {
80 Assert.assertTrue(blockMeta.getNumMvccVersionBytes() > 0);
81 Assert.assertEquals(12, blockMeta.getNumValueBytes());
82
83 Assert.assertFalse(blockMeta.isAllSameTimestamp());
84 Assert.assertNotNull(blockMeta.getMinTimestamp());
85 Assert.assertTrue(blockMeta.getTimestampIndexWidth() > 0);
86 Assert.assertTrue(blockMeta.getTimestampDeltaWidth() > 0);
87
88 Assert.assertFalse(blockMeta.isAllSameMvccVersion());
89 Assert.assertNotNull(blockMeta.getMinMvccVersion());
90 Assert.assertTrue(blockMeta.getMvccVersionIndexWidth() > 0);
91 Assert.assertTrue(blockMeta.getMvccVersionDeltaWidth() > 0);
92 }
93
94 }