From 50a4c03babf0554ac48058e51cd9f6c086a41052 Mon Sep 17 00:00:00 2001 From: hrchu Date: Tue, 20 Sep 2016 05:56:58 +0000 Subject: [PATCH 1/3] fid size workaround for apache 2.x Apache doesn't return a Content-Length header for zero byte files. So we add a specific workaround for it. If it's not apache, we should still throw errors if that header is missing. --- lib/MogileFS/HTTPFile.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/MogileFS/HTTPFile.pm b/lib/MogileFS/HTTPFile.pm index f1734bc7..6f48cf9a 100644 --- a/lib/MogileFS/HTTPFile.pm +++ b/lib/MogileFS/HTTPFile.pm @@ -112,8 +112,8 @@ sub on_size_response { if ($res->is_success) { my $size = $res->header('content-length'); if (! defined $size && - $res->header('server') =~ m/^lighttpd/) { - # lighttpd 1.4.x (main release) does not return content-length for + $res->header('server') =~ m/^lighttpd|^Apache/) { + # lighttpd 1.4.x (main release) and apache 2.x does not return content-length for # 0 byte files. $self->{_size} = 0; return 0; From f5b53bb1c07ac5e0b46786d95a69528d8fea96cd Mon Sep 17 00:00:00 2001 From: hrchu Date: Tue, 20 Sep 2016 06:03:03 +0000 Subject: [PATCH 2/3] Be patient to let the rebalance test pass The original iteration value causes the rebalance test failure on some low level box. --- t/30-rebalance.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/30-rebalance.t b/t/30-rebalance.t index c6b6d990..ea309543 100644 --- a/t/30-rebalance.t +++ b/t/30-rebalance.t @@ -242,7 +242,7 @@ if ($res) { sleep 3; { - my $iters = 30; + my $iters = 60; my ($to_repl_rows, $to_queue_rows); while ($iters) { $iters--; From f6df39094c917c30abcb60ea7f3705f53b3c85e1 Mon Sep 17 00:00:00 2001 From: hrchu Date: Tue, 20 Sep 2016 06:11:23 +0000 Subject: [PATCH 3/3] Spread new writing file to more disks Mogilefs only consider space balance when allocates new file. The behavior causes cpu and io hotspot on new add disks, and is significant for a busy cluster. This modification try to take a more acceptable balance between space and cpu/io utilization. --- lib/MogileFS/Worker/Query.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/MogileFS/Worker/Query.pm b/lib/MogileFS/Worker/Query.pm index bde7f987..5bd3bcb4 100644 --- a/lib/MogileFS/Worker/Query.pm +++ b/lib/MogileFS/Worker/Query.pm @@ -361,7 +361,7 @@ sub sort_devs_by_freespace { } @_; my @list = - MogileFS::Util::weighted_list(splice(@devices_with_weights, 0, 20)); + MogileFS::Util::weighted_list(splice(@devices_with_weights, 0, 100)); return @list; }