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 d95c683e8e80cff2bff54856fd85e67045ebc741
Author: cjcchen <[email protected]>
AuthorDate: Sun Nov 23 08:48:00 2025 +0000

    add his
---
 .../ordering/cassandra/algorithm/cassandra.cpp     |  91 +++++++++----
 .../ordering/cassandra/algorithm/cassandra.h       |   2 +
 .../cassandra/algorithm/proposal_graph.cpp         | 142 ++++++++++++++++-----
 .../cassandra/algorithm/proposal_manager.cpp       |  17 ++-
 .../ordering/cassandra/proto/proposal.proto        |   2 +
 .../common/framework/performance_manager.cpp       |   2 +-
 platform/statistic/stats.cpp                       |   1 +
 scripts/deploy/config/cassandra.config             |   6 +-
 scripts/deploy/config/kv_performance_server_8.conf |  32 ++---
 scripts/deploy/performance/run_performance.sh      |   2 +-
 10 files changed, 213 insertions(+), 84 deletions(-)

diff --git a/platform/consensus/ordering/cassandra/algorithm/cassandra.cpp 
b/platform/consensus/ordering/cassandra/algorithm/cassandra.cpp
index 7887498c..832e00c0 100644
--- a/platform/consensus/ordering/cassandra/algorithm/cassandra.cpp
+++ b/platform/consensus/ordering/cassandra/algorithm/cassandra.cpp
@@ -17,7 +17,7 @@ Cassandra::Cassandra(int id, int f, int total_num, int 
block_size, SignatureVeri
   total_num_ = total_num;
   f_ = f;
   is_stop_ = false;
-  timeout_ms_ = 4000;
+  timeout_ms_ = 1000;
   //timeout_ms_ = 60000;
   local_txn_id_ = 1;
   local_proposal_id_ = 1;
@@ -131,35 +131,35 @@ void Cassandra::AsyncCommit() {
     int txn_num = 0;
     for (const Block& block : p->sub_block()) {
       std::unique_lock<std::mutex> lk(mutex_);
-      LOG(ERROR)<<"!!!!!!!!! commit proposal from:"
-        <<p->header().proposer_id()
-        <<"local id:"<<block.local_id();
+      //LOG(ERROR)<<"!!!!!!!!! commit proposal from:"
+      //  <<p->header().proposer_id()
+      //  <<"local id:"<<block.local_id();
       std::unique_ptr<Block> data_block =
           proposal_manager_->GetBlock(block.hash(), p->header().proposer_id());
       if(data_block == nullptr){
-      //  LOG(ERROR)<<"!!!!!!!!! proposal from:" <<p->header().proposer_id()
+       // LOG(ERROR)<<"!!!!!!!!! proposal from:" <<p->header().proposer_id()
        //   <<"local id:"<<block.local_id()
-        //  <<" has been committed";
+       //   <<" has been committed";
         //assert(1==0);
         continue;
       }
 
 
-      //LOG(ERROR)<<"!!!!!!!!! commit proposal from:"
-      //<<p->header().proposer_id()<<" txn size:"
-      //<<data_block->data().transaction_size()<<" 
height:"<<p->header().height()
-      //<<"local id:"<<block.local_id();
+      //LOG(ERROR)<<"!!!!!!!!! commit proposal from:" 
<<p->header().proposer_id()
+      //<<" txn size:" <<data_block->data().transaction_size()
+      //<<" height:"<<p->header().height()
+      //<<" local id:"<<block.local_id();
       auto it = committed.find(std::make_pair(p->header().proposer_id(), 
block.local_id()));
       if( it != committed.end()){
-        LOG(ERROR)<<"!!!!!!!!! proposal from:" <<p->header().proposer_id()
-          <<"local id:"<<block.local_id()
-          <<" has been committed";
+       // LOG(ERROR)<<"!!!!!!!!! proposal from:" <<p->header().proposer_id()
+        //  <<"local id:"<<block.local_id()
+         // <<" has been committed";
           assert(1==0);
           continue;
       }
       committed.insert(std::make_pair(p->header().proposer_id(), 
block.local_id()));
       
-    //LOG(ERROR)<<" txn size:"<<data_block->mutable_data()->transaction_size();
+      //LOG(ERROR)<<" txn 
size:"<<data_block->mutable_data()->transaction_size();
       for (Transaction& txn :
            *data_block->mutable_data()->mutable_transaction()) {
         txn.set_id(execute_id_++);
@@ -167,7 +167,7 @@ void Cassandra::AsyncCommit() {
         commit_(txn);
       }
     }
-    LOG(ERROR)<<" commit done:"<<txn_num;
+    LOG(ERROR)<<" commit done:"<<txn_num<<" 
proposer:"<<p->header().proposer_id()<<" height:"<<p->header().height();
     global_stats_->AddCommitTxn(txn_num);
   }
 
@@ -268,7 +268,7 @@ void Cassandra::BroadcastTxn() {
     global_stats_->AddCommitBlock(txns.size());
     std::unique_ptr<Block> block = proposal_manager_->MakeBlock(txns);
     assert(block != nullptr);
-    LOG(ERROR)<<" send block:"<<block->local_id();
+    //LOG(ERROR)<<" send block:"<<block->local_id()<<" batch 
size:"<<txns.size();;
     //Broadcast(MessageType::NewBlocks, *block);
     std::string hash = block->hash();
     int local_id = block->local_id();
@@ -403,7 +403,7 @@ void Cassandra::AskProposal(const Proposal& proposal, bool 
is_pre) {
     query.set_id(proposal.header().proposal_id());
     query.set_sender(id_);
   }
-  LOG(ERROR) << "ask proposal from:" << proposal.header().proposer_id();
+  //LOG(ERROR) << "ask proposal from:" << proposal.header().proposer_id();
   SendMessage(MessageType::CMD_ProposalQuery, query, 
proposal.header().proposer_id());
 }
 
@@ -429,9 +429,14 @@ void Cassandra::ReceiveProposalQueryResp(const 
ProposalQueryResp& resp) {
   proposal_manager_->VerifyProposal(resp);
 }
 
+
+bool Cassandra::Checklimit(int low, int hight, int proposer) {
+ return !(low <= proposer && proposer <= hight ) && low <= id_ && id_ <= hight;
+}
+
 bool Cassandra::ReceiveProposal(std::unique_ptr<Proposal> proposal) {
   {
-    LOG(ERROR)<<"recv proposal, height:"<<proposal->header().height()<<" block 
size:"<<proposal->block_size();
+    //LOG(ERROR)<<"recv proposal, height:"<<proposal->header().height()<<" 
block size:"<<proposal->block_size();
     std::unique_lock<std::mutex> lk(mutex_);
   
     for(const auto& block : proposal->block()){
@@ -464,13 +469,34 @@ bool Cassandra::ReceiveProposal(std::unique_ptr<Proposal> 
proposal) {
                  << " pre id:" << pre_p->header().proposal_id();
     }
 
-    if(proposal->header().height() >=20 && proposal->header().height() <120){
+  /*
+
+    if(proposal->header().height() >=250 && proposal->header().height() <300){
+      if(Checklimit(0, f_, proposal->header().proposer_id())
+          || Checklimit(f_+1, 2*f_,proposal->header().proposer_id())
+          || Checklimit(2*f_+1, 3*f_,proposal->header().proposer_id())
+          || Checklimit(3*f_+1, total_num_,proposal->header().proposer_id())){
+        return true;
+      }
+    }
+    */
+
+    if(proposal->header().height() >=150 && proposal->header().height() <200){
         if(!((proposal->header().proposer_id() <= 2*f_ && id_ <=2*f_)
         || (proposal->header().proposer_id() > 2*f_ && id_ >2*f_))) {
-        //if(proposal->header().proposer_id() % 2 != id_%2){
           return true;
         }
       }
+   
+
+   /*
+    if(proposal->header().height() >=250 && proposal->header().height() <350){
+        if(!((proposal->header().proposer_id() <= 2*f_+1 && id_ <=2*f_+1)
+        || (proposal->header().proposer_id() > 2*f_+1 && id_ >2*f_+1))) {
+          return true;
+        }
+      }
+      */
 
     /*
       if(proposal->header().height() >=200 && proposal->header().height() 
<205){
@@ -482,14 +508,27 @@ bool Cassandra::ReceiveProposal(std::unique_ptr<Proposal> 
proposal) {
       }
       */
 
+  /*
+    if(proposal->header().prehash().size()){
+      LOG(ERROR)<<" add pre proposal: 
height:"<<proposal->pre_p().header().height()<<" state:"<<proposal->pre_s();
+      //if(proposal->pre_s() == ProposalState::PoA) {
+        graph_->AddProposalOnly(proposal->pre_p());
+      //}
+    }
+    proposal->mutable_pre_p()->Clear();
+    */
+
     if (proposal->header().height() > graph_->GetCurrentHeight()) {
       future_proposal_[proposal->header().height()].push_back(
           std::move(proposal));
       return true;
     }
-    LOG(ERROR)<<" add proposal, height:"<<proposal->header().height()<<" 
proposer:"<<proposal->header().proposer_id() <<" id :"<<id_ <<" f:"<<f_; 
+    //LOG(ERROR)<<" add proposal, height:"<<proposal->header().height()<<" 
proposer:"<<proposal->header().proposer_id() <<" id :"<<id_ <<" f:"<<f_; 
+
+    
+
     AddProposal(*proposal);
-    LOG(ERROR)<<" add proposal done"; 
+    //LOG(ERROR)<<" add proposal done"; 
 
     auto it = future_proposal_.find(graph_->GetCurrentHeight());
     if (it != future_proposal_.end()) {
@@ -512,7 +551,9 @@ bool Cassandra::AddProposal(const Proposal& proposal) {
       AskProposal(proposal);
       //assert(1==0);
     }
-    return false;
+    else {
+      return false;
+    }
   }
 
   LOG(ERROR)<<" proposal blocks:"<<proposal.block_size();
@@ -537,7 +578,7 @@ bool Cassandra::AddProposal(const Proposal& proposal) {
   }
 
 
-  {
+    {
     std::unique_lock<std::mutex> lk(g_mutex_);
      //LOG(ERROR) << "add proposal to graph";
     int v_ret = graph_->AddProposal(proposal);
@@ -571,7 +612,7 @@ bool Cassandra::AddProposal(const Proposal& proposal) {
       //LOG(ERROR) << "can vote:";
     }
   }
-   //LOG(ERROR)<<"recv done";
+   LOG(ERROR)<<"recv done";
 
   std::vector<std::unique_ptr<Proposal>> future_g = graph_->GetNotFound(
       proposal.header().height() + 1, proposal.header().hash());
diff --git a/platform/consensus/ordering/cassandra/algorithm/cassandra.h 
b/platform/consensus/ordering/cassandra/algorithm/cassandra.h
index 3464db7f..ed2762c4 100644
--- a/platform/consensus/ordering/cassandra/algorithm/cassandra.h
+++ b/platform/consensus/ordering/cassandra/algorithm/cassandra.h
@@ -69,6 +69,8 @@ class Cassandra: public common::ProtocolBase {
 
   bool ProcessProposal(std::unique_ptr<Proposal> proposal);
 
+  bool Checklimit(int low, int hight, int proposer);
+
  private:
   std::unique_ptr<ProposalGraph> graph_;
   LockFreeQueue<Transaction> txns_;
diff --git a/platform/consensus/ordering/cassandra/algorithm/proposal_graph.cpp 
b/platform/consensus/ordering/cassandra/algorithm/proposal_graph.cpp
index a370b2de..df8ccb42 100644
--- a/platform/consensus/ordering/cassandra/algorithm/proposal_graph.cpp
+++ b/platform/consensus/ordering/cassandra/algorithm/proposal_graph.cpp
@@ -71,6 +71,25 @@ int ProposalGraph::AddProposal(const Proposal& proposal) {
    LOG(ERROR) << "add proposal height:" << proposal.header().height()
              << " current height:" << current_height_<<" 
from:"<<proposal.header().proposer_id()<<" proposal 
id:"<<proposal.header().proposal_id();
   assert(current_height_ >= latest_commit_.header().height());
+
+  {
+    int cur_h = proposal.header().height();
+    for(int i = 0; i <3 && proposal.history_size()>=3; ++i){
+      const auto& sub_history = proposal.history(i);
+      std::string sub_hash = sub_history.hash();
+      auto sub_node_it = node_info_.find(sub_hash);
+      if(sub_node_it == node_info_.end()){
+        continue;
+      }
+      LOG(ERROR)<<" history node 
:"<<sub_node_it->second->proposal.header().proposer_id()
+        <<" height:"<<sub_node_it->second->proposal.header().height()
+        <<" hash:"<<sub_hash;
+      assert(cur_h == sub_node_it->second->proposal.header().height()+1);
+      cur_h--;
+    }
+  }
+
+
   /*
   if (proposal.header().height() < current_height_) {
     LOG(ERROR) << "height not match:" << current_height_
@@ -105,25 +124,28 @@ int ProposalGraph::AddProposal(const Proposal& proposal) {
   if (!VerifyParent(proposal)) {
     LOG(ERROR) << "verify parent fail:" << proposal.header().proposer_id()
                << " id:" << proposal.header().proposal_id();
+
+    g_[proposal.header().prehash()].push_back(proposal.header().hash());
+    auto np = std::make_unique<NodeInfo>(proposal);
+    //new_proposals_[proposal.header().hash()] = &np->proposal;
+    // LOG(ERROR)<<"add proposal proposer:"<<proposal.header().proposer_id()<<"
+    // id:"<<proposal.header().proposal_id()<<"
+    // hash:"<<Encode(proposal.header().hash());
+    node_info_[proposal.header().hash()] = std::move(np);
+    last_node_[proposal.header().height()].insert(proposal.header().hash());
+
     // assert(1==0);
     return 2;
   }
 
-   //LOG(ERROR)<<"history size:"<<proposal.history_size();
+  LOG(ERROR)<<"history size:"<<proposal.history_size();
+   /*
   for (const auto& history : proposal.history()) {
     std::string hash = history.hash();
     auto node_it = node_info_.find(hash);
     assert(node_it != node_info_.end());
-    /*
-    if (node_it == node_info_.end()) {
-      LOG(ERROR) << " history node not found";
-      return false;
-    }
-    else {
-      LOG(ERROR)<<"find history";
-    }
-    */
   }
+  */
 
   //LOG(ERROR)<<" proposal history:"<<proposal.history_size();
   if(proposal.history_size()>0){
@@ -149,18 +171,26 @@ int ProposalGraph::AddProposal(const Proposal& proposal) {
     }
 
     int num = 0;
+    int cur_h = proposal.header().height();
     for(int i = 0; i <3 && proposal.history_size()>=3; ++i){
       const auto& sub_history = proposal.history(i);
       std::string sub_hash = sub_history.hash();
       auto sub_node_it = node_info_.find(sub_hash);
-      //LOG(ERROR)<<" state:"<<node_it->second->state;
-      if (node_it->second->state != ProposalState::PoR) {
+      if(sub_node_it == node_info_.end()){
+        continue;
+      }
+      LOG(ERROR)<<" state:"<<sub_node_it->second->state<<" 
node:"<<sub_node_it->second->proposal.header().proposer_id()
+      <<" height:"<<sub_node_it->second->proposal.header().height();
+      assert(cur_h == sub_node_it->second->proposal.header().height()+1);
+      cur_h--;
+    // 
LOG(ERROR)<<"proposal:("<<node_it->second->proposal.header().proposer_id()
+      if (sub_node_it->second->state != ProposalState::PoR) {
         break;
       }
       num++;
     }
   
-    //LOG(ERROR)<<"get num:"<<num; 
+    LOG(ERROR)<<"get num:"<<num; 
     if(num == 3) {
       const auto& sub_history = proposal.history(2);
       std::string sub_hash = sub_history.hash();
@@ -219,9 +249,7 @@ int ProposalGraph::AddProposal(const Proposal& proposal) {
     g_[proposal.header().prehash()].push_back(proposal.header().hash());
     auto np = std::make_unique<NodeInfo>(proposal);
     //new_proposals_[proposal.header().hash()] = &np->proposal;
-    // LOG(ERROR)<<"add proposal proposer:"<<proposal.header().proposer_id()<<"
-    // id:"<<proposal.header().proposal_id()<<"
-    // hash:"<<Encode(proposal.header().hash());
+    LOG(ERROR)<<"add proposal proposer:"<<proposal.header().proposer_id()<<" 
id:"<<proposal.header().proposal_id()<<" 
hash:"<<Encode(proposal.header().hash());
     node_info_[proposal.header().hash()] = std::move(np);
     last_node_[proposal.header().height()].insert(proposal.header().hash());
   }
@@ -441,33 +469,46 @@ void ProposalGraph::UpdateHistory(Proposal* proposal) {
 
   for (int i = 0; i < 3 && !hash.empty(); ++i) {
     auto node_it = node_info_.find(hash);
+    if(node_it == node_info_.end()){
+      break;
+    }
     auto his = proposal->add_history();
     his->set_hash(hash);
     his->set_state(node_it->second->state);
     his->set_sender(node_it->second->proposal.header().proposer_id());
     his->set_id(node_it->second->proposal.header().proposal_id());
     hash = node_it->second->proposal.header().prehash();
+    LOG(ERROR)<<" get his 
proposer:"<<node_it->second->proposal.header().proposer_id()<<" 
height:"<<node_it->second->proposal.header().height();
   }
 }
 
 Proposal* ProposalGraph::GetStrongestProposal() {
-  // LOG(ERROR) << "get strong proposal from height:" << current_height_;
+  LOG(ERROR) << "get strong proposal from height:" << current_height_;
   if (last_node_.find(current_height_) == last_node_.end()) {
     LOG(ERROR) << "no data:" << current_height_;
     return nullptr;
   }
 
+  //LOG(ERROR)<<" node size:"<<last_node_[current_height_].size();
   NodeInfo* sp = nullptr;
   for (const auto& last_hash : last_node_[current_height_]) {
+    if(node_info_.find(last_hash) == node_info_.end()){
+      continue;
+    }
     NodeInfo* node_info = node_info_[last_hash].get();
+    assert(node_info->proposal.header().height() == current_height_);
     if (sp == nullptr || Compare(*sp, *node_info)) {
       sp = node_info;
     }
   }
+  assert(sp != nullptr);
 
   LOG(ERROR)<<" last node size:"<<last_node_[current_height_].size()<<" 
height:"<<current_height_<<" get strong 
from:"<<sp->proposal.header().proposer_id();
 
   for (const auto& last_hash : last_node_[current_height_]) {
+    if(node_info_.find(last_hash) == node_info_.end()){
+      continue;
+    }
     NodeInfo* node_info = node_info_[last_hash].get();
   //  LOG(ERROR)<<" node info:"<<node_info->proposal.header().proposer_id()<<" 
sub blocks:"<<node_info->proposal.sub_block_size();
 
@@ -475,7 +516,7 @@ Proposal* ProposalGraph::GetStrongestProposal() {
       continue;
     }
 
-//    LOG(ERROR)<<" node info:"<<node_info->proposal.header().proposer_id()<<" 
sub blocks:"<<node_info->proposal.sub_block_size()<<" node 
state:"<<node_info->state;
+    //LOG(ERROR)<<" node info:"<<node_info->proposal.header().proposer_id()<<" 
sub blocks:"<<node_info->proposal.sub_block_size()<<" node 
state:"<<node_info->state;
     if(node_info->state == ProposalState::PoR) {
       assert(node_info->proposal.header().proposer_id() == 
sp->proposal.header().proposer_id());
       for(auto sub_block : node_info->proposal.sub_block()){ 
@@ -485,7 +526,32 @@ Proposal* ProposalGraph::GetStrongestProposal() {
       }
       continue;
     }
-    
+
+    //LOG(ERROR)<<"get sub block size:"<<node_info->proposal.sub_block_size();
+    for(auto sub_block : node_info->proposal.sub_block()){ 
+      new_blocks_[sub_block.hash()] = sub_block;
+    }
+    //LOG(ERROR)<<" new blocks:"<<new_blocks_.size();
+
+
+    std::string pre_prehash = node_info->proposal.header().prehash();
+    if(node_info_.find(pre_prehash) != node_info_.end()){
+      NodeInfo* pre_node_info = node_info_[pre_prehash].get();
+      //LOG(ERROR)<<" pre node 
info:"<<pre_node_info->proposal.header().proposer_id()
+      //<<" pre node state:"<<pre_node_info->state;
+
+      if(pre_node_info->state == ProposalState::PoR 
+          && pre_node_info->proposal.header().proposer_id() == id_) {
+        for(auto sub_block : pre_node_info->proposal.sub_block()){ 
+          if(new_blocks_.find(sub_block.hash()) != new_blocks_.end()){
+            //LOG(ERROR)<<" remove new blocks:"<<sub_block.local_id(); 
+            new_blocks_.erase(new_blocks_.find(sub_block.hash()));
+          }
+        }
+      }
+    }
+
+    /*
     if(node_info->proposal.header().proposer_id() == 
sp->proposal.header().proposer_id()) {
       continue;
     }
@@ -493,16 +559,18 @@ Proposal* ProposalGraph::GetStrongestProposal() {
     if(sp == node_info) {
       continue;
     }
+    */
 
-//    LOG(ERROR)<<"get sub block size:"<<node_info->proposal.sub_block_size();
-    for(auto sub_block : node_info->proposal.sub_block()){ 
-      new_blocks_[sub_block.hash()] = sub_block;
+        /*
+    if(node_info_.find(last_hash) != node_info_.end()){
+      node_info_.erase(node_info_.find(last_hash));
     }
-    node_info_.erase(node_info_.find(last_hash));
+    */
   }
 
 
 
+  LOG(ERROR)<<" update his";
   UpdateHistory(&sp->proposal);
    //LOG(ERROR) << "get strong proposal from height:" << current_height_ << " 
->("
    //          << sp->proposal.header().proposer_id() << ","
@@ -537,14 +605,14 @@ int ProposalGraph::CompareState(const ProposalState& 
state1,
 
 // p1 < p2
 bool ProposalGraph::Compare(const NodeInfo& p1, const NodeInfo& p2) {
-  //LOG(ERROR) << "proposer:" << p1.proposal.header().proposer_id() << " "
-  //           << p2.proposal.header().proposer_id()
-  //          << "height:" << p1.proposal.header().height() << " "
-  //          << p2.proposal.header().height()
-  //          <<" state:"<< p1.state<<" "<<p2.state
-  //          <<" hash cmp:"<< (p1.proposal.header().hash() < 
p2.proposal.header().hash())
-  //          <<" cmp num:" << Cmp(p1.proposal.header().proposer_id(), 
p2.proposal.header().proposer_id())
-  //          <<" sub block:" << p1.proposal.sub_block_size() <<" "<< 
p2.proposal.sub_block_size();
+  LOG(ERROR) << "proposer:" << p1.proposal.header().proposer_id() << " "
+             << p2.proposal.header().proposer_id()
+            << "height:" << p1.proposal.header().height() << " "
+            << p2.proposal.header().height()
+            <<" state:"<< p1.state<<" "<<p2.state
+           <<" hash cmp:"<< (p1.proposal.header().hash() < 
p2.proposal.header().hash())
+           <<" cmp num:" << Cmp(p1.proposal.header().proposer_id(), 
p2.proposal.header().proposer_id())
+           <<" sub block:" << p1.proposal.sub_block_size() <<" "<< 
p2.proposal.sub_block_size();
   if (p1.proposal.header().height() != p2.proposal.header().height()) {
     return p1.proposal.header().height() < p2.proposal.header().height();
   }
@@ -554,10 +622,18 @@ bool ProposalGraph::Compare(const NodeInfo& p1, const 
NodeInfo& p2) {
     return CompareState(p1.state, p2.state) < 0;
   }
 
+  if(150<=p1.proposal.header().height()&&p1.proposal.header().height()<=250) {
+    int h = (p1.proposal.header().height())%2;
+    if ( h == 0) h = 2;
+    return abs(p1.proposal.header().proposer_id() - h ) > 
abs(p2.proposal.header().proposer_id() - h);
+  }
+
   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);
+  //LOG(ERROR)<<" check height :"<<h<<" 
cmp:"<<abs(p1.proposal.header().proposer_id() - h )<<" 
"<<abs(p2.proposal.header().proposer_id() - h);
+  //if (p1.proposal.header().height() <= 120 && 220 <= 
proposal.header().height()) {
+    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_manager.cpp 
b/platform/consensus/ordering/cassandra/algorithm/proposal_manager.cpp
index 289868d1..40a60bee 100644
--- a/platform/consensus/ordering/cassandra/algorithm/proposal_manager.cpp
+++ b/platform/consensus/ordering/cassandra/algorithm/proposal_manager.cpp
@@ -248,6 +248,11 @@ std::unique_ptr<Proposal> 
ProposalManager::GenerateProposal(int round,
 
     proposal->mutable_header()->set_prehash(last->header().hash());
     *proposal->mutable_history() = last->history();
+    //*proposal->mutable_pre_p() = *last;
+    //proposal->set_pre_s(graph_->GetProposalState(last->header().hash()));
+    //LOG(ERROR) << "get last proposal, proposer:" << 
last->header().proposer_id()
+               //<< " id:" << last->header().proposal_id()
+               //<<" add pre_s:"<<proposal->pre_s();
   }
 
   
@@ -256,8 +261,9 @@ std::unique_ptr<Proposal> 
ProposalManager::GenerateProposal(int round,
     for(auto block : ps) {
       auto sub_block = proposal->add_sub_block();
       *sub_block = block;
+      //LOG(ERROR)<<" proposal sub block:"<<sub_block->local_id()<<" txn 
size:"<<sub_block->data().transaction_size();
     }
-    //LOG(ERROR)<<" proposal sub block size:"<<proposal->sub_block_size();
+    LOG(ERROR)<<" proposal sub block size:"<<proposal->sub_block_size();
   }
 
   proposal->mutable_header()->set_proposer_id(id_);
@@ -409,9 +415,10 @@ int ProposalManager::VerifyProposal(const 
ProposalQueryResp& resp) {
   }
 
   tmp_proposal_.clear();
+  return 0;
 
   for (const Proposal& p : resp.proposal()) {
-    LOG(ERROR)<<"verify resp proposal proposer:"<<p.header().proposer_id()<<" 
id:"<<p.header().proposal_id();
+    //LOG(ERROR)<<"verify resp proposal 
proposer:"<<p.header().proposer_id()<<" id:"<<p.header().proposal_id();
     if (list.find(std::make_pair(p.header().height(),
                                  p.header().proposer_id())) != list.end()) {
       continue;
@@ -424,11 +431,11 @@ int ProposalManager::VerifyProposal(const 
ProposalQueryResp& resp) {
   while (!list.empty()) {
     auto it = list.begin();
     int ret = VerifyProposalHistory(it->second.get());
-     LOG(ERROR)<<"verify propser:"<<it->second->header().proposer_id()<<" 
height:"<<it->second->header().height()<<" ret:"<<ret;
+     //LOG(ERROR)<<"verify propser:"<<it->second->header().proposer_id()<<" 
height:"<<it->second->header().height()<<" ret:"<<ret;
     if (ret == 0) {
       ReleaseTmpProposal(*it->second);
-        LOG(ERROR)<<"proposal from:"<<it->second->header().proposer_id()
-       <<" id:"<<it->second->header().proposal_id()<<" activate";
+        //LOG(ERROR)<<"proposal from:"<<it->second->header().proposer_id()
+       //<<" id:"<<it->second->header().proposal_id()<<" activate";
     } else {
       fail_list.push_back(std::move(it->second));
     }
diff --git a/platform/consensus/ordering/cassandra/proto/proposal.proto 
b/platform/consensus/ordering/cassandra/proto/proposal.proto
index 72da476e..38d45522 100644
--- a/platform/consensus/ordering/cassandra/proto/proposal.proto
+++ b/platform/consensus/ordering/cassandra/proto/proposal.proto
@@ -37,6 +37,8 @@ message Proposal {
   uint64 create_time = 5;
   repeated Block block = 6;
   repeated Block sub_block = 8;
+  Proposal pre_p = 9;
+  optional int32 pre_s = 10;
 };
 
 enum MessageType {
diff --git 
a/platform/consensus/ordering/common/framework/performance_manager.cpp 
b/platform/consensus/ordering/common/framework/performance_manager.cpp
index cfc99add..6bf02c2c 100644
--- a/platform/consensus/ordering/common/framework/performance_manager.cpp
+++ b/platform/consensus/ordering/common/framework/performance_manager.cpp
@@ -93,7 +93,7 @@ int PerformanceManager::StartEval() {
     return 0;
   }
   eval_started_ = true;
-  for (int i = 0; i < 20000000; ++i) {
+  for (int i = 0; i < 60000000; ++i) {
     // for (int i = 0; i < 60000000000; ++i) {
     std::unique_ptr<QueueItem> queue_item = std::make_unique<QueueItem>();
     queue_item->context = nullptr;
diff --git a/platform/statistic/stats.cpp b/platform/statistic/stats.cpp
index 447d3dd2..7d611e10 100644
--- a/platform/statistic/stats.cpp
+++ b/platform/statistic/stats.cpp
@@ -165,6 +165,7 @@ void Stats::MonitorGlobal() {
   uint64_t last_block_size_num = 0, last_block_size = 0;
 
   while (!stop_) {
+  monitor_sleep_time_ = 1;
     sleep(monitor_sleep_time_);
     time += monitor_sleep_time_;
     seq_fail = seq_fail_;
diff --git a/scripts/deploy/config/cassandra.config 
b/scripts/deploy/config/cassandra.config
index 55cc6bf9..4701738f 100644
--- a/scripts/deploy/config/cassandra.config
+++ b/scripts/deploy/config/cassandra.config
@@ -1,11 +1,11 @@
 {
-  "clientBatchNum": 400,
+  "clientBatchNum": 100,
   "enable_viewchange": false,
   "recovery_enabled": false,
   "max_client_complaint_num":10,
-  "max_process_txn": 20192,
+  "max_process_txn": 8196,
   "worker_num": 10,
   "input_worker_num": 1,
   "output_worker_num": 5,
-  "block_size":20
+  "block_size":50
 }
diff --git a/scripts/deploy/config/kv_performance_server_8.conf 
b/scripts/deploy/config/kv_performance_server_8.conf
index a533383f..6ab634bf 100644
--- a/scripts/deploy/config/kv_performance_server_8.conf
+++ b/scripts/deploy/config/kv_performance_server_8.conf
@@ -1,20 +1,20 @@
 iplist=(
-172.31.28.28
-172.31.22.26
-172.31.17.27
-172.31.30.152
-172.31.20.25
-172.31.27.20
-172.31.21.22
-172.31.17.146
-172.31.16.147
-172.31.19.13
-172.31.20.141
-172.31.20.10
-172.31.16.141
-172.31.28.6
-172.31.18.137
-172.31.19.5
+172.31.18.66
+172.31.27.193
+172.31.27.153
+172.31.16.133
+172.31.31.76
+172.31.17.121
+172.31.24.63
+172.31.20.159
+172.31.25.33
+172.31.19.32
+172.31.30.103
+172.31.31.166
+172.31.30.230
+172.31.16.98
+172.31.18.177
+172.31.20.176
 )
 
 key=~/.ssh/junchao.pem
diff --git a/scripts/deploy/performance/run_performance.sh 
b/scripts/deploy/performance/run_performance.sh
index dfaab869..d1b9c22a 100755
--- a/scripts/deploy/performance/run_performance.sh
+++ b/scripts/deploy/performance/run_performance.sh
@@ -21,7 +21,7 @@ echo "get cofigfile:"$config_file
 ${BAZEL_WORKSPACE_PATH}/bazel-bin/benchmark/protocols/pbft/kv_service_tools 
$config_file
 done
 
-sleep 420
+sleep 120
 
 echo "benchmark done"
 count=1

Reply via email to