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