This is an automated email from the ASF dual-hosted git repository. junchao pushed a commit to branch cassandra in repository https://gitbox.apache.org/repos/asf/incubator-resilientdb.git
commit 6263781ce7150c04ab233209d0e62db2f258f123 Author: cjcchen <[email protected]> AuthorDate: Wed Nov 5 00:29:29 2025 +0000 add --- benchmark/protocols/rcc/BUILD | 5 - .../ordering/cassandra/algorithm/cassandra.cpp | 31 +--- .../cassandra/algorithm/proposal_graph.cpp | 24 +-- .../ordering/cassandra/algorithm/proposal_graph.h | 3 +- .../cassandra/algorithm/proposal_manager.cpp | 58 ------- .../ordering/cassandra/proto/proposal.proto | 1 - platform/consensus/ordering/rcc/algorithm/rcc.cpp | 2 +- .../consensus/ordering/tusk/algorithm/tusk.cpp | 4 +- scripts/deploy/config/cassandra.config | 2 +- .../deploy/config/kv_performance_server_16.conf | 64 +++---- .../deploy/config/kv_performance_server_32.conf | 128 +++++++------- .../deploy/config/kv_performance_server_48.conf | 192 ++++++++++----------- scripts/deploy/config/rcc.config | 2 +- scripts/deploy/config/tusk.config | 2 +- 14 files changed, 206 insertions(+), 312 deletions(-) diff --git a/benchmark/protocols/rcc/BUILD b/benchmark/protocols/rcc/BUILD index 6c1e9f4f..e760015e 100644 --- a/benchmark/protocols/rcc/BUILD +++ b/benchmark/protocols/rcc/BUILD @@ -12,11 +12,6 @@ cc_binary( "//platform/consensus/ordering/rcc/framework:consensus", "//service/utils:server_factory", ], - linkopts = [ - "-l:libprofiler.a", - "-pthread", - "-L/usr/local/lib" - ] ) cc_binary( diff --git a/platform/consensus/ordering/cassandra/algorithm/cassandra.cpp b/platform/consensus/ordering/cassandra/algorithm/cassandra.cpp index 1152ff0e..e4f0567b 100644 --- a/platform/consensus/ordering/cassandra/algorithm/cassandra.cpp +++ b/platform/consensus/ordering/cassandra/algorithm/cassandra.cpp @@ -30,7 +30,7 @@ Cassandra::Cassandra(int id, int f, int total_num, SignatureVerifier* verifier) precommitted_num_ = 0; execute_id_ = 1; - graph_ = std::make_unique<ProposalGraph>(f_, id); + graph_ = std::make_unique<ProposalGraph>(f_, id, total_num); proposal_manager_ = std::make_unique<ProposalManager>(id, graph_.get()); graph_->SetCommitCallBack( @@ -217,32 +217,6 @@ void Cassandra::AsyncPrepare() { prepare_(txn); } } - - // LOG(ERROR)<<" weak proposal:"<<p->weak_proposals().hash_size(); - for (const std::string& hash : p->weak_proposals().hash()) { - const Proposal* pre_p = graph_->GetProposalInfo(hash); - if (pre_p == nullptr) { - continue; - } - //LOG(ERROR)<<"prepare weak block from:"<<pre_p->header().proposer_id() - //<<" id:"<<pre_p->header().proposal_id(); - for (const Block& block : pre_p->block()) { - std::unique_lock<std::mutex> lkx(mutex_); - Block* data_block = proposal_manager_->GetBlockSnap( - block.hash(), pre_p->header().proposer_id()); - if (data_block == nullptr) { - continue; - } - - for (Transaction& txn : - *data_block->mutable_data()->mutable_transaction()) { - long long uid = (((long long)pre_p->header().proposer_id() << 50) | - (long long)(pre_p->header().proposal_id()) << 20 | id++); - txn.set_uid(uid); - prepare_(txn); - } - } - } //LOG(ERROR) << "prepare done"; } } @@ -392,8 +366,7 @@ int Cassandra::SendTxn(int round) { LOG(ERROR) << "====== bc proposal block size:" << proposal->block_size() << " round:" << round - << " id:" << proposal->header().proposal_id() - << " weak links:"<< proposal->weak_proposals().hash_size(); + << " id:" << proposal->header().proposal_id(); Broadcast(MessageType::NewProposal, *proposal); diff --git a/platform/consensus/ordering/cassandra/algorithm/proposal_graph.cpp b/platform/consensus/ordering/cassandra/algorithm/proposal_graph.cpp index 326ccea5..8f1101fb 100644 --- a/platform/consensus/ordering/cassandra/algorithm/proposal_graph.cpp +++ b/platform/consensus/ordering/cassandra/algorithm/proposal_graph.cpp @@ -18,7 +18,7 @@ std::vector<ProposalState> GetStates() { } */ -ProposalGraph::ProposalGraph(int fault_num, int id) : f_(fault_num),id_(id) { +ProposalGraph::ProposalGraph(int fault_num, int id, int total_num) : f_(fault_num),id_(id), total_num_(total_num) { ranking_ = std::make_unique<Ranking>(); current_height_ = 0; global_stats_ = Stats::GetGlobalStats(); @@ -311,22 +311,6 @@ void ProposalGraph::Commit(const std::string& hash) { } commit_p.back().push_back(p); - //LOG(ERROR)<<"commit node:"<<p->header().proposer_id()<<" id:"<<p->header().proposal_id() - //<<" weak proposal size:"<<p->weak_proposals().hash_size(); - //LOG(ERROR)<<"push p:"<<p->header().proposer_id(); - for (const std::string& w_hash : p->weak_proposals().hash()) { - assert(1==0); - auto it = node_info_.find(w_hash); - if (it == node_info_.end()) { - LOG(ERROR) << "node not found, hash:"; - assert(1 == 0); - } - - // LOG(ERROR)<<"add weak - // proposal:"<<it->second->proposal.header().proposer_id()<<" - // id:"<<it->second->proposal.header().proposal_id(); - q.push(w_hash); - } if (!p->header().prehash().empty()) { q.push(p->header().prehash()); } @@ -534,10 +518,10 @@ bool ProposalGraph::Compare(const NodeInfo& p1, const NodeInfo& p2) { return CompareState(p1.state, p2.state) < 0; } - int h = (p1.proposal.header().height())%64; - if ( h == 0) h = 64; + int h = (p1.proposal.header().height())%total_num_; + if ( h == 0) h = total_num_; //LOG(ERROR)<<" check height cmp:"<<abs(p1.proposal.header().proposer_id() - h )<<" "<<abs(p2.proposal.header().proposer_id() - h); - //return abs(p1.proposal.header().proposer_id() - h ) > abs(p2.proposal.header().proposer_id() - h); + return abs(p1.proposal.header().proposer_id() - h ) > abs(p2.proposal.header().proposer_id() - h); if (abs(p1.proposal.sub_block_size() - p2.proposal.sub_block_size()) > 5) { //return p1.proposal.sub_block_size() < p2.proposal.sub_block_size(); diff --git a/platform/consensus/ordering/cassandra/algorithm/proposal_graph.h b/platform/consensus/ordering/cassandra/algorithm/proposal_graph.h index 696c4890..acd47845 100644 --- a/platform/consensus/ordering/cassandra/algorithm/proposal_graph.h +++ b/platform/consensus/ordering/cassandra/algorithm/proposal_graph.h @@ -13,7 +13,7 @@ namespace cassandra_recv { class ProposalGraph { public: - ProposalGraph(int fault_num, int id); + ProposalGraph(int fault_num, int id,int total_num); inline void SetCommitCallBack(std::function<void(const Proposal&)> func) { commit_callback_ = func; } @@ -83,6 +83,7 @@ class ProposalGraph { Stats* global_stats_; int id_; std::map<std::string, Block> new_blocks_; + int total_num_; }; } // namespace cassandra_recv diff --git a/platform/consensus/ordering/cassandra/algorithm/proposal_manager.cpp b/platform/consensus/ordering/cassandra/algorithm/proposal_manager.cpp index d887ff20..aa6fcf25 100644 --- a/platform/consensus/ordering/cassandra/algorithm/proposal_manager.cpp +++ b/platform/consensus/ordering/cassandra/algorithm/proposal_manager.cpp @@ -246,28 +246,6 @@ std::unique_ptr<Proposal> ProposalManager::GenerateProposal(int round, //LOG(ERROR)<<" proposal sub block size:"<<proposal->sub_block_size(); } - { - std::vector<Proposal*> ps = graph_->GetNewProposals(round); - //LOG(ERROR)<<"get weak p from round:"<<round<<" size:"<<ps.size(); - for (Proposal* p : ps) { - if (p->header().height() >= round) { - LOG(ERROR) << "round invalid:" << round - << " header:" << p->header().height(); - } - assert(p->header().height() < round); - - if (p->header().hash() == last->header().hash()) { - continue; - } - if(p->header().proposer_id() != id_){ - continue; - } - LOG(ERROR)<<"add weak p:"<<p->header().height()<<" proposer:"<<p->header().proposer_id()<<" height:"<<p->header().height(); - *proposal->mutable_weak_proposals()->add_hash() = p->header().hash(); - data += p->header().hash(); - } - } - proposal->mutable_header()->set_proposer_id(id_); proposal->mutable_header()->set_proposal_id(local_proposal_id_++); data += std::to_string(proposal->header().proposal_id()) + @@ -309,27 +287,6 @@ void ProposalManager::ObtainHistoryProposal(const Proposal* p, ObtainHistoryProposal(next_p, v, resp, current_height); resp.push_back(next_p); } - - for (const std::string& hash : p->weak_proposals().hash()) { - const Proposal* next_p = graph_->GetProposalInfo(hash); - assert(next_p != nullptr); - int height = next_p->header().height(); - // LOG(ERROR)<<"ask height:"<<current_height<<" current height:"<<height; - if (current_height - height > 5) { - return; - } - if (v.find(std::make_pair(next_p->header().proposer_id(), - next_p->header().proposal_id())) != v.end()) { - return; - } - v.insert(std::make_pair(next_p->header().proposer_id(), - next_p->header().proposal_id())); - // LOG(ERROR)<<"Obtain height:"<<height<<" - // proposer:"<<next_p->header().proposer_id()<<" - // id:"<<next_p->header().proposal_id(); - ObtainHistoryProposal(next_p, v, resp, current_height); - resp.push_back(next_p); - } } int ProposalManager::VerifyProposalHistory(const Proposal* p) { @@ -353,21 +310,6 @@ int ProposalManager::VerifyProposalHistory(const Proposal* p) { } } - for (const std::string& hash : p->weak_proposals().hash()) { - const Proposal* next_p = graph_->GetProposalInfo(hash); - if (next_p != nullptr) { - continue; - } - if (tmp_proposal_.find(hash) == tmp_proposal_.end()) { - LOG(ERROR) << "weak not found"; - return 3; - } - ret = 1; - auto& it = tmp_proposal_[hash]; - assert(it != nullptr); - LOG(ERROR) << "Find weak in tmp:" << it->header().proposer_id() - << " id:" << it->header().proposal_id(); - } return ret; } diff --git a/platform/consensus/ordering/cassandra/proto/proposal.proto b/platform/consensus/ordering/cassandra/proto/proposal.proto index 644d5fa7..ce9cceed 100644 --- a/platform/consensus/ordering/cassandra/proto/proposal.proto +++ b/platform/consensus/ordering/cassandra/proto/proposal.proto @@ -40,7 +40,6 @@ message Proposal { repeated Transaction transactions = 4; uint64 create_time = 5; repeated Block block = 6; - WeakProposal weak_proposals = 7; repeated Block sub_block = 8; }; diff --git a/platform/consensus/ordering/rcc/algorithm/rcc.cpp b/platform/consensus/ordering/rcc/algorithm/rcc.cpp index 47f3094b..adfbe4c8 100644 --- a/platform/consensus/ordering/rcc/algorithm/rcc.cpp +++ b/platform/consensus/ordering/rcc/algorithm/rcc.cpp @@ -142,7 +142,7 @@ bool RCC::ReceiveTransaction(std::unique_ptr<Transaction> txn) { void RCC::AsyncSend() { - int limit = 2; + int limit = 8; bool start = false; int64_t last_time = 0; diff --git a/platform/consensus/ordering/tusk/algorithm/tusk.cpp b/platform/consensus/ordering/tusk/algorithm/tusk.cpp index 0156e38f..05c863cb 100644 --- a/platform/consensus/ordering/tusk/algorithm/tusk.cpp +++ b/platform/consensus/ordering/tusk/algorithm/tusk.cpp @@ -10,7 +10,7 @@ namespace tusk { Tusk::Tusk(int id, int f, int total_num, SignatureVerifier* verifier) : ProtocolBase(id, f, total_num), verifier_(verifier) { limit_count_ = 2 * f + 1; - batch_size_ = 10; + batch_size_ = 15; proposal_manager_ = std::make_unique<ProposalManager>(id, limit_count_); execute_id_ = 1; @@ -80,7 +80,7 @@ void Tusk::AsyncSend() { for (int i = 1; i < batch_size_; ++i) { auto txn = txns_.Pop(10); if (txn == nullptr) { - continue; + //continue; break; } txn->set_queuing_time(GetCurrentTime() - txn->create_time()); diff --git a/scripts/deploy/config/cassandra.config b/scripts/deploy/config/cassandra.config index 645ba9bf..b355a926 100644 --- a/scripts/deploy/config/cassandra.config +++ b/scripts/deploy/config/cassandra.config @@ -3,7 +3,7 @@ "enable_viewchange": false, "recovery_enabled": false, "max_client_complaint_num":10, - "max_process_txn": 4096, + "max_process_txn": 1024, "worker_num": 10, "input_worker_num": 1, "output_worker_num": 5 diff --git a/scripts/deploy/config/kv_performance_server_16.conf b/scripts/deploy/config/kv_performance_server_16.conf index 1f6a31a0..5be5d4d0 100644 --- a/scripts/deploy/config/kv_performance_server_16.conf +++ b/scripts/deploy/config/kv_performance_server_16.conf @@ -1,36 +1,36 @@ iplist=( -172.31.45.163 -172.31.32.226 -172.31.41.104 -172.31.47.100 -172.31.42.174 -172.31.36.105 -172.31.47.113 -172.31.45.112 -172.31.42.121 -172.31.47.116 -172.31.45.187 -172.31.45.250 -172.31.47.192 -172.31.40.62 -172.31.41.198 -172.31.45.196 -172.31.37.160 -172.31.33.9 -172.31.37.136 -172.31.44.139 -172.31.36.138 -172.31.40.211 -172.31.36.209 -172.31.36.21 -172.31.38.85 -172.31.38.151 -172.31.32.87 -172.31.39.153 -172.31.42.217 -172.31.47.218 -172.31.34.90 -172.31.36.92 +172.31.84.234 +172.31.89.104 +172.31.87.227 +172.31.85.247 +172.31.81.246 +172.31.81.245 +172.31.89.181 +172.31.87.2 +172.31.84.187 +172.31.93.120 +172.31.80.120 +172.31.85.172 +172.31.89.44 +172.31.95.107 +172.31.80.43 +172.31.81.52 +172.31.90.52 +172.31.81.116 +172.31.86.51 +172.31.87.157 +172.31.90.219 +172.31.82.218 +172.31.91.25 +172.31.84.30 +172.31.82.78 +172.31.90.9 +172.31.81.200 +172.31.90.2 +172.31.94.151 +172.31.86.150 +172.31.87.19 +172.31.91.82 ) key=~/.ssh/junchao.pem diff --git a/scripts/deploy/config/kv_performance_server_32.conf b/scripts/deploy/config/kv_performance_server_32.conf index 58bfaf76..82c4c42e 100644 --- a/scripts/deploy/config/kv_performance_server_32.conf +++ b/scripts/deploy/config/kv_performance_server_32.conf @@ -1,68 +1,68 @@ iplist=( -172.31.81.8 -172.31.86.61 -172.31.84.9 -172.31.87.9 -172.31.95.18 -172.31.92.145 -172.31.81.89 -172.31.93.214 -172.31.80.26 -172.31.93.218 -172.31.95.29 -172.31.84.91 -172.31.89.162 -172.31.90.98 -172.31.83.165 -172.31.88.162 -172.31.85.40 -172.31.84.168 -172.31.82.239 -172.31.82.106 -172.31.85.51 -172.31.81.47 -172.31.88.182 -172.31.93.51 -172.31.83.55 -172.31.87.119 -172.31.89.185 -172.31.87.184 -172.31.83.58 -172.31.88.186 -172.31.89.189 -172.31.84.125 -172.31.88.196 -172.31.94.129 -172.31.95.251 -172.31.94.183 -172.31.82.74 -172.31.95.72 -172.31.88.136 -172.31.82.132 -172.31.95.15 -172.31.95.205 -172.31.93.75 -172.31.82.75 -172.31.83.220 -172.31.92.215 -172.31.83.21 -172.31.87.166 -172.31.95.228 -172.31.85.163 -172.31.80.225 -172.31.88.43 -172.31.91.107 -172.31.92.42 -172.31.89.105 -172.31.91.175 -172.31.94.238 -172.31.91.173 -172.31.94.237 -172.31.90.245 -172.31.92.52 -172.31.93.240 -172.31.82.48 -172.31.89.96 +172.31.84.234 +172.31.89.104 +172.31.87.227 +172.31.85.247 +172.31.81.246 +172.31.81.245 +172.31.89.181 +172.31.87.2 +172.31.84.187 +172.31.93.120 +172.31.80.120 +172.31.85.172 +172.31.89.44 +172.31.95.107 +172.31.80.43 +172.31.81.52 +172.31.90.52 +172.31.81.116 +172.31.86.51 +172.31.87.157 +172.31.90.219 +172.31.82.218 +172.31.91.25 +172.31.84.30 +172.31.82.78 +172.31.90.9 +172.31.81.200 +172.31.90.2 +172.31.94.151 +172.31.86.150 +172.31.87.19 +172.31.91.82 +172.31.22.34 +172.31.26.229 +172.31.30.227 +172.31.21.182 +172.31.23.53 +172.31.16.248 +172.31.26.247 +172.31.25.249 +172.31.22.121 +172.31.23.253 +172.31.20.185 +172.31.31.171 +172.31.20.40 +172.31.23.46 +172.31.31.110 +172.31.18.176 +172.31.28.111 +172.31.29.179 +172.31.31.115 +172.31.17.212 +172.31.24.148 +172.31.22.88 +172.31.24.152 +172.31.17.92 +172.31.28.194 +172.31.21.194 +172.31.26.6 +172.31.31.3 +172.31.30.201 +172.31.28.200 +172.31.20.205 +172.31.16.139 ) key=~/.ssh/junchao.pem diff --git a/scripts/deploy/config/kv_performance_server_48.conf b/scripts/deploy/config/kv_performance_server_48.conf index 335ea701..0e0d6ca7 100644 --- a/scripts/deploy/config/kv_performance_server_48.conf +++ b/scripts/deploy/config/kv_performance_server_48.conf @@ -1,100 +1,100 @@ iplist=( -172.31.45.163 -172.31.32.226 -172.31.41.104 -172.31.47.100 -172.31.42.174 -172.31.36.105 -172.31.47.113 -172.31.45.112 -172.31.42.121 -172.31.47.116 -172.31.45.187 -172.31.45.250 -172.31.47.192 -172.31.40.62 -172.31.41.198 -172.31.45.196 -172.31.37.160 -172.31.33.9 -172.31.37.136 -172.31.44.139 -172.31.36.138 -172.31.40.211 -172.31.36.209 -172.31.36.21 -172.31.38.85 -172.31.38.151 -172.31.32.87 -172.31.39.153 -172.31.42.217 -172.31.47.218 -172.31.34.90 -172.31.36.92 -172.31.44.96 -172.31.47.254 -172.31.40.126 -172.31.39.65 -172.31.45.195 -172.31.35.112 -172.31.47.242 -172.31.45.117 -172.31.32.119 -172.31.35.234 -172.31.45.106 -172.31.41.110 -172.31.42.238 -172.31.34.97 -172.31.35.97 -172.31.39.97 -172.31.34.99 -172.31.41.40 -172.31.44.168 -172.31.38.45 -172.31.40.48 -172.31.34.221 -172.31.33.222 -172.31.37.34 -172.31.34.34 -172.31.35.202 -172.31.37.85 -172.31.37.215 -172.31.36.217 -172.31.40.199 -172.31.36.201 -172.31.34.202 -172.31.41.202 -172.31.37.0 -172.31.46.129 -172.31.32.131 -172.31.46.5 -172.31.47.188 -172.31.34.189 -172.31.40.61 -172.31.47.190 -172.31.42.181 -172.31.37.56 -172.31.44.60 -172.31.42.60 -172.31.47.50 -172.31.36.51 -172.31.34.180 -172.31.42.180 -172.31.46.28 -172.31.46.156 -172.31.47.158 -172.31.34.22 -172.31.39.22 -172.31.38.153 -172.31.43.156 -172.31.44.9 -172.31.38.141 -172.31.40.17 -172.31.42.18 -172.31.40.134 -172.31.34.6 -172.31.33.135 -172.31.42.137 +172.31.84.234 +172.31.89.104 +172.31.87.227 +172.31.85.247 +172.31.81.246 +172.31.81.245 +172.31.89.181 +172.31.87.2 +172.31.84.187 +172.31.93.120 +172.31.80.120 +172.31.85.172 +172.31.89.44 +172.31.95.107 +172.31.80.43 +172.31.81.52 +172.31.90.52 +172.31.81.116 +172.31.86.51 +172.31.87.157 +172.31.90.219 +172.31.82.218 +172.31.91.25 +172.31.84.30 +172.31.82.78 +172.31.90.9 +172.31.81.200 +172.31.90.2 +172.31.94.151 +172.31.86.150 +172.31.87.19 +172.31.91.82 +172.31.22.34 +172.31.26.229 +172.31.30.227 +172.31.21.182 +172.31.23.53 +172.31.16.248 +172.31.26.247 +172.31.25.249 +172.31.22.121 +172.31.23.253 +172.31.20.185 +172.31.31.171 +172.31.20.40 +172.31.23.46 +172.31.31.110 +172.31.18.176 +172.31.28.111 +172.31.29.179 +172.31.31.115 +172.31.17.212 +172.31.24.148 +172.31.22.88 +172.31.24.152 +172.31.17.92 +172.31.28.194 +172.31.21.194 +172.31.26.6 +172.31.31.3 +172.31.30.201 +172.31.28.200 +172.31.20.205 +172.31.16.139 +172.31.81.238 +172.31.89.168 +172.31.88.168 +172.31.93.40 +172.31.95.100 +172.31.89.36 +172.31.89.225 +172.31.94.32 +172.31.85.249 +172.31.91.249 +172.31.87.57 +172.31.80.184 +172.31.82.242 +172.31.92.176 +172.31.83.112 +172.31.80.239 +172.31.88.8 +172.31.80.134 +172.31.80.198 +172.31.90.132 +172.31.81.130 +172.31.90.126 +172.31.80.126 +172.31.89.59 +172.31.94.95 +172.31.88.92 +172.31.94.90 +172.31.84.25 +172.31.80.85 +172.31.86.145 +172.31.94.78 +172.31.80.202 ) key=~/.ssh/junchao.pem diff --git a/scripts/deploy/config/rcc.config b/scripts/deploy/config/rcc.config index 985c7f80..67d0c8ca 100644 --- a/scripts/deploy/config/rcc.config +++ b/scripts/deploy/config/rcc.config @@ -3,7 +3,7 @@ "enable_viewchange": false, "recovery_enabled": false, "max_client_complaint_num":10, - "max_process_txn": 256, + "max_process_txn": 512, "worker_num": 30, "input_worker_num": 1, "output_worker_num": 10 diff --git a/scripts/deploy/config/tusk.config b/scripts/deploy/config/tusk.config index 80213d34..e378c5d0 100644 --- a/scripts/deploy/config/tusk.config +++ b/scripts/deploy/config/tusk.config @@ -3,7 +3,7 @@ "enable_viewchange": false, "recovery_enabled": false, "max_client_complaint_num":10, - "max_process_txn": 4096, + "max_process_txn": 512, "worker_num": 40, "input_worker_num": 1, "output_worker_num": 5
