Skip to content

Commit d139f2d

Browse files
committed
[feat][contrib] Upgrade brpc to 1.12.1.
Signed-off-by: Ketor <[email protected]>
1 parent 463fcee commit d139f2d

File tree

7 files changed

+13
-20
lines changed

7 files changed

+13
-20
lines changed

contrib/brpc

Submodule brpc updated 328 files

contrib/rocksdb

Submodule rocksdb updated 252 files

src/common/latch.cc

+5-4
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,12 @@ Latches::Latches() {
9898

9999
Latches::~Latches() { delete slots_ptr; }
100100

101+
// NOTE: bthread_mutex_t not allow copy, so we can't resize slots
101102
// CAUTION: this function is not safe, need to call before any usage begin
102-
void Latches::SetSlotNum(size_t size) {
103-
slots_size = NextPowerOfTwo(size);
104-
slots_ptr->resize(slots_size);
105-
}
103+
// void Latches::SetSlotNum(size_t size) {
104+
// slots_size = NextPowerOfTwo(size);
105+
// slots_ptr->resize(slots_size);
106+
// }
106107

107108
bool Latches::Acquire(Lock* lock, uint64_t who) const {
108109
size_t acquired_count = 0;

src/common/latch.h

+4-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace dingodb {
2626

2727
class Latch {
2828
public:
29-
std::deque<std::pair<uint64_t, uint64_t>> waiting{};
29+
std::deque<std::pair<uint64_t, uint64_t>> waiting;
3030

3131
Latch() = default;
3232

@@ -44,7 +44,7 @@ class Latch {
4444

4545
class Lock {
4646
public:
47-
std::vector<uint64_t> requiredHashes{};
47+
std::vector<uint64_t> requiredHashes;
4848
size_t ownedCount = 0;
4949

5050
Lock(const std::vector<std::string>& keys);
@@ -71,7 +71,8 @@ class Latches {
7171
explicit Latches();
7272
~Latches();
7373

74-
void SetSlotNum(size_t size);
74+
// NOTE: bthread_mutex_t not allow copy, so we can't resize slots
75+
// void SetSlotNum(size_t size);
7576

7677
bool Acquire(Lock* lock, uint64_t who) const;
7778

src/coordinator/kv_control.h

-9
Original file line numberDiff line numberDiff line change
@@ -70,37 +70,30 @@ struct KvWatchNode {
7070
class DeferDone {
7171
public:
7272
DeferDone() {
73-
// bthread_mutex_init(&mutex_, nullptr);
7473
create_time_ = butil::gettimeofday_ms();
7574
}
7675
DeferDone(uint64_t closure_id, const std::string &watch_key, google::protobuf::Closure *done,
7776
pb::version::WatchResponse *response)
7877
: closure_id_(closure_id), watch_key_(watch_key), done_(done), response_(response) {
7978
create_time_ = butil::gettimeofday_ms();
80-
// bthread_mutex_init(&mutex_, nullptr);
8179
}
8280

8381
~DeferDone() = default;
8482

8583
bool IsDone() {
86-
// bthread_mutex_lock(&mutex_);
8784
bool is_done = done_ == nullptr;
88-
// bthread_mutex_unlock(&mutex_);
8985
return is_done;
9086
}
9187

9288
std::string GetWatchKey() { return watch_key_; }
9389
pb::version::WatchResponse *GetResponse() {
94-
// bthread_mutex_lock(&mutex_);
9590
auto *response = response_;
96-
// bthread_mutex_unlock(&mutex_);
9791
return response;
9892
}
9993

10094
int64_t GetStartTime() const { return create_time_; }
10195

10296
void Done() {
103-
// bthread_mutex_lock(&mutex_);
10497
if (done_) {
10598
braft::AsyncClosureGuard done_guard(done_);
10699
done_ = nullptr;
@@ -111,13 +104,11 @@ class DeferDone {
111104
DINGO_LOG(INFO) << "Deferred done_again closure_id=" << closure_id_ << " watch_key=" << watch_key_
112105
<< " cost: " << butil::gettimeofday_ms() - create_time_ << " ms, create_time: " << create_time_;
113106
}
114-
// bthread_mutex_unlock(&mutex_);
115107
}
116108

117109
private:
118110
uint64_t closure_id_;
119111
std::string watch_key_;
120-
bthread_mutex_t mutex_;
121112
google::protobuf::Closure *done_;
122113
pb::version::WatchResponse *response_;
123114
int64_t create_time_;

0 commit comments

Comments
 (0)