From 37721f31feca0fa3d588cce435dbf56674d95a8a Mon Sep 17 00:00:00 2001 From: cyq <1056374449@qq.com> Date: Sun, 29 Dec 2024 13:17:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B9=8B=E5=89=8D=E6=94=B9=E9=94=99=E4=BA=86?= =?UTF-8?q?=E4=B8=80=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fielddb/request.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/fielddb/request.cpp b/fielddb/request.cpp index ca83f70..b90470a 100644 --- a/fielddb/request.cpp +++ b/fielddb/request.cpp @@ -406,14 +406,14 @@ BatchReq::~BatchReq() { void BatchReq::ConstructBatch(WriteBatch &KVBatch,WriteBatch &IndexBatch, WriteBatch &MetaBatch,fielddb::FieldDB *DB,std::unordered_set &batchKeySet) { - // WriteBatch Sub_KVBatch,Sub_IndexBatch,Sub_MetaBatch; + WriteBatch Sub_KVBatch,Sub_IndexBatch,Sub_MetaBatch; std::unordered_set Sub_batchKeySet; //由于batch是有顺序的,根据我们现在的一个key只处理最开始的算法,这里需要反向迭代 uint64_t start_ = DB->env_->NowMicros(); for(auto subreq = sub_requests.rbegin(); subreq != sub_requests.rend(); subreq++ ) { uint64_t start_sub = DB->env_->NowMicros(); - // (*subreq)->ConstructBatch(Sub_KVBatch, Sub_IndexBatch, Sub_MetaBatch, DB, Sub_batchKeySet); - (*subreq)->ConstructBatch(KVBatch, IndexBatch, MetaBatch, DB, batchKeySet); + (*subreq)->ConstructBatch(Sub_KVBatch, Sub_IndexBatch, Sub_MetaBatch, DB, Sub_batchKeySet); + // (*subreq)->ConstructBatch(KVBatch, IndexBatch, MetaBatch, DB, batchKeySet); DB->construct_BatchReq_perSub_elapsed += DB->env_->NowMicros() - start_sub; DB->count_Batch_Sub ++; //所有的对于pendreq的调用传入的参数被改成了this->parent,因此,对于subrequests来说, @@ -422,17 +422,17 @@ void BatchReq::ConstructBatch(WriteBatch &KVBatch,WriteBatch &IndexBatch, return; } } - // DB->construct_BatchReq_Sub_elapsed += DB->env_->NowMicros() - start_; - // if(Sub_KVBatch.ApproximateSize() > 12) { - // KVBatch.Append(Sub_KVBatch); - // } - // if(Sub_IndexBatch.ApproximateSize() > 12) { - // IndexBatch.Append(Sub_IndexBatch); - // } - // if(Sub_MetaBatch.ApproximateSize() > 12) { - // MetaBatch.Append(Sub_MetaBatch); - // } - // batchKeySet.insert(Sub_batchKeySet.begin(),Sub_batchKeySet.end()); + DB->construct_BatchReq_Sub_elapsed += DB->env_->NowMicros() - start_; + if(Sub_KVBatch.ApproximateSize() > 12) { + KVBatch.Append(Sub_KVBatch); + } + if(Sub_IndexBatch.ApproximateSize() > 12) { + IndexBatch.Append(Sub_IndexBatch); + } + if(Sub_MetaBatch.ApproximateSize() > 12) { + MetaBatch.Append(Sub_MetaBatch); + } + batchKeySet.insert(Sub_batchKeySet.begin(),Sub_batchKeySet.end()); DB->construct_BatchReq_elapsed += DB->env_->NowMicros() - start_; }