|
|
|
@ -27,7 +27,9 @@ struct SuperVersionContext { |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
autovector<SuperVersion*> superversions_to_free; |
|
|
|
|
#ifndef ROCKSDB_DISABLE_STALL_NOTIFICATION |
|
|
|
|
autovector<WriteStallNotification> write_stall_notifications; |
|
|
|
|
#endif |
|
|
|
|
unique_ptr<SuperVersion> new_superversion; // if nullptr no new superversion
|
|
|
|
|
|
|
|
|
|
explicit SuperVersionContext(bool create_superversion = false) |
|
|
|
@ -38,14 +40,18 @@ struct SuperVersionContext { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
inline bool HaveSomethingToDelete() const { |
|
|
|
|
return superversions_to_free.size() > 0 || |
|
|
|
|
write_stall_notifications.size() > 0; |
|
|
|
|
#ifndef ROCKSDB_DISABLE_STALL_NOTIFICATION |
|
|
|
|
return !superversions_to_free.empty() || |
|
|
|
|
!write_stall_notifications.empty(); |
|
|
|
|
#else |
|
|
|
|
return !superversions_to_free.empty(); |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void PushWriteStallNotification( |
|
|
|
|
WriteStallCondition old_cond, WriteStallCondition new_cond, |
|
|
|
|
const std::string& name, const ImmutableCFOptions* ioptions) { |
|
|
|
|
#ifndef ROCKSDB_LITE |
|
|
|
|
#if !defined(ROCKSDB_LITE) && !defined(ROCKSDB_DISABLE_STALL_NOTIFICATION) |
|
|
|
|
WriteStallNotification notif; |
|
|
|
|
notif.write_stall_info.cf_name = name; |
|
|
|
|
notif.write_stall_info.condition.prev = old_cond; |
|
|
|
@ -57,14 +63,14 @@ struct SuperVersionContext { |
|
|
|
|
(void)new_cond; |
|
|
|
|
(void)name; |
|
|
|
|
(void)ioptions; |
|
|
|
|
#endif // !ROCKSDB_LITE
|
|
|
|
|
#endif // !defined(ROCKSDB_LITE) && !defined(ROCKSDB_DISABLE_STALL_NOTIFICATION)
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Clean() { |
|
|
|
|
#ifndef ROCKSDB_LITE |
|
|
|
|
#if !defined(ROCKSDB_LITE) && !defined(ROCKSDB_DISABLE_STALL_NOTIFICATION) |
|
|
|
|
// notify listeners on changed write stall conditions
|
|
|
|
|
for (auto& notif : write_stall_notifications) { |
|
|
|
|
for (auto listener : notif.immutable_cf_options->listeners) { |
|
|
|
|
for (auto& listener : notif.immutable_cf_options->listeners) { |
|
|
|
|
listener->OnStallConditionsChanged(notif.write_stall_info); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -78,8 +84,10 @@ struct SuperVersionContext { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
~SuperVersionContext() { |
|
|
|
|
assert(write_stall_notifications.size() == 0); |
|
|
|
|
assert(superversions_to_free.size() == 0); |
|
|
|
|
#ifndef ROCKSDB_DISABLE_STALL_NOTIFICATION |
|
|
|
|
assert(write_stall_notifications.empty()); |
|
|
|
|
#endif |
|
|
|
|
assert(superversions_to_free.empty()); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
@ -99,7 +107,7 @@ struct JobContext { |
|
|
|
|
std::string file_name; |
|
|
|
|
std::string file_path; |
|
|
|
|
CandidateFileInfo(std::string name, std::string path) |
|
|
|
|
: file_name(std::move(name)), file_path(path) {} |
|
|
|
|
: file_name(std::move(name)), file_path(std::move(path)) {} |
|
|
|
|
bool operator==(const CandidateFileInfo& other) const { |
|
|
|
|
return file_name == other.file_name && |
|
|
|
|
file_path == other.file_path; |
|
|
|
|