From c94682914db41ecbae90cb2924919cdbc8987af7 Mon Sep 17 00:00:00 2001 From: zhengran <191895710@qq.com> Date: Tue, 23 May 2017 14:25:08 +0800 Subject: [PATCH 1/3] change license (#893) --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index a4e856c6..b69c159d 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2014, Bluebore +Copyright (c) 2015, Baidu.inc All rights reserved. Redistribution and use in source and binary forms, with or without From e66b877c9bc543ec9cbbf24b3d081da0356e653e Mon Sep 17 00:00:00 2001 From: lpstudy Date: Fri, 16 Jun 2017 12:33:43 +0800 Subject: [PATCH 2/3] (#901) add a flag of chunkserver_disk_data_store_limit_percent in flags.cc correct some spell errors in flags.cc --- src/flags.cc | 5 +++-- src/nameserver/chunkserver_manager.cc | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/flags.cc b/src/flags.cc index 77d8102b..ccf9c71f 100644 --- a/src/flags.cc +++ b/src/flags.cc @@ -79,8 +79,9 @@ DEFINE_int32(chunkserver_file_cache_size, 1000, "Chunkserver file cache size"); DEFINE_int32(chunkserver_use_root_partition, 1, "Should chunkserver use root partition, 0: forbidden"); 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_int32(chunkserver_disk_buf_size, 100, "Base number of buffers which are in the waiting list. Used to computer disk workload"); +DEFINE_int64(chunkserver_disk_safe_space, 5120, "If space left on a disk is less then this value, the disk will be considered full. In MB"); +DEFINE_int32(chunkserver_disk_data_store_limit_percent, 95, "If the percentage of data stored on a disk is larger than this value, the disk will be considered full. E.g. 95 means 95 percent"); // 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..47e42b3d 100644 --- a/src/nameserver/chunkserver_manager.cc +++ b/src/nameserver/chunkserver_manager.cc @@ -15,6 +15,7 @@ DECLARE_int32(keepalive_timeout); DECLARE_int32(chunkserver_max_pending_buffers); +DECLARE_int32(chunkserver_disk_data_store_limit_percent); DECLARE_int32(recover_speed); DECLARE_int32(recover_dest_limit); DECLARE_int32(heartbeat_interval); @@ -335,7 +336,9 @@ 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 > FLAGS_chunkserver_disk_data_store_limit_percent * 1.0 / 100 + || space_left < (5L << 30) + || pending_score > 1.0) { return 1.0; } return (data_score * data_score + pending_score) / 2; From 94bacd4fe77abf078b6afc47126f5293daa70007 Mon Sep 17 00:00:00 2001 From: lpstudy Date: Fri, 16 Jun 2017 17:24:03 +0800 Subject: [PATCH 3/3] (#901) small fix to avoid the conflict with the pull request of (remove magic number #900) --- src/nameserver/chunkserver_manager.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/nameserver/chunkserver_manager.cc b/src/nameserver/chunkserver_manager.cc index 47e42b3d..1a0c2a75 100644 --- a/src/nameserver/chunkserver_manager.cc +++ b/src/nameserver/chunkserver_manager.cc @@ -336,9 +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 > FLAGS_chunkserver_disk_data_store_limit_percent * 1.0 / 100 - || space_left < (5L << 30) - || pending_score > 1.0) { + if (data_score > FLAGS_chunkserver_disk_data_store_limit_percent * 1.0 / 100 || pending_score > 1.0 + || space_left < (5L << 30)) { return 1.0; } return (data_score * data_score + pending_score) / 2;