浏览代码

之前改错了一部分

pull/2/head
cyq 8 个月前
父节点
当前提交
37721f31fe
共有 1 个文件被更改,包括 14 次插入14 次删除
  1. +14
    -14
      fielddb/request.cpp

+ 14
- 14
fielddb/request.cpp 查看文件

@ -406,14 +406,14 @@ BatchReq::~BatchReq() {
void BatchReq::ConstructBatch(WriteBatch &KVBatch,WriteBatch &IndexBatch, void BatchReq::ConstructBatch(WriteBatch &KVBatch,WriteBatch &IndexBatch,
WriteBatch &MetaBatch,fielddb::FieldDB *DB,std::unordered_set<std::string> &batchKeySet) 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; std::unordered_set<std::string> Sub_batchKeySet;
//由于batch是有顺序的,根据我们现在的一个key只处理最开始的算法,这里需要反向迭代 //由于batch是有顺序的,根据我们现在的一个key只处理最开始的算法,这里需要反向迭代
uint64_t start_ = DB->env_->NowMicros(); uint64_t start_ = DB->env_->NowMicros();
for(auto subreq = sub_requests.rbegin(); subreq != sub_requests.rend(); subreq++ ) { for(auto subreq = sub_requests.rbegin(); subreq != sub_requests.rend(); subreq++ ) {
uint64_t start_sub = DB->env_->NowMicros(); 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->construct_BatchReq_perSub_elapsed += DB->env_->NowMicros() - start_sub;
DB->count_Batch_Sub ++; DB->count_Batch_Sub ++;
//所有的对于pendreq的调用传入的参数被改成了this->parent,因此,对于subrequests来说, //所有的对于pendreq的调用传入的参数被改成了this->parent,因此,对于subrequests来说,
@ -422,17 +422,17 @@ void BatchReq::ConstructBatch(WriteBatch &KVBatch,WriteBatch &IndexBatch,
return; 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_; DB->construct_BatchReq_elapsed += DB->env_->NowMicros() - start_;
} }

正在加载...
取消
保存