49 template <
typename IndexT>
52 m_cellstore(cellstore), m_index(index), m_start_key(start_key),
53 m_end_key(end_key), m_scan_ctx(scan_ctx), m_rowset(scan_ctx->rowset) {
105 template <
typename IndexT>
107 if (m_block.base != 0) {
111 delete [] m_block.base;
114 delete m_key_decompressor;
117 template <
typename IndexT>
120 if (m_iter == m_index->end())
131 template <
typename IndexT>
137 if (m_iter == m_index->end())
140 ptr = m_cur_value.ptr + m_cur_value.length();
142 if (ptr >= m_block.end) {
143 if (!fetch_next_block(
true)) {
144 m_iter = m_index->end();
147 if (m_check_for_range_end && !m_key_decompressor->less_than(m_end_key)) {
148 m_iter = m_index->end();
153 m_cur_value.ptr = m_key_decompressor->add(ptr);
154 if (m_check_for_range_end && !m_key_decompressor->less_than(m_end_key)) {
155 m_iter = m_index->end();
163 m_key_decompressor->load(m_key);
165 || m_scan_ctx->family_mask[m_key.column_family_code])
167 if (m_rowset.empty() || strcmp(m_key.row, *m_rowset.begin()) >= 0)
186 template <
typename IndexT>
190 if (m_block.base != 0 && eob) {
194 delete [] m_block.base;
195 memset(&m_block, 0,
sizeof(m_block));
199 if (m_rowset.size()) {
200 while (m_iter != m_index->end() && strcmp(*m_rowset.begin(), m_iter.key().row()) > 0)
205 if (m_block.base == 0 && m_iter != m_index->end()) {
209 m_block.offset = m_iter.value();
213 if (it_next == m_index->end()) {
214 m_block.zlength = m_index->end_of_last_block() - m_block.offset;
215 if (m_end_row[0] != (
char)0xff)
216 m_check_for_range_end =
true;
219 if (strcmp(it_next.key().row(), m_end_row) >= 0)
220 m_check_for_range_end =
true;
221 m_block.zlength = it_next.value() - m_block.offset;
229 (uint8_t **)&m_block.base, &len)) {
240 (uint8_t **)&buf.
base, &len)) {
244 Global::dfs->pread(m_fd, m_block.zlength, m_block.offset, second_try, &sync_handler);
252 Global::dfs->decode_response_read(event, &data, &off, &length);
253 buf.
base = (uint8_t *)data;
261 buf.
size = m_block.zlength;
266 buf.
ptr = buf.
base + m_block.zlength;
271 m_zcodec->inflate(buf, expand_buf, header);
274 m_disk_read += expand_buf.
fill();
278 "Error inflating cell store block - magic string mismatch");
286 (uint8_t *)buf.
base, m_block.zlength,
291 HT_WARN_OUT <<
"Error reading cell store (fd=" << m_fd <<
" file="
292 << m_cellstore->get_filename() <<
") : "
295 << m_block.zlength <<
", offset=" << m_block.offset
300 HT_INFO(
"Retrying with dfs checksum enabled");
307 m_block.base = expand_buf.
release(&fill);
313 (uint8_t *)m_block.base, len,
EventPtr(),
true);
318 m_key_decompressor->reset();
319 m_block.end = m_block.base + len;
320 m_cur_value.ptr = m_key_decompressor->add(m_block.base);
Retrieves system information (hardware, installation directory, etc)
SerializedKey m_start_key
static int32_t response_code(const Event *event)
Returns the response code from an event event generated in response to a request message.
static const uint32_t FLAG_DELETE_ROW
static String string_format_message(const Event *event)
Returns error message decoded standard error MESSAGE generated in response to a request message...
Declarations for CellStoreScannerIntervalBlockIndex.
std::shared_ptr< Event > EventPtr
Smart pointer to Event.
Scan context information.
virtual void load(Key &key)=0
uint8_t * ptr
Pointer to the end of the used part of the buffer.
bool wait_for_reply(EventPtr &event)
This method is used by a client to synchronize.
A dynamic, resizable and reference counted memory buffer.
A class managing one or more serializable ByteStrings.
uint32_t size
The size of the allocated memory buffer (base)
void checkin(int file_id, uint64_t file_offset)
Compatibility Macros for C/C++.
virtual bool less_than(SerializedKey serialized_key)=0
static Hypertable::FilesystemPtr dfs
size_t length() const
Retrieves the length of the serialized string.
virtual ~CellStoreScannerIntervalBlockIndex()
virtual const uint8_t * add(const uint8_t *ptr)=0
bool own
If true then the buffer (base) will be released when going out of scope; if false then the caller has...
const uint8_t * ptr
The pointer to the serialized data.
bool insert(int file_id, uint64_t file_offset, uint8_t *block, uint32_t length, const EventPtr &event, bool checkout)
std::shared_ptr< CellStore > CellStorePtr
Smart pointer to CellStore.
Provides the ability to scan over a portion of a cell store using its block index.
DispatchHandler class used to synchronize with response messages.
KeyDecompressor * m_key_decompressor
Declarations for Protocol.
Provides access to internal components of opaque key.
uint8_t * base
Pointer to the allocated memory buffer.
size_t fill() const
Returns the size of the used portion.
static const char DATA_BLOCK_MAGIC[10]
This is a generic exception class for Hypertable.
uint8_t * release(size_t *lenp=0)
Moves ownership of the buffer to the caller.
uint8_t column_family_code
CellStoreScannerIntervalBlockIndex(CellStorePtr &cellstore, IndexT *index, SerializedKey start_key, SerializedKey end_key, ScanContext *scan_ctx)
bool fetch_next_block(bool eob=false)
This method fetches the 'next' compressed block of key/value pairs from the underlying CellStore...
Error codes, Exception handling, error logging.
#define HT_THROW(_code_, _msg_)
static const char * END_ROW_MARKER
virtual bool get(Key &key, ByteString &value)
static Hypertable::FileBlockCache * block_cache
IndexT::iterator IndexIteratorT
Declarations for DispatchHandlerSynchronizer.
Declarations for CellStoreBlockIndexArray.
BlockCompressionCodec * m_zcodec