From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id E82992EABA for ; Mon, 3 Dec 2018 15:34:19 -0500 (EST) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TClfH1QnSooD for ; Mon, 3 Dec 2018 15:34:19 -0500 (EST) Received: from smtp44.i.mail.ru (smtp44.i.mail.ru [94.100.177.104]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id A4D282DDDE for ; Mon, 3 Dec 2018 15:34:19 -0500 (EST) Received: from [185.6.245.178] (port=54806 helo=atlas.local) by smtp44.i.mail.ru with esmtpa (envelope-from ) id 1gTuv4-0004ae-3k for tarantool-patches@freelists.org; Mon, 03 Dec 2018 23:34:18 +0300 Date: Mon, 3 Dec 2018 23:34:17 +0300 From: Konstantin Osipov Subject: [tarantool-patches] Re: [PATCH 9/9] wal: trigger checkpoint if there are too many WALs Message-ID: <20181203203417.GI2890@chai> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: tarantool-patches@freelists.org * Vladimir Davydov [18/11/28 19:16]: Please avoid using 0 for infinity: Tarantool doesn't use 0 to mean anything special. > Closes #1082 > > @TarantoolBot document > Title: Document box.cfg.checkpoint_wal_threshold Please document the default value of the new variable. Please add checks for the range of valid values of the new variable, as well as tests for these. > + int64_t checkpoint_wal_size; > + /** > + * If greater than 0 Ugh. > + , this variable sets a limit on the > + * total size of WAL files written since the last checkpoint. > + * Exceeding it will trigger auto checkpointing in tx. > + */ > + int64_t checkpoint_threshold; > + bool checkpoint_threshold_signalled; > + bool checkpoint_threshold_exceeded; If you had the checkpoint object wit hall the messages in the wal writer signleton, then the entire checkpoint state, including this variable, could be easily observed in a single place. Now that I see this flag I'm more inclined to insist on having a singleton wal_checkpoint object, inside struct wal_writer or standalone. > +void > +wal_set_checkpoint_threshold(int64_t checkpoint_threshold) > +{ > + struct wal_writer *writer = &wal_writer_singleton; > + if (writer->wal_mode == WAL_NONE) > + return; > + struct wal_set_checkpoint_threshold_msg msg; > + msg.checkpoint_threshold = checkpoint_threshold; > + bool cancellable = fiber_set_cancellable(false); > + cbus_call(&wal_thread.wal_pipe, &wal_thread.tx_prio_pipe, > + &msg.base, wal_set_checkpoint_threshold_f, NULL, > + TIMEOUT_INFINITY); > + fiber_set_cancellable(cancellable); > +} Please add a comment explaining that WAL_NONE is also set when wal is not yet initialized. I don't see where you calculate the value of the variable upon server start. Did I miss this hunk? -- Konstantin Osipov, Moscow, Russia, +7 903 626 22 32 http://tarantool.io - www.twitter.com/kostja_osipov