Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nKbqF-0002Ms-0l for pgsql-hackers@arkaria.postgresql.org; Thu, 17 Feb 2022 08:08:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nKbqD-00013C-FT for pgsql-hackers@arkaria.postgresql.org; Thu, 17 Feb 2022 08:08:41 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nKbqD-000133-4P for pgsql-hackers@lists.postgresql.org; Thu, 17 Feb 2022 08:08:41 +0000 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nKbq9-0000QH-O1 for pgsql-hackers@lists.postgresql.org; Thu, 17 Feb 2022 08:08:40 +0000 Received: by mail-pl1-x62e.google.com with SMTP id 10so4042615plj.1 for ; Thu, 17 Feb 2022 00:08:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:message-id:to:cc:subject:from:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=KwumyqbwxCVJzrqMUCqPKiNBHSEvkab/BGs8rvQku94=; b=W7k3YvLV2NdZV+mbtphfR68oGqeeSm45x1LETwjXMEj02QZvb8p0pcHwalv9gDdeT5 oY5DsmqEW3zjqMiDJ8in6lPXhQ3GPksbSaUJ7UNYD0fur8uV8rbNSiUEHR1cmHVy5N6C mNGpJw10PxyYlROg/YXqJNZvTkd3v/UXAcEokK8ceYAVKsR9J+36xlICzsuTg0GllWJC 5heGyEVKf2G2fNHQAL0mWzv9Wa5yjDwkyt75B3NSzcPKrsX8mxoFEJAp0Ti6u8j04Nt7 xpyKlDEKF0QZT6KcxNomSUw70dkD1qsBqLpMUhT/7FDIP5vK18Q3mavf2vP4KDp2PdEr wP2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:message-id:to:cc:subject:from:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=KwumyqbwxCVJzrqMUCqPKiNBHSEvkab/BGs8rvQku94=; b=dEA0W8QD9ynfiVrgLOWucPXqUZ5vF/zWODp+shzfh2d/aPAY5pFUcUU9ZHnQ7Y7uQs NoyYlOXhAU3O0wLHiQotEaUZcFUhyfR4f/H5uLrsSfZyT8R1oHz+G5P0ftwOP+9Q+efo sdYXktByX9YRnpGNNwcZuCFKgjdxA/TmVi9uNqM0PtoCCJo3zHJdWJ/EH6NXJKJoOqtt hw7qM871+O9x1YMVp0QfR35EGOo35UUXdMk0wrwwxUD9AjY0jO15DcI0rtQckKa7hzES Pq21lQ4v+p9JFqfkHwtbAXbFk9mE6krnJ+VHlohXNUr9zmdQrypGuGYoQG4UwTVMpAj5 CtjQ== X-Gm-Message-State: AOAM530W+IBoGpT/ZIoKc7CrjObW7x9vxBv+uroKEAuG1Ux0bILKbyVC jlJTHP/uyfx9LrMOOYMtYDc= X-Google-Smtp-Source: ABdhPJwcgs9tSqdC5WPQunD93Lln+7IEdBK5O88x3b0MxqSVz0YoqmlNZDO9yK0AzebIHfT1jChWrg== X-Received: by 2002:a17:90a:d58a:b0:1b9:fe1e:403c with SMTP id v10-20020a17090ad58a00b001b9fe1e403cmr1899832pju.124.1645085315761; Thu, 17 Feb 2022 00:08:35 -0800 (PST) Received: from localhost (KD036014041111.ppp-bb.dion.ne.jp. [36.14.41.111]) by smtp.gmail.com with ESMTPSA id mm15sm636095pjb.46.2022.02.17.00.08.33 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 17 Feb 2022 00:08:35 -0800 (PST) Date: Thu, 17 Feb 2022 17:08:32 +0900 (JST) Message-Id: <20220217.170832.627054018291482509.horikyota.ntt@gmail.com> To: kuroda.hayato@fujitsu.com Cc: pgsql-hackers@lists.postgresql.org, Shinya11.Kato@oss.nttdata.com, zyu@yugabyte.com, masao.fujii@oss.nttdata.com Subject: Re: [Proposal] Add foreign-server health checks infrastructure From: Kyotaro Horiguchi In-Reply-To: References: <20220216.115058.1615761004338301624.horikyota.ntt@gmail.com> User-Agent: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, Kuroda-san. At Thu, 17 Feb 2022 04:11:09 +0000, "kuroda.hayato@fujitsu.com" wrote in > Dear Horiguchi-san, > > Thank you for giving your suggestions. I want to confirm your saying. > > > FWIW, I'm not sure this feature necessarily requires core support > > dedicated to FDWs. The core have USER_TIMEOUT feature already and > > FDWs are not necessarily connection based. It seems better if FDWs > > can implement health check feature without core support and it seems > > possible. Or at least the core feature should be more generic and > > simpler. Why don't we just expose InTransactionHealthCheckCallbacks or > > something and operating functions on it? > > I understood that core is too complicated and FDW side is too stupid, right? I don't think the FDW side is stupid but seem too complex for the benefit. And just think that maybe we don't need the core part. > > Mmm. AFAICS the running command will stop with "canceling statement > > due to user request", which is a hoax. We need a more decent message > > there. > > +1 about better messages. > > > I understand that the motive of this patch is "to avoid wasted long > > local work when fdw-connection dies". > > Yeah your understanding is right. > > > In regard to the workload in > > your first mail, it is easily avoided by ending the transaction as soon > > as remote access ends. This feature doesn't work for the case "begin; > > ; ". But the same measure also works in > > that case. So the only case where this feature is useful is "begin; > > ; ; ; end;". But in the first > > place how frequently do you expecting remote-connection close happens? > > If that happens so frequently, you might need to recheck the system > > health before implementing this feature. Since it is correctly > > detected when something really went wrong, I feel that it is a bit too > > complex for the usefulness especially for the core part. > > Thanks for analyzing motivation. > Indeed, some cases may be resolved by separating tx and this event rarely happens. > > > In conclusion, as my humble opinion I would like to propose to reduce > > this feature to: > > > > - Just periodically check health (in any aspect) of all live > > connections regardless of the session state. > > I understood here as removing following mechanism from core: > > * disable timeout at end of tx. > * skip if held off or read commands I think we're on the same page. Anyway query cancel interrupt is ignored while rading input. > > - If an existing connection is found to be dead, just try canceling > > the query (or sending query cancel). > > One issue with it is how to show the decent message for the query > > cancel, but maybe we can have a global variable that suggests the > > reason for the cancel. > > Currently I have no good idea for that but I'll try. However, I would like to hear others' opnions about the direction, of course. regards. -- Kyotaro Horiguchi NTT Open Source Software Center