Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1coV8n-0003jj-Nh for pgsql-admin@arkaria.postgresql.org; Thu, 16 Mar 2017 13:08:29 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1coV8n-0008Rc-5f for pgsql-admin@arkaria.postgresql.org; Thu, 16 Mar 2017 13:08:29 +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 1coV8m-0008RO-I9; Thu, 16 Mar 2017 13:08:28 +0000 Received: from mail-it0-x241.google.com ([2607:f8b0:4001:c0b::241]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1coV8e-0001ol-ND; Thu, 16 Mar 2017 13:08:27 +0000 Received: by mail-it0-x241.google.com with SMTP id u69so6628752ita.3; Thu, 16 Mar 2017 06:08:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:references:in-reply-to:subject:date:message-id :mime-version:content-transfer-encoding:thread-index :content-language; bh=KyLAW4dXcX4k5CXS8QzRcZ2gszSuHKj1H7GveNooaZw=; b=ee30CatC0i72wfps0NB/EPqqjUXX6hHM4+zmP2JGP+C96yZ5LMwHKozX0jxffbneT2 bSAEAAXufN61kGSu0kWTEOoir8zDmQgVD7/6IeUwdl1SzHu+kLVHyrl19QfgiWroLSg3 U/m1zxp4O/5CZE7RZm5D/MMkIwH55H4HoXW/Lz5zQchlT3H6z2wyPC9EIu7JgHFBT5yR 0BN94KWf0FHGIWl9pRx9Z79rGRmZUPxZbqGMh8jQ67zWU1adHZHWck3ceZ1tRESKsMiB Ud7YgDZkCIdwiglogXbeSs24qNssTVVp26KW0869cBCB8EC7TIG1k3+O+9cXl4Dy8bNw 842Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:references:in-reply-to:subject:date :message-id:mime-version:content-transfer-encoding:thread-index :content-language; bh=KyLAW4dXcX4k5CXS8QzRcZ2gszSuHKj1H7GveNooaZw=; b=f/bHg4Vbhw0hkWaYI3g6mDdZwX8iXNXakbu2/qkg/qYujwB8IOuzCQ7NGm1IodOFdC n+l+HVMkpo3CVG6pG20lesuzmx61z0BFKMI/MTaaSk9yxcaSBtU9VBYtj8hQx+/LWgY5 +sKgI2gb0q0pGFeomKaHrpsBM7iOIQna4s9l5CupG30ofybfSrshapNtCDsbe6uFdI1x 8cobKkjeXJhzemy1a+WuLl6O5IVIuUpRSMfNhQv0CfPZuzZWq2jRCVLSb0IxoQkovcCr ilpraykGbGJwNuGHMDxeVWKCtuNO91TdZsNufReMxtOLRkwN12LSAbEgjyFAA1DTV9MF sVGg== X-Gm-Message-State: AFeK/H209VhWLMvxtaqVffbZPqwwmOBY4wBEoG8kepEQAIx5UPYxjbwcZKh61Rat8slClw== X-Received: by 10.107.13.78 with SMTP id 75mr10645513ion.144.1489669699464; Thu, 16 Mar 2017 06:08:19 -0700 (PDT) Received: from irylachi ([200.55.161.75]) by smtp.gmail.com with ESMTPSA id b25sm2929456iod.32.2017.03.16.06.08.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 16 Mar 2017 06:08:18 -0700 (PDT) From: "Lazaro Garcia" To: "'vinny'" , "'Anushka Weerakkodyge'" Cc: , References: <3e84a1a05b8af81d76953df6eb2bf8fd@xs4all.nl> <49b839147b91280b4dc922985729e09c@xs4all.nl> In-Reply-To: <49b839147b91280b4dc922985729e09c@xs4all.nl> Subject: Re: How to Identify and Fail Transaction When Slave Node Down Date: Thu, 16 Mar 2017 09:08:14 -0400 Message-ID: <001b01d29e56$60966210$21c32630$@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 15.0 Thread-Index: AQFSaa/vWUPcMJZcdKENx2IVVnYhbwKpF8hZAiZ0N4kBx4O52QFmKp5oolfvYqA= Content-Language: es-mx X-Pg-Spam-Score: -2.5 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org When slave goes down, pgpool detects that and triggers a failover, then the master remains active and the slave are marked as down state. On the failover_command of pgpool, you could execute a command that drop the slave from the master synchronous_standby_names and reload the configuration on the master. By this way new transactions can be executed on the master without checking the state of the slave because synchronous replication has been disabled. If you recover the slave you can attach this server to master again an activate the synchronous replication. Regards. -----Mensaje original----- De: pgsql-admin-owner@postgresql.org [mailto:pgsql-admin-owner@postgresql.org] En nombre de vinny Enviado el: jueves, 16 de marzo de 2017 08:49 a. m. Para: Anushka Weerakkodyge CC: pgsql-admin@postgresql.org; pgsql-admin-owner@postgresql.org Asunto: Re: [ADMIN] How to Identify and Fail Transaction When Slave Node Down Although I see the logic of having a query timeout if it cannot be replicated, I don't think there is much point in having such a timeout because it still makes the master reject updates until you can solve the real problem: the slave has died and needs to be reanimated. Your monitoring should notice that the slave has gone down and act on it, before your users have time to pick up the phone. PgPool, for example, can monitor multiple servers and reconfigure them if one of them has a problem, allowing you to automatically take the slave away from the master, or to promote the slave if the master fails. That means that if the slave has a problem, the master will only wait for the slave as long as it takes for PgPool to kick the slave out, after which it will tell the master to reconfigure and that will probably close the hanging transactions too (not sure about that but it seems logical) On 2017-03-16 12:49, Anushka Weerakkodyge wrote: > Thanks for your reply. > I was wondering whether there is a transaction level timeout in > postgresql at least to rollback the transaction if it waits for too > long, or something that I can set in connection string(client). > I tried statement_timeout, didn't work though. > > Thanks, > Anushka > On Thu, Mar 16, 2017 at 3:21 PM, vinny wrote: > >> On 2017-03-16 10:06, Anushka Weerakkodyge wrote: >> Hi, >> >> problem still persists. >> Is there any configuration (parameter?) to set the timeout of the >> connection ? Because if the slave node is down, transaction to master >> node waits forever until slave node comes back online. >> Any suggestion would be highly appreciated. >> >> Thanks, >> Anushka >> On Thu, Mar 16, 2017 at 5:21 AM, Anushka Weerakkodyge >> wrote: >> >> Hi all, >> >> I have a synchronous streaming replication environment which is >> implemented using inbuilt replication mechanism in postgresql. >> Replication is working fine except I need to fail the data >> modification transactions when the slave node is not accessible. >> >> Is it possible? >> >> Please let me know whether there is a way to identify slave node >> status and fail the transaction using any inbuilt mechanism or some >> other technique. >> >> Thanks, >> Anushka > > As far as I know, which is does not mean much, there is no timeout > setting. > And that's by design; a timeout can occur because the node is down, > but also because it's busy and cannot answer in time, or there is a > network hickup. > > Adding a timeout would basically break the "syncronous" promise > because that guarantees that either all nodes are updated, or the > transaction fails. > > And yes I googled this from: > https://www.postgresql.org/message-id/CADp-Sm7ENFJH4YQmJVYD2qB2OaKa6qb > 6TEHCJWfce%2BQoQXsdhA%40mail.gmail.com > [1] > > In the case of a node going down you should probably but some failover > mechanism in place so you can safely remove the dead node from the > setup and rebuild it before making it part of the cluster again. > > > > Links: > ------ > [1] > https://www.postgresql.org/message-id/CADp-Sm7ENFJH4YQmJVYD2qB2OaKa6qb > 6TEHCJWfce%2BQoQXsdhA%40mail.gmail.com -- Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin -- Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin