|
|
@ -406,14 +406,14 @@ BatchReq::~BatchReq() { |
|
|
|
void BatchReq::ConstructBatch(WriteBatch &KVBatch,WriteBatch &IndexBatch, |
|
|
|
WriteBatch &MetaBatch,fielddb::FieldDB *DB,std::unordered_set<std::string> &batchKeySet) |
|
|
|
{ |
|
|
|
// WriteBatch Sub_KVBatch,Sub_IndexBatch,Sub_MetaBatch;
|
|
|
|
WriteBatch Sub_KVBatch,Sub_IndexBatch,Sub_MetaBatch; |
|
|
|
std::unordered_set<std::string> 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_; |
|
|
|
} |
|
|
|
|
|
|
|