Skip to content

Commit

Permalink
[#25795] DocDB: Use variable bloom filter during index scan
Browse files Browse the repository at this point in the history
Summary:
The index scan consists of 2 steps.

Fetch ybctids from the index table.
Fetch remaining row data from the indexed table.
On the second step TServer receives list of ybctids from the first step.
Fixed bloom filter cannot be used in this scenario.
Recently variable bloom filter was added, so we could create iterator and defer bloom filter check to iteration phase.
So could use it in index scan.

Manually checked performance improvement:
Started rf=1 cluster on n2-standard-4 dev server.
Created table:
```
CREATE TABLE main (id BIGSERIAL PRIMARY KEY, sub BIGINT, payload TEXT);
CREATE INDEX ON main (sub ASC);
```

Inserted 19M rows (10GB of data on the disk).
With random `sub` in range [0, 9999], random payload of 512 chars size.

Query `EXPLAIN (ANALYZE, DIST, DEBUG) select * from main where sub < 50;` executed multiple times to warmup caches.
I.e. 0.5% of rows fetched.

Master (c85b22b):
```
                                                         QUERY PLAN
-----------------------------------------------------------------------------------------------------------------------------
 Index Scan using main_sub_idx on main  (cost=0.00..5.22 rows=10 width=48) (actual time=29.480..2189.527 rows=95208 loops=1)
   Index Cond: (sub < 50)
   Storage Table Read Requests: 93
   Storage Table Read Execution Time: 2122.320 ms
   Storage Table Rows Scanned: 95208
   Storage Index Read Requests: 93
   Storage Index Read Execution Time: 8.512 ms
   Storage Index Rows Scanned: 95208
   Metric rocksdb_block_cache_miss: 101251.000
   Metric rocksdb_block_cache_hit: 291829.000
   Metric rocksdb_block_cache_add: 101251.000
   Metric rocksdb_block_cache_index_hit: 1302.000
   Metric rocksdb_block_cache_data_miss: 101251.000
   Metric rocksdb_block_cache_data_hit: 289225.000
   Metric rocksdb_block_cache_bytes_read: 9389180864.000
   Metric rocksdb_block_cache_bytes_write: 3288284660.000
   Metric rocksdb_number_db_seek: 95280.000
   Metric rocksdb_number_db_next: 380511.000
   Metric rocksdb_number_db_seek_found: 95280.000
   Metric rocksdb_number_db_next_found: 380511.000
   Metric rocksdb_iter_bytes_read: 225277281.000
   Metric rocksdb_block_cache_single_touch_hit: 11505.000
   Metric rocksdb_block_cache_single_touch_add: 101251.000
   Metric rocksdb_block_cache_single_touch_bytes_read: 373425085.000
   Metric rocksdb_block_cache_single_touch_bytes_write: 3288284660.000
   Metric rocksdb_block_cache_multi_touch_hit: 280324.000
   Metric rocksdb_block_cache_multi_touch_bytes_read: 9015755779.000
   Metric docdb_keys_found: 190508.000
   Metric rocksdb_read_block_get_micros: sum: 1241347.000, count: 101251.000
   Metric rocksdb_sst_read_micros: sum: 1176521.000, count: 101251.000
   Metric ql_read_latency: sum: 2923519.000, count: 279.000
 Planning Time: 0.057 ms
 Execution Time: 2200.769 ms
 Storage Read Requests: 186
 Storage Read Execution Time: 2130.832 ms
 Storage Rows Scanned: 190416
 Storage Write Requests: 0
 Catalog Read Requests: 0
 Catalog Write Requests: 0
 Storage Flush Requests: 0
 Metric rocksdb_block_cache_miss: 101251
 Metric rocksdb_block_cache_hit: 291829
 Metric rocksdb_block_cache_add: 101251
 Metric rocksdb_block_cache_index_hit: 1302
 Metric rocksdb_block_cache_data_miss: 101251
 Metric rocksdb_block_cache_data_hit: 289225
 Metric rocksdb_block_cache_bytes_read: 9389180864
 Metric rocksdb_block_cache_bytes_write: 3288284660
 Metric rocksdb_number_db_seek: 95280
 Metric rocksdb_number_db_next: 380511
 Metric rocksdb_number_db_seek_found: 95280
 Metric rocksdb_number_db_next_found: 380511
 Metric rocksdb_iter_bytes_read: 225277281
 Metric rocksdb_block_cache_single_touch_hit: 11505
 Metric rocksdb_block_cache_single_touch_add: 101251
 Metric rocksdb_block_cache_single_touch_bytes_read: 373425085
 Metric rocksdb_block_cache_single_touch_bytes_write: 3288284660
 Metric rocksdb_block_cache_multi_touch_hit: 280324
 Metric rocksdb_block_cache_multi_touch_bytes_read: 9015755779
 Metric docdb_keys_found: 190508
 Metric rocksdb_read_block_get_micros: sum: 1241347, count: 101251
 Metric rocksdb_sst_read_micros: sum: 1176521, count: 101251
 Metric ql_read_latency: sum: 2923519, count: 279
 Storage Execution Time: 2130.832 ms
 Peak Memory Usage: 24 kB
```

This diff:
```
                                                         QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------
 Index Scan using main_sub_idx on main  (cost=0.00..5.22 rows=10 width=48) (actual time=11.148..877.847 rows=95208 loops=1)
   Index Cond: (sub < 50)
   Storage Table Read Requests: 93
   Storage Table Read Execution Time: 811.012 ms
   Storage Table Rows Scanned: 95208
   Storage Index Read Requests: 93
   Storage Index Read Execution Time: 7.985 ms
   Storage Index Rows Scanned: 95208
   Metric rocksdb_block_cache_hit: 639323.000
   Metric rocksdb_block_cache_index_hit: 1302.000
   Metric rocksdb_block_cache_filter_hit: 475613.000
   Metric rocksdb_block_cache_data_hit: 161106.000
   Metric rocksdb_block_cache_bytes_read: 36377052828.000
   Metric rocksdb_bloom_filter_useful: 754928.000
   Metric rocksdb_bloom_filter_checked: 475613.000
   Metric rocksdb_number_db_seek: 95200.000
   Metric rocksdb_number_db_next: 380397.000
   Metric rocksdb_number_db_seek_found: 95200.000
   Metric rocksdb_number_db_next_found: 380397.000
   Metric rocksdb_iter_bytes_read: 225165426.000
   Metric rocksdb_block_cache_multi_touch_hit: 639323.000
   Metric rocksdb_block_cache_multi_touch_bytes_read: 36377052828.000
   Metric docdb_keys_found: 190508.000
   Metric ql_read_latency: sum: 1109870.000, count: 279.000
 Planning Time: 0.054 ms
 Execution Time: 889.371 ms
 Storage Read Requests: 186
 Storage Read Execution Time: 818.997 ms
 Storage Rows Scanned: 190416
 Storage Write Requests: 0
 Catalog Read Requests: 0
 Catalog Write Requests: 0
 Storage Flush Requests: 0
 Metric rocksdb_block_cache_hit: 639323
 Metric rocksdb_block_cache_index_hit: 1302
 Metric rocksdb_block_cache_filter_hit: 475613
 Metric rocksdb_block_cache_data_hit: 161106
 Metric rocksdb_block_cache_bytes_read: 36377052828
 Metric rocksdb_bloom_filter_useful: 754928
 Metric rocksdb_bloom_filter_checked: 475613
 Metric rocksdb_number_db_seek: 95200
 Metric rocksdb_number_db_next: 380397
 Metric rocksdb_number_db_seek_found: 95200
 Metric rocksdb_number_db_next_found: 380397
 Metric rocksdb_iter_bytes_read: 225165426
 Metric rocksdb_block_cache_multi_touch_hit: 639323
 Metric rocksdb_block_cache_multi_touch_bytes_read: 36377052828
 Metric docdb_keys_found: 190508
 Metric ql_read_latency: sum: 1109870, count: 279
 Storage Execution Time: 818.997 ms
 Peak Memory Usage: 24 kB
```

The same test on larger machine (n1-standard-64), where all data fits into block cache.
Master: 1456.097 ms
This diff: 924.507 ms

The test with insert and query 500k rows using index scan (all data fits into memtable):
Master: 1456.097 ms
This diff: 1464.748 ms
Jira: DB-15090

Test Plan: Jenkins

Reviewers: timur

Reviewed By: timur

Subscribers: neil, mihnea, kannan, svc_phabricator, yql, ybase

Tags: #jenkins-ready

Differential Revision: https://phorge.dev.yugabyte.com/D41475
  • Loading branch information
spolitov committed Feb 5, 2025
1 parent be08e40 commit b97ccc9
Show file tree
Hide file tree
Showing 42 changed files with 402 additions and 203 deletions.
31 changes: 7 additions & 24 deletions src/yb/docdb/bounded_rocksdb_iterator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@

#include "yb/rocksdb/db.h"

namespace yb {
namespace docdb {
namespace yb::docdb {

BoundedRocksDbIterator::BoundedRocksDbIterator(
rocksdb::DB* rocksdb, const rocksdb::ReadOptions& read_opts,
Expand Down Expand Up @@ -55,29 +54,15 @@ const rocksdb::KeyValueEntry& BoundedRocksDbIterator::SeekToLast() {
}

const rocksdb::KeyValueEntry& BoundedRocksDbIterator::Seek(Slice target) {
return DoSeek(target, nullptr);
}

template <class Filter>
const rocksdb::KeyValueEntry& BoundedRocksDbIterator::DoSeek(Slice target, Filter filter_user_key) {
if (!key_bounds_->lower.empty() && target.compare(key_bounds_->lower) < 0) {
return FilterEntry(DoSeekImpl(key_bounds_->lower, filter_user_key));
return FilterEntry(iterator_->Seek(key_bounds_->lower));
}

if (!key_bounds_->upper.empty() && target.compare(key_bounds_->upper) > 0) {
return FilterEntry(DoSeekImpl(key_bounds_->upper, filter_user_key));
return FilterEntry(iterator_->Seek(key_bounds_->upper));
}

return FilterEntry(DoSeekImpl(target, filter_user_key));
}

const rocksdb::KeyValueEntry& BoundedRocksDbIterator::DoSeekImpl(Slice target, std::nullptr_t) {
return iterator_->Seek(target);
}

const rocksdb::KeyValueEntry& BoundedRocksDbIterator::DoSeekImpl(
Slice target, Slice filter_user_key) {
return iterator_->SeekWithNewFilter(target, filter_user_key);
return FilterEntry(iterator_->Seek(target));
}

const rocksdb::KeyValueEntry& BoundedRocksDbIterator::Next() {
Expand Down Expand Up @@ -111,10 +96,8 @@ void BoundedRocksDbIterator::UseFastNext(bool value) {
iterator_->UseFastNext(value);
}

const rocksdb::KeyValueEntry& BoundedRocksDbIterator::DoSeekWithNewFilter(
Slice target, Slice filter_user_key) {
return DoSeek(target, filter_user_key);
void BoundedRocksDbIterator::UpdateFilterKey(Slice user_key_for_filter) {
iterator_->UpdateFilterKey(user_key_for_filter);
}

} // namespace docdb
} // namespace yb
} // namespace yb::docdb
12 changes: 3 additions & 9 deletions src/yb/docdb/bounded_rocksdb_iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
#include "yb/rocksdb/iterator.h"
#include "yb/rocksdb/options.h"

namespace yb {
namespace docdb {
namespace yb::docdb {

class BoundedRocksDbIterator final : public rocksdb::Iterator {
public:
Expand Down Expand Up @@ -72,18 +71,13 @@ class BoundedRocksDbIterator final : public rocksdb::Iterator {
}

void UseFastNext(bool value) override;
void UpdateFilterKey(Slice user_key_for_filter) override;

private:
const rocksdb::KeyValueEntry& FilterEntry(const rocksdb::KeyValueEntry& entry) const;
template <class Filter>
const rocksdb::KeyValueEntry& DoSeek(Slice target, Filter filter_user_key);
const rocksdb::KeyValueEntry& DoSeekImpl(Slice target, std::nullptr_t);
const rocksdb::KeyValueEntry& DoSeekImpl(Slice target, Slice filter_user_key);
const rocksdb::KeyValueEntry& DoSeekWithNewFilter(Slice target, Slice filter_user_key) override;

std::unique_ptr<rocksdb::Iterator> iterator_;
const KeyBounds* key_bounds_;
};

} // namespace docdb
} // namespace yb
} // namespace yb::docdb
17 changes: 9 additions & 8 deletions src/yb/docdb/conflict_resolution.cc
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,8 @@ class StrongConflictChecker {
/* iterate_upper_bound = */ nullptr,
rocksdb::CacheRestartBlockKeys::kFalse);
}
value_iter_.SeekWithNewFilter(intent_key);
value_iter_.UpdateFilterKey(intent_key);
const auto* entry = &value_iter_.Seek(intent_key);

VLOG_WITH_PREFIX_AND_FUNC(4)
<< "Overwrite; Seek: " << intent_key.ToDebugString() << " ("
Expand All @@ -951,16 +952,16 @@ class StrongConflictChecker {
// change, so it is only directly in conflict with a committed record that deletes or replaces
// that entire document subtree (similar to a strong intent), so it would have the same exact
// key as the weak intent (not including hybrid time).
while (value_iter_.Valid() &&
while (entry->Valid() &&
(intent_key.starts_with(KeyEntryTypeAsChar::kGroupEnd) ||
value_iter_.key().starts_with(intent_key))) {
auto existing_key = value_iter_.key();
entry->key.starts_with(intent_key))) {
auto existing_key = entry->key;
auto doc_ht = VERIFY_RESULT(DocHybridTime::DecodeFromEnd(&existing_key));
if (existing_key.empty() ||
existing_key[existing_key.size() - 1] != KeyEntryTypeAsChar::kHybridTime) {
return STATUS_FORMAT(
Corruption, "Hybrid time expected at end of key: $0",
value_iter_.key().ToDebugString());
entry->key.ToDebugString());
}
if (!strong && existing_key.size() != intent_key.size() + 1) {
VLOG_WITH_PREFIX(4)
Expand All @@ -972,9 +973,9 @@ class StrongConflictChecker {
<< "Check value overwrite, key: " << SubDocKey::DebugSliceToString(intent_key)
<< ", read time: " << read_time_
<< ", doc ht: " << doc_ht.hybrid_time()
<< ", found key: " << SubDocKey::DebugSliceToString(value_iter_.key())
<< ", found key: " << SubDocKey::DebugSliceToString(entry->key)
<< ", after start: " << (doc_ht.hybrid_time() >= read_time_)
<< ", value: " << value_iter_.value().ToDebugString();
<< ", value: " << entry->value.ToDebugString();
if (doc_ht.hybrid_time() >= read_time_) {
if (conflict_management_policy == SKIP_ON_CONFLICT) {
return STATUS(InternalError, "Skip locking since entity was modified in regular db",
Expand All @@ -991,7 +992,7 @@ class StrongConflictChecker {
buffer_.Reset(existing_key);
// Already have ValueType::kHybridTime at the end
buffer_.AppendHybridTime(DocHybridTime::kMin);
ROCKSDB_SEEK(&value_iter_, buffer_.AsSlice());
entry = &ROCKSDB_SEEK(&value_iter_, buffer_.AsSlice());
}

return value_iter_.status();
Expand Down
5 changes: 5 additions & 0 deletions src/yb/docdb/doc_rowwise_iterator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ void DocRowwiseIterator::Refresh(SeekFilter seek_filter) {
seek_filter_ = seek_filter;
}

void DocRowwiseIterator::UpdateFilterKey(Slice user_key_for_filter) {
db_iter_->UpdateFilterKey(user_key_for_filter);
}

void DocRowwiseIterator::Seek(Slice key) {
VLOG_WITH_FUNC(3) << " Seeking to " << key << "/" << dockv::DocKey::DebugSliceToString(key);

Expand Down Expand Up @@ -445,6 +449,7 @@ bool DocRowwiseIterator::LivenessColumnExists() const {
}

Result<Slice> DocRowwiseIterator::FetchDirect(Slice key) {
db_iter_->UpdateFilterKey(key);
db_iter_->Seek(key, SeekFilter::kAll, Full::kTrue);
auto fetch_result = VERIFY_RESULT_REF(db_iter_->Fetch());
return fetch_result.key == key ? fetch_result.value : Slice();
Expand Down
1 change: 1 addition & 0 deletions src/yb/docdb/doc_rowwise_iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class DocRowwiseIterator final : public DocRowwiseIteratorBase {

Result<HybridTime> RestartReadHt() override;

void UpdateFilterKey(Slice user_key_for_filter) override;
void Seek(Slice key) override;

void SeekToDocKeyPrefix(Slice doc_key_prefix) override;
Expand Down
18 changes: 12 additions & 6 deletions src/yb/docdb/doc_rowwise_iterator_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@ void DocRowwiseIteratorBase::InitForTableType(
scan_choices_ = ScanChoices::CreateEmpty();
}

Status DocRowwiseIteratorBase::Init(const qlexpr::YQLScanSpec& doc_spec, SkipSeek skip_seek) {
Status DocRowwiseIteratorBase::Init(
const qlexpr::YQLScanSpec& doc_spec, SkipSeek skip_seek,
UseVariableBloomFilter use_variable_bloom_filter) {
table_type_ = doc_spec.client_type() == YQL_CLIENT_CQL ? TableType::YQL_TABLE_TYPE
: TableType::PGSQL_TABLE_TYPE;
ignore_ttl_ = table_type_ == TableType::PGSQL_TABLE_TYPE;
Expand All @@ -172,8 +174,12 @@ Status DocRowwiseIteratorBase::Init(const qlexpr::YQLScanSpec& doc_spec, SkipSee
const bool is_fixed_point_get =
!bounds.lower.empty() &&
VERIFY_RESULT(HashedOrFirstRangeComponentsEqual(bounds.lower, bounds.upper));
const auto bloom_filter = is_fixed_point_get ? BloomFilterOptions::Fixed(bounds.lower.AsSlice())
: BloomFilterOptions::Inactive();
auto bloom_filter = BloomFilterOptions::Inactive();
if (is_fixed_point_get) {
bloom_filter = BloomFilterOptions::Fixed(bounds.lower.AsSlice());
} else if (use_variable_bloom_filter) {
bloom_filter = BloomFilterOptions::Variable();
}

if (is_forward_scan_) {
has_bound_key_ = !bounds.upper.empty();
Expand Down Expand Up @@ -312,10 +318,10 @@ void DocRowwiseIteratorBase::SeekTuple(Slice tuple_id) {
tuple_key_->Truncate(1 + size);
}
tuple_key_->AppendRawBytes(tuple_id);
Seek(*tuple_key_);
} else {
Seek(tuple_id);
tuple_id = *tuple_key_;
}
UpdateFilterKey(tuple_id);
Seek(tuple_id);

row_key_.Clear();
}
Expand Down
8 changes: 6 additions & 2 deletions src/yb/docdb/doc_rowwise_iterator_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ class DocRowwiseIteratorBase : public YQLRowwiseIteratorIf {
void InitForTableType(
TableType table_type, Slice sub_doc_key = Slice(), SkipSeek skip_seek = SkipSeek::kFalse);
// Init QL read scan.
Status Init(const qlexpr::YQLScanSpec& spec, SkipSeek skip_seek = SkipSeek::kFalse);
Status Init(
const qlexpr::YQLScanSpec& spec,
SkipSeek skip_seek = SkipSeek::kFalse,
UseVariableBloomFilter use_variable_bloom_filter = UseVariableBloomFilter::kFalse);

bool IsFetchedRowStatic() const override;

Expand Down Expand Up @@ -110,6 +113,7 @@ class DocRowwiseIteratorBase : public YQLRowwiseIteratorIf {
const rocksdb::QueryId query_id = rocksdb::kDefaultQueryId,
std::shared_ptr<rocksdb::ReadFileFilter> file_filter = nullptr) = 0;

virtual void UpdateFilterKey(Slice user_key_for_filter) = 0;
virtual void Seek(Slice key) = 0;
virtual void SeekPrevDocKey(Slice key) = 0;

Expand Down Expand Up @@ -184,7 +188,7 @@ class DocRowwiseIteratorBase : public YQLRowwiseIteratorIf {
std::optional<dockv::PgKeyDecoder> pg_key_decoder_;

// Key for seeking a YSQL tuple. Used only when the table has a cotable id.
boost::optional<dockv::KeyBytes> tuple_key_;
std::optional<dockv::KeyBytes> tuple_key_;

TableType table_type_;
bool ignore_ttl_ = false;
Expand Down
1 change: 1 addition & 0 deletions src/yb/docdb/docdb_fwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,6 @@ using VectorIndexSearchResult = std::vector<VectorIndexSearchResultEntry>;
YB_STRONGLY_TYPED_BOOL(SkipFlush);
YB_STRONGLY_TYPED_BOOL(SkipSeek);
YB_STRONGLY_TYPED_BOOL(FastBackwardScan);
YB_STRONGLY_TYPED_BOOL(UseVariableBloomFilter);

} // namespace yb::docdb
4 changes: 4 additions & 0 deletions src/yb/docdb/intent_aware_iterator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1404,6 +1404,10 @@ bool IntentAwareIterator::HandleStatus(const Status& status) {
return false;
}

void IntentAwareIterator::UpdateFilterKey(Slice user_key_for_filter) {
iter_.UpdateFilterKey(user_key_for_filter);
}

#ifndef NDEBUG
void IntentAwareIterator::DebugSeekTriggered() {
#if YB_INTENT_AWARE_ITERATOR_COLLECT_SEEK_STACK_TRACE
Expand Down
2 changes: 2 additions & 0 deletions src/yb/docdb/intent_aware_iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ class IntentAwareIterator final : public IntentAwareIteratorIf {
// Returns HybridTime::kInvalid if no such record was found.
Result<HybridTime> FindOldestRecord(Slice key_without_ht, HybridTime min_hybrid_time);

void UpdateFilterKey(Slice user_key_for_filter);

void DebugDump();

std::string DebugPosToString() override;
Expand Down
2 changes: 1 addition & 1 deletion src/yb/docdb/iter_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ const rocksdb::KeyValueEntry& PerformRocksDBSeek(
const auto cmp = result->key.compare(seek_key);
if (cmp > 0) {
VLOG_WITH_FUNC(4)
<< "Seek because position after current: " << dockv::BestEffortDocDBKeyToStr(seek_key);
<< "Seek because position before current: " << dockv::BestEffortDocDBKeyToStr(seek_key);
result = &iter->Seek(seek_key);
++stats.seek;
} else if (cmp < 0) {
Expand Down
15 changes: 9 additions & 6 deletions src/yb/docdb/pgsql_operation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ Result<std::unique_ptr<YQLRowwiseIteratorIf>> CreateYbctidIterator(
SkipSeek skip_seek) {
return data.ql_storage.GetIteratorForYbctid(
data.request.stmt_id(), projection, read_context, data.txn_op_context,
data.read_operation_data, bounds, data.pending_op, skip_seek);
data.read_operation_data, bounds, data.pending_op, skip_seek, UseVariableBloomFilter::kTrue);
}

class FilteringIterator {
Expand Down Expand Up @@ -2526,7 +2526,8 @@ Result<std::tuple<size_t, bool>> PgsqlReadOperation::ExecuteScalar() {
response_size_limit = std::min(response_size_limit, request_.size_limit());
}

VLOG(4) << "Row count limit: " << row_count_limit << ", size limit: " << response_size_limit;
VLOG_WITH_FUNC(4)
<< "Row count limit: " << row_count_limit << ", size limit: " << response_size_limit;

// Create the projection of regular columns selected by the row block plus any referenced in
// the WHERE condition. When DocRowwiseIterator::NextRow() populates the value map, it uses this
Expand Down Expand Up @@ -2587,7 +2588,8 @@ Result<std::tuple<size_t, bool>> PgsqlReadOperation::ExecuteScalar() {
++fetched_rows;
}

VLOG(3) << "Stopped iterator after " << match_count << " matches, " << fetched_rows
VLOG_WITH_FUNC(3)
<< "Stopped iterator after " << match_count << " matches, " << fetched_rows
<< " rows fetched. Response buffer size: " << result_buffer_->size()
<< ", response size limit: " << response_size_limit
<< ", deadline is " << (scan_time_exceeded ? "" : "not ") << "exceeded";
Expand Down Expand Up @@ -2690,9 +2692,10 @@ Result<size_t> PgsqlReadOperation::ExecuteBatchKeys(KeyProvider& key_provider) {
}

if (result_buffer_->size() >= response_size_limit) {
VLOG(3) << "Stopped iterator after " << found_rows << " rows fetched (out of "
<< request_.batch_arguments_size() << " matches). Response buffer size: "
<< result_buffer_->size() << ", response size limit: " << response_size_limit;
VLOG_WITH_FUNC(3)
<< "Stopped iterator after " << found_rows << " rows fetched (out of "
<< request_.batch_arguments_size() << " matches). Response buffer size: "
<< result_buffer_->size() << ", response size limit: " << response_size_limit;
break;
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/yb/docdb/ql_rocksdb_storage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ Result<std::unique_ptr<YQLRowwiseIteratorIf>> QLRocksDBStorage::GetIteratorForYb
const ReadOperationData& read_operation_data,
const YbctidBounds& bounds,
std::reference_wrapper<const ScopedRWOperation> pending_op,
SkipSeek skip_seek) const {
SkipSeek skip_seek,
UseVariableBloomFilter use_variable_bloom_filter) const {
DocKey lower_doc_key(doc_read_context.get().schema());

if (!bounds.first.empty()) {
Expand Down Expand Up @@ -172,7 +173,7 @@ Result<std::unique_ptr<YQLRowwiseIteratorIf>> QLRocksDBStorage::GetIteratorForYb
true /* is_forward_scan */,
lower_doc_key,
upper_doc_key),
skip_seek));
skip_seek, use_variable_bloom_filter));
return std::move(doc_iter);
}

Expand Down
3 changes: 2 additions & 1 deletion src/yb/docdb/ql_rocksdb_storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ class QLRocksDBStorage : public YQLStorageIf {
const ReadOperationData& read_operation_data,
const YbctidBounds& bounds,
std::reference_wrapper<const ScopedRWOperation> pending_op,
SkipSeek skip_seek = SkipSeek::kFalse) const override;
SkipSeek skip_seek,
UseVariableBloomFilter use_variable_bloom_filter) const override;

Result<SampleBlocksData> GetSampleBlocks(
std::reference_wrapper<const DocReadContext> doc_read_context,
Expand Down
3 changes: 2 additions & 1 deletion src/yb/docdb/ql_storage_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ class YQLStorageIf {
const ReadOperationData& read_operation_data,
const YbctidBounds& bounds,
std::reference_wrapper<const ScopedRWOperation> pending_op,
SkipSeek skip_seek = SkipSeek::kFalse) const = 0;
SkipSeek skip_seek = SkipSeek::kFalse,
UseVariableBloomFilter use_variable_bloom_filter = UseVariableBloomFilter::kFalse) const = 0;

// Returns up to num_blocks_for_sample number of sample blocks boundaries.
// Each boundary is an encoded doc key or its prefix.
Expand Down
3 changes: 2 additions & 1 deletion src/yb/master/yql_virtual_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ class YQLVirtualTable : public docdb::YQLStorageIf {
const docdb::ReadOperationData& read_operation_data,
const docdb::YbctidBounds& bounds,
std::reference_wrapper<const ScopedRWOperation> pending_op,
docdb::SkipSeek skip_seek = docdb::SkipSeek::kFalse) const override {
docdb::SkipSeek skip_seek,
docdb::UseVariableBloomFilter use_variable_bloom_filter) const override {
LOG(FATAL) << "Postgresql virtual tables are not yet implemented";
return nullptr;
}
Expand Down
2 changes: 2 additions & 0 deletions src/yb/rocksdb/db/comparator_db_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ class KVIter : public Iterator {
return entry_;
}

void UpdateFilterKey(Slice user_key_for_filter) override {}

Status status() const override { return Status::OK(); }

private:
Expand Down
Loading

0 comments on commit b97ccc9

Please sign in to comment.