Skip to content

Commit f53ae1c

Browse files
refactor: Give up on using ABSL_GUARDED_BY
Signed-off-by: Stepan Bagritsevich <stefan@dragonflydb.io>
1 parent 5cd04f0 commit f53ae1c

File tree

2 files changed

+15
-19
lines changed

2 files changed

+15
-19
lines changed

src/server/snapshot.cc

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ bool SliceSnapshot::IsSnaphotInProgress() {
6565
return tl_slice_snapshots.size() > 0;
6666
}
6767

68-
void SliceSnapshot::Start(bool stream_journal, const Cancellation* cll, SnapshotFlush allow_flush)
69-
ABSL_LOCKS_EXCLUDED(big_value_mu_) {
68+
void SliceSnapshot::Start(bool stream_journal, const Cancellation* cll, SnapshotFlush allow_flush) {
7069
DCHECK(!snapshot_fb_.IsJoinable());
7170

7271
auto db_cb = absl::bind_front(&SliceSnapshot::OnDbChange, this);
@@ -82,16 +81,15 @@ void SliceSnapshot::Start(bool stream_journal, const Cancellation* cll, Snapshot
8281
const auto flush_threshold = ServerState::tlocal()->serialization_max_chunk_size;
8382
std::function<void(size_t, RdbSerializer::FlushState)> flush_fun;
8483
if (flush_threshold != 0 && allow_flush == SnapshotFlush::kAllow) {
85-
flush_fun =
86-
[this, flush_threshold](size_t bytes_serialized, RdbSerializer::FlushState flush_state)
87-
ABSL_LOCKS_EXCLUDED(big_value_mu_) {
88-
if (bytes_serialized > flush_threshold) {
89-
size_t serialized = FlushSerialized(flush_state);
90-
VLOG(2) << "FlushSerialized " << serialized << " bytes";
91-
auto& stats = ServerState::tlocal()->stats;
92-
++stats.big_value_preemptions;
93-
}
94-
};
84+
flush_fun = [this, flush_threshold](size_t bytes_serialized,
85+
RdbSerializer::FlushState flush_state) {
86+
if (bytes_serialized > flush_threshold) {
87+
size_t serialized = FlushSerialized(flush_state);
88+
VLOG(2) << "FlushSerialized " << serialized << " bytes";
89+
auto& stats = ServerState::tlocal()->stats;
90+
++stats.big_value_preemptions;
91+
}
92+
};
9593
}
9694
serializer_ = std::make_unique<RdbSerializer>(compression_mode_, flush_fun);
9795

@@ -104,8 +102,7 @@ void SliceSnapshot::Start(bool stream_journal, const Cancellation* cll, Snapshot
104102
});
105103
}
106104

107-
void SliceSnapshot::StartIncremental(Context* cntx, LSN start_lsn)
108-
ABSL_LOCKS_EXCLUDED(big_value_mu_) {
105+
void SliceSnapshot::StartIncremental(Context* cntx, LSN start_lsn) {
109106
serializer_ = std::make_unique<RdbSerializer>(compression_mode_);
110107

111108
snapshot_fb_ = fb2::Fiber("incremental_snapshot", [cntx, start_lsn, this] {

src/server/snapshot.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,14 @@ class SliceSnapshot {
6161
enum class SnapshotFlush { kAllow, kDisallow };
6262

6363
void Start(bool stream_journal, const Cancellation* cll,
64-
SnapshotFlush allow_flush = SnapshotFlush::kDisallow)
65-
ABSL_LOCKS_EXCLUDED(big_value_mu_);
64+
SnapshotFlush allow_flush = SnapshotFlush::kDisallow);
6665

6766
// Initialize a snapshot that sends only the missing journal updates
6867
// since start_lsn and then registers a callback switches into the
6968
// journal streaming mode until stopped.
7069
// If we're slower than the buffer and can't continue, `Cancel()` is
7170
// called.
72-
void StartIncremental(Context* cntx, LSN start_lsn) ABSL_LOCKS_EXCLUDED(big_value_mu_);
71+
void StartIncremental(Context* cntx, LSN start_lsn);
7372

7473
// Finalizes journal streaming writes. Only called for replication.
7574
// Blocking. Must be called from the Snapshot thread.
@@ -114,7 +113,7 @@ class SliceSnapshot {
114113
// Helper function that flushes the serialized items into the RecordStream.
115114
// Can block.
116115
using FlushState = SerializerBase::FlushState;
117-
size_t FlushSerialized(FlushState flush_state) ABSL_EXCLUSIVE_LOCKS_REQUIRED(big_value_mu_);
116+
size_t FlushSerialized(FlushState flush_state); // ABSL_EXCLUSIVE_LOCKS_REQUIRED(big_value_mu_)
118117

119118
public:
120119
uint64_t snapshot_version() const {
@@ -144,7 +143,7 @@ class SliceSnapshot {
144143
DbSlice* db_slice_;
145144
const DbTableArray db_array_;
146145

147-
std::unique_ptr<RdbSerializer> serializer_ ABSL_GUARDED_BY(big_value_mu_);
146+
std::unique_ptr<RdbSerializer> serializer_; // ABSL_GUARDED_BY(big_value_mu_);
148147

149148
// collected during atomic bucket traversal
150149
std::vector<DelayedEntry> delayed_entries_ ABSL_GUARDED_BY(big_value_mu_);

0 commit comments

Comments
 (0)