Hide event listeners from lite build

Summary:
Fixing lite build failure introduce by #2169.
Closes https://github.com/facebook/rocksdb/pull/2174

Reviewed By: sagar0

Differential Revision: D4910619

Pulled By: yiwu-arbug

fbshipit-source-id: 5213b7b7431cc258688793c8c28153025588d8d9
This commit is contained in:
Yi Wu 2017-04-18 17:12:50 -07:00
parent 8a1c34903c
commit 6df24fcffc
2 changed files with 8 additions and 0 deletions

View File

@ -10,6 +10,7 @@
namespace rocksdb { namespace rocksdb {
#ifndef ROCKSDB_LITE
CompactionEventListener::CompactionListenerValueType fromInternalValueType( CompactionEventListener::CompactionListenerValueType fromInternalValueType(
ValueType vt) { ValueType vt) {
switch (vt) { switch (vt) {
@ -30,6 +31,7 @@ CompactionEventListener::CompactionListenerValueType fromInternalValueType(
return CompactionEventListener::CompactionListenerValueType::kInvalid; return CompactionEventListener::CompactionListenerValueType::kInvalid;
} }
} }
#endif // ROCKSDB_LITE
CompactionIterator::CompactionIterator( CompactionIterator::CompactionIterator(
InternalIterator* input, const Comparator* cmp, MergeHelper* merge_helper, InternalIterator* input, const Comparator* cmp, MergeHelper* merge_helper,
@ -213,11 +215,13 @@ void CompactionIterator::NextFromInput() {
current_user_key_sequence_ = kMaxSequenceNumber; current_user_key_sequence_ = kMaxSequenceNumber;
current_user_key_snapshot_ = 0; current_user_key_snapshot_ = 0;
#ifndef ROCKSDB_LITE
if (compaction_listener_) { if (compaction_listener_) {
compaction_listener_->OnCompaction(compaction_->level(), ikey_.user_key, compaction_listener_->OnCompaction(compaction_->level(), ikey_.user_key,
fromInternalValueType(ikey_.type), fromInternalValueType(ikey_.type),
value_, ikey_.sequence, true); value_, ikey_.sequence, true);
} }
#endif // ROCKSDB_LITE
// apply the compaction filter to the first occurrence of the user key // apply the compaction filter to the first occurrence of the user key
if (compaction_filter_ != nullptr && ikey_.type == kTypeValue && if (compaction_filter_ != nullptr && ikey_.type == kTypeValue &&
@ -266,11 +270,13 @@ void CompactionIterator::NextFromInput() {
} }
} }
} else { } else {
#ifndef ROCKSDB_LITE
if (compaction_listener_) { if (compaction_listener_) {
compaction_listener_->OnCompaction(compaction_->level(), ikey_.user_key, compaction_listener_->OnCompaction(compaction_->level(), ikey_.user_key,
fromInternalValueType(ikey_.type), fromInternalValueType(ikey_.type),
value_, ikey_.sequence, false); value_, ikey_.sequence, false);
} }
#endif // ROCKSDB_LITE
// Update the current key to reflect the new sequence number/type without // Update the current key to reflect the new sequence number/type without
// copying the user key. // copying the user key.

View File

@ -741,12 +741,14 @@ void CompactionJob::ProcessKeyValueCompaction(SubcompactionState* sub_compact) {
// we allow only 1 compaction event listener. Used by blob storage // we allow only 1 compaction event listener. Used by blob storage
CompactionEventListener* comp_event_listener = nullptr; CompactionEventListener* comp_event_listener = nullptr;
#ifndef ROCKSDB_LITE
for (auto& celitr : cfd->ioptions()->listeners) { for (auto& celitr : cfd->ioptions()->listeners) {
comp_event_listener = celitr->GetCompactionEventListener(); comp_event_listener = celitr->GetCompactionEventListener();
if (comp_event_listener != nullptr) { if (comp_event_listener != nullptr) {
break; break;
} }
} }
#endif // ROCKSDB_LITE
Status status; Status status;
sub_compact->c_iter.reset(new CompactionIterator( sub_compact->c_iter.reset(new CompactionIterator(