-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add PacificA data replication consistency scheme #2994
base: unstable
Are you sure you want to change the base?
Changes from 8 commits
de85424
9bbb09e
337bb7d
63f45d0
d40607e
9239d31
581bc8f
21e1e9e
2afafc0
a8aa80a
7317faf
03d4a6e
05cf8af
bee8886
cfd3fed
fccadca
70be8a2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,8 +59,6 @@ src/build_version.cc | |
.cache | ||
|
||
.idea/ | ||
|
||
|
||
#build | ||
build/ | ||
buildtrees | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -160,6 +160,7 @@ enum SlaveState { | |
kSlaveNotSync = 0, | ||
kSlaveDbSync = 1, | ||
kSlaveBinlogSync = 2, | ||
KCandidate = 3, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Update SlaveStateMsg array to include KCandidate state. The KCandidate state was added to the SlaveState enum, but the corresponding debug message array SlaveStateMsg needs to be updated. Apply this diff: -const std::string SlaveStateMsg[] = {"SlaveNotSync", "SlaveDbSync", "SlaveBinlogSync"};
+const std::string SlaveStateMsg[] = {"SlaveNotSync", "SlaveDbSync", "SlaveBinlogSync", "Candidate"};
|
||
}; | ||
|
||
// debug only | ||
|
@@ -274,9 +275,12 @@ class RmNode : public Node { | |
struct WriteTask { | ||
struct RmNode rm_node_; | ||
struct BinlogChip binlog_chip_; | ||
LogOffset committed_id_ = LogOffset(); | ||
LogOffset prev_offset_; | ||
WriteTask(const RmNode& rm_node, const BinlogChip& binlog_chip, const LogOffset& prev_offset) | ||
: rm_node_(rm_node), binlog_chip_(binlog_chip), prev_offset_(prev_offset) {} | ||
WriteTask(const RmNode& rm_node, const BinlogChip& binlog_chip, const LogOffset& prev_offset, const LogOffset& committed_id) | ||
: rm_node_(rm_node), binlog_chip_(binlog_chip), prev_offset_(prev_offset), committed_id_(committed_id) {} | ||
}; | ||
|
||
// slowlog define | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Consider thread safety for the new
Log
class.The
Log
class uses astd::shared_mutex
namedlogs_mutex_
, but some methods may not adequately protect shared resources. Review the methods to ensure proper locking and prevent data races.For example, wrap accesses to
logs_
with appropriate locks:Ensure all public methods accessing shared data are thread-safe.