MCPcopy Create free account
hub / github.com/OpenTSDB/asynchbase / Scanner

Class Scanner

src/Scanner.java:86–1604  ·  view source on GitHub ↗

Creates a scanner to read data sequentially from HBase. This class is not synchronized as it's expected to be used from a single thread at a time. It's rarely (if ever?) useful to scan concurrently from a shared scanner using multiple threads. If you want to optimize large tab

Source from the content-addressed store, hash-verified

84 * All strings are assumed to use the platform's default charset.
85 */
86public final class Scanner {
87
88 private static final Logger LOG = LoggerFactory.getLogger(Scanner.class);
89
90 /**
91 * The default maximum number of {@link KeyValue}s the server is allowed
92 * to return in a single RPC response to a {@link Scanner}.
93 * <p>
94 * This default value is exposed only as a hint but the value itself
95 * is not part of the API and is subject to change without notice.
96 * @see #setMaxNumKeyValues
97 */
98 public static final int DEFAULT_MAX_NUM_KVS = 4096;
99
100 /**
101 * The default maximum number of rows to scan per RPC.
102 * <p>
103 * This default value is exposed only as a hint but the value itself
104 * is not part of the API and is subject to change without notice.
105 * @see #setMaxNumRows
106 */
107 public static final int DEFAULT_MAX_NUM_ROWS = 128;
108
109 /** Special reference we use to indicate we're done scanning. */
110 private static final RegionInfo DONE =
111 new RegionInfo(EMPTY_ARRAY, EMPTY_ARRAY, EMPTY_ARRAY);
112
113 private final HBaseClient client;
114 private final byte[] table;
115
116 private boolean is_reversed = false;
117 private boolean is_first_reverse_region = true;
118
119 /**
120 * The key to start scanning from. An empty array means "start from the
121 * first key in the table". This key is updated each time we move on to
122 * another row, so that in the event of a failure, we know what was the
123 * last key previously returned. Note that this doesn't entail that the
124 * full row was returned. Depending on the failure, we may not know if
125 * the last key returned was only a subset of a row or a full row, so it
126 * may not be possible to gracefully recover from certain errors without
127 * re-scanning and re-returning the same data twice.
128 */
129 private byte[] start_key = EMPTY_ARRAY;
130
131 /**
132 * The last key to scan up to (exclusive).
133 * An empty array means "scan until the last key in the table".
134 */
135 private byte[] stop_key = EMPTY_ARRAY;
136
137 private byte[][] families;
138 private byte[][][] qualifiers;
139
140 /** Filter to apply on the scanner. */
141 private ScanFilter filter;
142
143 /** Minimum {@link KeyValue} timestamp to scan. */

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…