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 1obK0d-00026y-3x for pgsql-general@arkaria.postgresql.org; Thu, 22 Sep 2022 11:04:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1obK0b-0006J8-P2 for pgsql-general@arkaria.postgresql.org; Thu, 22 Sep 2022 11:04:45 +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 1obK0b-0006Iz-DL for pgsql-general@lists.postgresql.org; Thu, 22 Sep 2022 11:04:45 +0000 Received: from mx3.stadt-zuerich.ch ([194.56.33.12]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1obK0X-0000Oi-8L for pgsql-general@postgresql.org; Thu, 22 Sep 2022 11:04:44 +0000 IronPort-SDR: P1k1MekVovT79/L2znwfb9GnrixZNdCLs03jTWL/2x0vBKFLyU1CBEmnVVrggpDgkhXt6JKGMj W3ckG2vxvbwoD1DfSombkeXo2ewk87g9PaoOfv8pvnMCoZ6iN0ILPsIgGttIL0rz2nPFqc/Hug I8Qa5qE7DvRixySj64PgUYBOKCBI5XqFZ1U1YQOCfBZK//IsQvcUDHdP4+Djzeys+fplgcDcH6 PDmQIU00Zwb+gL/+/6lcJ/qikjAkX4F6WBm/v5ONBr3lVqaBr0vdr1IEVb11Doq9fCw0Z1l0gb WAI= X-IronPort-AV: E=Sophos;i="5.93,335,1654552800"; d="scan'208";a="116301243" Received: from unknown (HELO SZHM27374.global.szh.loc) ([10.7.50.70]) by mx3.prm.szh.zone with ESMTP/TLS/AES256-GCM-SHA384; 22 Sep 2022 13:04:33 +0200 Received: from SZHM27370.global.szh.loc (10.7.50.50) by SZHM27374.global.szh.loc (10.7.50.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.18; Thu, 22 Sep 2022 13:04:33 +0200 Received: from SZHM27370.global.szh.loc ([fe80::25ce:879f:5795:3325]) by SZHM27370.global.szh.loc ([fe80::25ce:879f:5795:3325%10]) with mapi id 15.01.2375.018; Thu, 22 Sep 2022 13:04:33 +0200 From: "Zwettler Markus (OIZ)" To: "pgsql-general@postgresql.org" Subject: Patroni question Thread-Topic: Patroni question Thread-Index: AdjOchovROnV4ausRY2SKzqo/NSz5Q== Date: Thu, 22 Sep 2022 11:04:33 +0000 Message-ID: Accept-Language: de-CH, en-US Content-Language: de-DE X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.7.48.250] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk We had a failover. I would read the Patroni logs below as following. 2022-09-21 11:13:56,384 secondary did a HTTP GET request to primary. This f= ailed with a read timeout. 2022-09-21 11:13:56,792 secondary promoted itself to primary 2022-09-21 11:13:57,279 primary did a HTTP GET request to secondary. An exc= eption happend. Probably also due to read timeout. 2022-09-21 11:13:57,983 primary demoted itself So, the failover has been caused by a network timeout between primary and s= econdary. QUESTION 1 : Do you agree? I thought that the Patroni nodes do not communicate directly with each othe= r but only by DCS? QUESTION 2: Is this not correct anymore? =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D patroni version: 2.1.3 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D Patroni Logfile of Host szhm49346 (IP 10.9.132.13) =3D> Primary until Failo= ver ... ... 2022-09-21 11:13:57,279 DEBUG: API thread: 10.9.132.16 - - "GET /patroni HT= TP/1.1" 200 - latency: 2245.090 ms 2022-09-21 11:13:57,378 ERROR: Traceback (most recent call last): File "/usr/lib/python3.6/site-packages/patroni/dcs/etcd.py", line 566, in= wrapper retval =3D func(self, *args, **kwargs) is not None File "/usr/lib/python3.6/site-packages/patroni/dcs/etcd.py", line 696, in= _update_leader return self.retry(self._client.write, self.leader_path, self._name, pre= vValue=3Dself._name, ttl=3Dself._ttl) File "/usr/lib/python3.6/site-packages/patroni/dcs/etcd.py", line 447, in= retry return retry(*args, **kwargs) File "/usr/lib/python3.6/site-packages/patroni/utils.py", line 334, in __= call__ return func(*args, **kwargs) File "/usr/lib/python3.6/site-packages/etcd/client.py", line 500, in writ= e response =3D self.api_execute(path, method, params=3Dparams) File "/usr/lib/python3.6/site-packages/patroni/dcs/etcd.py", line 257, in= api_execute return self._handle_server_response(response) File "/usr/lib/python3.6/site-packages/etcd/client.py", line 987, in _han= dle_server_response etcd.EtcdError.handle(r) File "/usr/lib/python3.6/site-packages/etcd/__init__.py", line 306, in ha= ndle raise exc(msg, payload) etcd.EtcdCompareFailed: Compare failed : [pcl_p011@szhm49346 !=3D pcl_p011@= szhm49345] 2022-09-21 11:13:57,558 WARNING: Exception happened during processing of re= quest from 10.9.132.16:49080 2022-09-21 11:13:57,965 ERROR: failed to update leader lock 2022-09-21 11:13:57,983 INFO: Demoting self (immediate-nolock) 2022-09-21 11:13:58,214 WARNING: Traceback (most recent call last): File "/usr/lib64/python3.6/socketserver.py", line 654, in process_request= _thread self.finish_request(request, client_address) File "/usr/lib64/python3.6/socketserver.py", line 364, in finish_request self.RequestHandlerClass(request, client_address, self) File "/usr/lib64/python3.6/socketserver.py", line 724, in __init__ self.handle() File "/usr/lib64/python3.6/http/server.py", line 418, in handle self.handle_one_request() File "/usr/lib/python3.6/site-packages/patroni/api.py", line 652, in hand= le_one_request BaseHTTPRequestHandler.handle_one_request(self) File "/usr/lib64/python3.6/http/server.py", line 406, in handle_one_reque= st method() File "/usr/lib/python3.6/site-packages/patroni/api.py", line 198, in do_G= ET_patroni self._write_status_response(200, response) File "/usr/lib/python3.6/site-packages/patroni/api.py", line 94, in _writ= e_status_response self._write_json_response(status_code, response) File "/usr/lib/python3.6/site-packages/patroni/api.py", line 53, in _writ= e_json_response self._write_response(status_code, json.dumps(response, default=3Dstr), = content_type=3D'application/json') File "/usr/lib/python3.6/site-packages/patroni/api.py", line 50, in _writ= e_response self.wfile.write(body.encode('utf-8')) File "/usr/lib64/python3.6/socketserver.py", line 803, in write self._sock.sendall(b) BrokenPipeError: [Errno 32] Broken pipe ... ... =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D Patroni Logfile of Host szhm49345 (IP 10.9.132.16) =3D> Standby until Failo= ver ... ... 2022-09-21 11:13:54,381 DEBUG: Starting new HTTP connection (1): szhm49346.= global.szh.loc:8009 2022-09-21 11:13:56,384 WARNING: Request failed to pcl_p011@szhm49346: GET = http://szhm49346.global.szh.loc:8009/patroni (HTTPConnectionPool(host=3D'sz= hm49346.global.szh.loc', port=3D8009): Max retries exceeded with url: /patr= oni (Caused by ReadTimeoutError("HTTPConnectionPool(host=3D'szhm49346.globa= l.szh.loc', port=3D8009): Read timed out. (read timeout=3D2)",))) 2022-09-21 11:13:56,484 DEBUG: Writing pcl_p011@szhm49345 to key /patroni/p= cl_p011/leader ttl=3D30 dir=3DFalse append=3DFalse 2022-09-21 11:13:56,485 DEBUG: Converted retries value: 0 -> Retry(total=3D= 0, connect=3DNone, read=3DNone, redirect=3D0, status=3DNone) 2022-09-21 11:13:56,562 DEBUG: http://10.7.211.13:2379 "PUT /v2/keys/patron= i/pcl_p011/leader HTTP/1.1" 201 197 2022-09-21 11:13:56,562 DEBUG: Issuing read for key /patroni/pcl_p011/ with= args {'recursive': True, 'retry': } 2022-09-21 11:13:56,563 DEBUG: Converted retries value: 0 -> Retry(total=3D= 0, connect=3DNone, read=3DNone, redirect=3D0, status=3DNone) 2022-09-21 11:13:56,634 DEBUG: http://10.7.211.13:2379 "GET /v2/keys/patron= i/pcl_p011/?recursive=3Dtrue HTTP/1.1" 200 None 2022-09-21 11:13:56,635 DEBUG: Writing {"leader":"pcl_p011@szhm49345","sync= _standby":null} to key /patroni/pcl_p011/sync ttl=3DNone dir=3DFalse append= =3DFalse 2022-09-21 11:13:56,635 DEBUG: Converted retries value: 0 -> Retry(total=3D= 0, connect=3DNone, read=3DNone, redirect=3D0, status=3DNone) 2022-09-21 11:13:56,713 DEBUG: http://10.7.211.13:2379 "PUT /v2/keys/patron= i/pcl_p011/sync HTTP/1.1" 200 368 2022-09-21 11:13:56,713 DEBUG: Writing {"conn_url":"postgres://szhm49345.gl= obal.szh.loc:5432/pcl_p011","api_url":"http://szhm49345.global.szh.loc:8009= /patroni","state":"running","role":"replica","version":"2.1.3","checkpoint_= after_promote":false,"xlog_location":9087609453816,"timeline":6} to key /pa= troni/pcl_p011/members/pcl_p011@szhm49345 ttl=3D30 dir=3DFalse append=3DFal= se 2022-09-21 11:13:56,714 DEBUG: Converted retries value: 0 -> Retry(total=3D= 0, connect=3DNone, read=3DNone, redirect=3D0, status=3DNone) 2022-09-21 11:13:56,791 DEBUG: http://10.7.211.13:2379 "PUT /v2/keys/patron= i/pcl_p011/members/pcl_p011@szhm49345 HTTP/1.1" 200 896 2022-09-21 11:13:56,792 INFO: promoted self to leader by acquiring session = lock 2022-09-21 11:13:56,798 INFO: cleared rewind state after becoming the leade= r ... ...