Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cHYoW-0006Cc-NL for pgsql-hackers@arkaria.postgresql.org; Thu, 15 Dec 2016 16:23:24 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cHYoV-000610-VR for pgsql-hackers@arkaria.postgresql.org; Thu, 15 Dec 2016 16:23:24 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cHYn7-0004Jv-0E for pgsql-hackers@postgresql.org; Thu, 15 Dec 2016 16:21:57 +0000 Received: from mx1.mailbox.org ([80.241.60.212]) by makus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1cHYn3-000136-2Z for pgsql-hackers@postgresql.org; Thu, 15 Dec 2016 16:21:55 +0000 Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.mailbox.org (Postfix) with ESMTPS id B74A74505F for ; Thu, 15 Dec 2016 17:21:49 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by gerste.heinlein-support.de (gerste.heinlein-support.de [91.198.250.173]) (amavisd-new, port 10030) with ESMTP id PqVZJHzfoP52 for ; Thu, 15 Dec 2016 17:21:33 +0100 (CET) From: Antonin Houska To: pgsql-hackers@postgresql.org Subject: Re: Slow I/O can break throttling of base backup In-reply-to: References: Comments: In-reply-to Magnus Hagander message dated "Thu, 15 Dec 2016 16:20:36 +0100." MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 15 Dec 2016 17:21:33 +0100 Message-ID: <10526.1481818893@localhost> X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org It seems to be my bug. I'll check tomorrow. Magnus Hagander wrote: > Running pg_basebackup with a throttling of say 10M runs it into the risk = of > the I/O on the server actually being slower than pg_basebackup (I have > preproduced similar issues on fake-slow disks with lower rate limits). >=20 > What happens in this case in basebackup.c is that the value for "sleep" > comes out negative. This means we don't sleep, which is fine. >=20 > However, that also means we don't set throttle_last. >=20 > That means that the next time we come around to throttle(), the value for > "elapsed" is even bigger, which results in an even bigger negative number, > and we're "stuck". >=20 > AFAICT this means that a temporary I/O spike that makes reading of the di= sk > too slow can leave us in a situation where we never recover, and thus nev= er > end up sleeping ever again, effectively turning off rate limiting. >=20 > I wonder if the else if (sleep > 0) at the bottom of throttle() should ju= st > be a simple else and always run, resetting last_throttle? >=20 > --=20 > Magnus Hagander > Me: http://www.hagander.net/ > Work: http://www.redpill-linpro.com/ >=20 --=20 Antonin Houska Cybertec Sch=C3=B6nig & Sch=C3=B6nig GmbH Gr=C3=B6hrm=C3=BChlgasse 26 A-2700 Wiener Neustadt Web: http://www.postgresql-support.de, http://www.cybertec.at --=20 Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers