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 1kDnaM-0006cE-Kf for pgsql-general@arkaria.postgresql.org; Thu, 03 Sep 2020 11:39:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kDnaL-0002Hg-Kx for pgsql-general@arkaria.postgresql.org; Thu, 03 Sep 2020 11:39:21 +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 1kDnaL-0002GR-38 for pgsql-general@lists.postgresql.org; Thu, 03 Sep 2020 11:39:21 +0000 Received: from mail.dalibo.com ([212.85.157.172]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kDnaI-00069a-7L for pgsql-general@postgresql.org; Thu, 03 Sep 2020 11:39:20 +0000 Received: from firost (larco.ioguix.net [82.66.0.6]) by mail.dalibo.com (Postfix) with ESMTPSA id 9B90E2049C; Thu, 3 Sep 2020 13:39:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=dalibo.com; s=a; t=1599133156; bh=gRW/uabQ9LXuHhqkwCbX9hxZZdGQH4k1AuH6S7nGDGk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=nAWycqRapVYbPKZ7fW27w2EnqJfQFhL7yspPVgF+/iOO7kLafzYihNogNjOYLaYbp qJxgHE7jOWw2fBeW3X/GvOYsukxtNcVEB90xpqD2Nt0TL3h4TOGQSxdhaysQ14+23P GDO9yi6BUfPqNSNgEHnEugp1YhwzE+gwQ1cxBgTE= Date: Thu, 3 Sep 2020 13:39:15 +0200 From: Jehan-Guillaume de Rorthais To: =?UTF-8?B?0J7Qu9C10LMg0KHQsNC80L7QudC70L7Qsg==?= Cc: pgsql-general Subject: Re: BUG? Slave don't reconnect to the master Message-ID: <20200903133915.1850e955@firost> In-Reply-To: <253962B4-CB29-4A90-A995-17B6047D3876@ya.ru> References: <60590EC6-4062-4F25-A49C-3948ED2A7D47@ya.ru> <20200819150713.326c3532@firost> <52BADD0F-E348-43BB-8992-FDE86F3B1A65@ya.ru> <20200821162642.4245add6@firost> <253962B4-CB29-4A90-A995-17B6047D3876@ya.ru> Organization: Dalibo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, Sorry for the late answer, I've been busy. On Mon, 24 Aug 2020 18:45:42 +0300 =D0=9E=D0=BB=D0=B5=D0=B3 =D0=A1=D0=B0=D0=BC=D0=BE=D0=B9=D0=BB=D0=BE=D0=B2 <= splarv@ya.ru> wrote: > > 21 =D0=B0=D0=B2=D0=B3. 2020 =D0=B3., =D0=B2 17:26, Jehan-Guillaume de R= orthais > > =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB(=D0=B0): > >=20 > > On Thu, 20 Aug 2020 15:16:10 +0300 > > Based on setup per node, you can probably add > > 'synchronous_commit=3Dremote_write' in the common conf. =20 >=20 > Nope. I set 'synchronous_commit=3Dremote_write' only for 3 and 4 node clu= sters. > [...] Then I suppose your previous message had an error as it shows three nodes tuchanka3a, tuchanka3b and tuchanka3c (no 4th node), all with remote_= write in krogan3.conf. But anyway. > >> [...] > >> pacemaker config, specific for this cluster: > >> [...] =20 > >=20 > > why did you add "monitor interval=3D15"? No harm, but it is redundant w= ith > > "monitor interval=3D16 role=3DMaster" and "monitor interval=3D17 role= =3DSlave". =20 >=20 > I can't remember clearly. :) Look what happens without it. >=20 > + pcs -f configured_cib.xml resource create krogan2DB ocf:heartbeat:pgsql= ms > bindir=3D/usr/pgsql-11/bin pgdata=3D/var/lib/pgsql/krogan2 > recovery_template=3D/var/lib/pgsql/krogan2.paf meta master notify=3Dtrue > resource-stickiness=3D10 > Warning: changing a monitor operation interval from 15 to 16 to make the > operation unique > Warning: changing a monitor operation interval from 16 to 17 to make the > operation unique Something fishy here. This command lack op monitor settings. Pacemaker don't add any default monitor operation with default interval if you don't give o= ne at resource creation. If you create such a resource with no monitoring, the cluster will start/st= op it when needed, but will NOT check for its health. See:=20 https://clusterlabs.org/pacemaker/doc/en-US/Pacemaker/2.0/html/Pacemaker_Ex= plained/s-resource-monitoring.html > So trivial monitor always exists by default with interval 15. nope. > My real command > pcs -f configured_cib.xml resource create krogan2DB ocf:heartbeat:pgsqlms > bindir=3D/usr/pgsql-11/bin pgdata=3D/var/lib/pgsql/krogan2 > recovery_template=3D/var/lib/pgsql/krogan2.paf op monitor interval=3D15 > timeout=3D10 monitor interval=3D16 role=3DMaster timeout=3D15 monitor int= erval=3D17 > role=3DSlave timeout=3D10 meta master notify=3Dtrue resource-stickiness= =3D10 >=20 > Looked like I needed to add all this to change "timeout" parameter for the > monitor operations and I needed for interval parameter to point on the > specific monitor operation. OK, I understand now. If you want to edit an existing resource, use "pcs resource update". Make sure read the pcs manual about how to use it to edit/remove/add operations on a resource. > Looked like the default timeout 10 was not enough for the "master". It's written in PAF doc. See: https://clusterlabs.github.io/PAF/configuration.html#resource-agent-actions Do not hesitate to report or submit some enhancements to the doc if needed. > [...] > >> [...] > >> 10:24:55.906 LOG: entering standby mode > >> 10:24:55.908 LOG: redo starts at 0/15000028 > >> 10:24:55.909 LOG: consistent recovery state reached at 0/15002300 > >> 10:24:55.910 LOG: database system is ready to accept read only connec= tions > >> 10:24:55.928 LOG: started streaming WAL from primary at 0/16000000 on= tl 3 > >> 10:26:37.308 FATAL: terminating walreceiver due to timeout =20 > >=20 > > Timeout because of SIGSTOP on primary here. =20 >=20 > Sure >=20 > >> 10:26:37.308 LOG: invalid record length at 0/1600C4D8: wanted 24, got= 0 > >> 10:30:55.965 LOG: received promote request =20 > >=20 > > Promotion from Pacemaker here. =20 >=20 > Yep >=20 > > What happened during more than 4 minutes between the timeout and the > > promotion? =20 >=20 > It's one of the problem, which you may improve. :) The pacemaker reaction= is > the longest for STOP signal test, usually near 5 minutes. The pacemaker t= ried > to make different things (for instance "demote") and wait for different > timeouts. Oh, understood, obviously, I should have thought about that. Well, I will n= ot be able to improve anything here. You might want to adjust the various oper= ation timeouts and lower the migration-threshold. > >> 10:30:55.965 FATAL: terminating walreceiver process dpue to administr= ator > >> cmd 10:30:55.966 LOG: redo done at 0/1600C4B0 > >> 10:30:55.966 LOG: last completed transaction was at log time > >> 10:25:38.76429 10:30:55.968 LOG: selected new timeline ID: 4 > >> 10:30:56.001 LOG: archive recovery complete > >> 10:30:56.005 LOG: database system is ready to accept connections =20 > > =20 > >> The slave with didn't reconnected replication, tuchanka3c. Also I sepa= rated > >> logs copied from the old master by a blank line: > >>=20 > >> [...] > >>=20 > >> 10:20:25.168 LOG: database system was interrupted; last known up at > >> 10:20:19 10:20:25.180 LOG: entering standby mode > >> 10:20:25.181 LOG: redo starts at 0/11000098 > >> 10:20:25.183 LOG: consistent recovery state reached at 0/11000A68 > >> 10:20:25.183 LOG: database system is ready to accept read only connec= tions > >> 10:20:25.193 LOG: started streaming WAL from primary at 0/12000000 on= tl 3 > >> 10:25:05.370 LOG: could not send data to client: Connection reset by = peer > >> 10:26:38.655 FATAL: terminating walreceiver due to timeout > >> 10:26:38.655 LOG: record with incorrect prev-link 0/1200C4B0 at > >> 0/1600C4D8 =20 > >=20 > > This message appear before the effective promotion of tuchanka3b. Do you > > have logs about what happen *after* the promotion? =20 >=20 > This is end of the slave log. Nothing. Just absent replication. This is unusual. Could you log some more details about replication tryouts to your PostgreSQL logs? Set log_replication_commands and lower log_min_messages to debug ? > > Reading at this error, it seems like record at 0/1600C4D8 references the > > previous one in WAL 0/12000000. So the file referenced as 0/16 have eit= her > > corrupted data or was 0/12 being recycled, but not zeroed correctly, as= v11 > > always do no matter what (no wal_init_zero there). =20 >=20 > Okey, may be in v12 it will be fixed. No, I don't think so. This is not related with a bug in v11 -vs- v12, but v= 12 might behave a bit differently depending on the value of wal_init_zero. > > That's why I'm wondering how you built your standbys, from scratch? =20 >=20 > By special scripts. :) This project already on GitHub and I am waiting for > the final solution of my boss to open it. And it will take some time to > translate README to English. After this I'll link the repository here. I'll give it a look and try to reproduce if I find some time. Regards,