-
Notifications
You must be signed in to change notification settings - Fork 555
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Concurrent load disk when cs starts #880 #882
base: master
Are you sure you want to change the base?
Conversation
@@ -20,16 +20,20 @@ class DataBlockTest : public ::testing::Test { | |||
protected: | |||
}; | |||
|
|||
void AddBlock(int64_t block_id, Disk* disk, BlockMeta meta) { | |||
void AdBlock(int64_t block_id, Disk* disk, BlockMeta meta) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
为啥删个字母?因为符号冲突了?
src/chunkserver/block_manager.cc
Outdated
// return value from Disk::LoadStorage: | ||
// 0: initial state, 1: done, -1: error occured | ||
std::vector<int> ret_vals; | ||
ret_vals.resize(disks_.size()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
能保证初始值是0不?
src/chunkserver/block_manager.cc
Outdated
@@ -165,15 +165,46 @@ int64_t BlockManager::DiskQuota() const { | |||
|
|||
// TODO: concurrent load |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO
// return value from Disk::LoadStorage: | ||
// 0: initial state, 1: done, -1: error occured | ||
std::vector<int> ret_vals; | ||
ret_vals.resize(disks_.size(), 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可以直接写成
std::vector ret_vals(disks_.size(), 0);
std::placeholders::_3)); | ||
disk_quota_ += disk->GetQuota(); | ||
std::placeholders::_3); | ||
tp.AddTask(std::bind(&Disk::LoadStorage, disk, callback, &(ret_vals[disk_index]))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
用不着这么多层括号吧, &ret_vals[disk_index]应该就是可以的
} | ||
bool ret = true; | ||
while (true) { | ||
sleep(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
感觉没必要上来就sleep一秒, 说不定已经完成了呢
sleep可以放循环的最后
(#880)