1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.hadoop.hbase.regionserver;
20
21 import org.apache.hadoop.hbase.classification.InterfaceAudience;
22 import org.apache.hadoop.hbase.HColumnDescriptor;
23 import org.apache.hadoop.hbase.KeepDeletedCells;
24 import org.apache.hadoop.hbase.KeyValue.KVComparator;
25 import org.apache.hadoop.hbase.util.Bytes;
26 import org.apache.hadoop.hbase.util.ClassSize;
27 import org.apache.hadoop.conf.Configuration;
28 import org.apache.hadoop.hbase.HConstants;
29 import com.google.common.annotations.VisibleForTesting;
30
31
32
33
34
35
36 @VisibleForTesting
37 @InterfaceAudience.Private
38 public class ScanInfo {
39 private byte[] family;
40 private int minVersions;
41 private int maxVersions;
42 private long ttl;
43 private KeepDeletedCells keepDeletedCells;
44 private long timeToPurgeDeletes;
45 private KVComparator comparator;
46 private long tableMaxRowSize;
47 private boolean usePread;
48 private long cellsPerTimeoutCheck;
49 private boolean parallelSeekEnabled;
50 private final Configuration conf;
51
52 public static final long FIXED_OVERHEAD = ClassSize.align(ClassSize.OBJECT
53 + (2 * ClassSize.REFERENCE) + (2 * Bytes.SIZEOF_INT)
54 + (4 * Bytes.SIZEOF_LONG) + (3 * Bytes.SIZEOF_BOOLEAN));
55
56
57
58
59
60
61
62
63
64 public ScanInfo(final Configuration conf, final HColumnDescriptor family, final long ttl,
65 final long timeToPurgeDeletes, final KVComparator comparator) {
66 this(conf, family.getName(), family.getMinVersions(), family.getMaxVersions(), ttl, family
67 .getKeepDeletedCells(), timeToPurgeDeletes, comparator);
68 }
69
70
71
72
73
74
75
76
77
78
79
80
81 public ScanInfo(final Configuration conf, final byte[] family, final int minVersions,
82 final int maxVersions, final long ttl, final KeepDeletedCells keepDeletedCells,
83 final long timeToPurgeDeletes, final KVComparator comparator) {
84 this.family = family;
85 this.minVersions = minVersions;
86 this.maxVersions = maxVersions;
87 this.ttl = ttl;
88 this.keepDeletedCells = keepDeletedCells;
89 this.timeToPurgeDeletes = timeToPurgeDeletes;
90 this.comparator = comparator;
91 this.tableMaxRowSize =
92 conf.getLong(HConstants.TABLE_MAX_ROWSIZE_KEY, HConstants.TABLE_MAX_ROWSIZE_DEFAULT);
93 this.usePread = conf.getBoolean("hbase.storescanner.use.pread", false);
94 long perHeartbeat =
95 conf.getLong(StoreScanner.HBASE_CELLS_SCANNED_PER_HEARTBEAT_CHECK,
96 StoreScanner.DEFAULT_HBASE_CELLS_SCANNED_PER_HEARTBEAT_CHECK);
97 this.cellsPerTimeoutCheck = perHeartbeat > 0?
98 perHeartbeat: StoreScanner.DEFAULT_HBASE_CELLS_SCANNED_PER_HEARTBEAT_CHECK;
99 this.parallelSeekEnabled =
100 conf.getBoolean(StoreScanner.STORESCANNER_PARALLEL_SEEK_ENABLE, false);
101 this.conf = conf;
102 }
103
104 public Configuration getConfiguration() {
105 return this.conf;
106 }
107
108 long getTableMaxRowSize() {
109 return this.tableMaxRowSize;
110 }
111
112 boolean isUsePread() {
113 return this.usePread;
114 }
115
116 long getCellsPerTimeoutCheck() {
117 return this.cellsPerTimeoutCheck;
118 }
119
120 boolean isParallelSeekEnabled() {
121 return this.parallelSeekEnabled;
122 }
123
124 byte[] getFamily() {
125 return family;
126 }
127
128 int getMinVersions() {
129 return minVersions;
130 }
131
132 public int getMaxVersions() {
133 return maxVersions;
134 }
135
136 public long getTtl() {
137 return ttl;
138 }
139
140 KeepDeletedCells getKeepDeletedCells() {
141 return keepDeletedCells;
142 }
143
144 public long getTimeToPurgeDeletes() {
145 return timeToPurgeDeletes;
146 }
147
148 public KVComparator getComparator() {
149 return comparator;
150 }
151 }