diff --git a/src/.flags.cc.swo b/src/.flags.cc.swo new file mode 100644 index 00000000..4b7fca58 Binary files /dev/null and b/src/.flags.cc.swo differ diff --git a/src/.flags.cc.swp b/src/.flags.cc.swp new file mode 100644 index 00000000..e56121a0 Binary files /dev/null and b/src/.flags.cc.swp differ diff --git a/src/flags.cc b/src/flags.cc index 77d8102b..cc3b18d4 100644 --- a/src/flags.cc +++ b/src/flags.cc @@ -80,7 +80,8 @@ DEFINE_int32(chunkserver_use_root_partition, 1, "Should chunkserver use root par DEFINE_bool(chunkserver_multi_path_on_one_disk, false, "Allow multi data path on one disk"); DEFINE_bool(chunkserver_auto_clean, true, "If namespace version mismatch, chunkserver clean itself"); DEFINE_int32(chunkserver_disk_buf_size, 100, "Base number of buffers which are in the waiting list. Used to computer disk wordload"); -DEFINE_int64(chunkserver_disk_safe_space, 5120, "If space left on a disk is less then this value, the disk will be concidered full. In MB"); +DEFINE_int64(chunkserver_disk_safe_space, 5120, "If space left on a disk is less than this value, the disk will be considered full. In MB"); +DEFINE_int64(chunkserver_total_disk_safe_space, 5120, "If total space left of all disks on a chunkserver is less than this value, the chunkserver will be considered full. In MB"); // SDK DEFINE_string(sdk_write_mode, "fanout", "Sdk write strategy, choose from [chains, fanout]"); DEFINE_int32(sdk_thread_num, 10, "Sdk thread num"); diff --git a/src/nameserver/chunkserver_manager.cc b/src/nameserver/chunkserver_manager.cc index c5533fa1..3fd06ece 100644 --- a/src/nameserver/chunkserver_manager.cc +++ b/src/nameserver/chunkserver_manager.cc @@ -24,6 +24,7 @@ DECLARE_double(select_chunkserver_local_factor); DECLARE_int32(blockreport_interval); DECLARE_int32(blockreport_size); DECLARE_int32(expect_chunkserver_num); +DECLARE_int64(chunkserver_total_disk_safe_space); namespace baidu { namespace bfs { @@ -322,7 +323,7 @@ void ChunkServerManager::HandleHeartBeat(const HeartBeatRequest* request, HeartB void ChunkServerManager::ListChunkServers(::google::protobuf::RepeatedPtrField* chunkservers) { MutexLock lock(&mu_, "ListChunkServers", 10); for (ServerMap::iterator it = chunkservers_.begin(); - it != chunkservers_.end(); ++it) { + it != chunkservers_.end(); ++it) { ChunkServerInfo* src = it->second; ChunkServerInfo* dst = chunkservers->Add(); dst->CopyFrom(*src); @@ -335,7 +336,8 @@ double ChunkServerManager::GetChunkServerLoad(ChunkServerInfo* cs) { double data_score = cs->data_size() * 1.0 / cs->disk_quota(); int64_t space_left = cs->disk_quota() - cs->data_size(); - if (data_score > 0.95 || space_left < (5L << 30) || pending_score > 1.0) { + if (data_score > 0.95 || pending_score > 1.0 + || space_left < (FLAGS_chunkserver_total_disk_safe_space << 20)) { return 1.0; } return (data_score * data_score + pending_score) / 2;