Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rY8h0-00EYgh-KJ for pgsql-hackers@arkaria.postgresql.org; Thu, 08 Feb 2024 18:00:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rY8gz-001sqW-Ev for pgsql-hackers@arkaria.postgresql.org; Thu, 08 Feb 2024 18:00:09 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rY8gz-001sqH-52 for pgsql-hackers@lists.postgresql.org; Thu, 08 Feb 2024 18:00:09 +0000 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rY8gw-005kh4-Hr for pgsql-hackers@postgresql.org; Thu, 08 Feb 2024 18:00:07 +0000 Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-5116b2dbd16so104771e87.1 for ; Thu, 08 Feb 2024 10:00:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707415204; x=1708020004; darn=postgresql.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=lkE1a9E+aHsAzeodl8+oHaYhPgSyiPGz72FGmbTYPfs=; b=X9oHp6NCRQLiXqogqFGbEI4lNCh5KACTG068XQYQTCT/DCIETjTASdpgzQlnn3v8LS fwwbuQTmKgo43KGKH0ZHC38w85lxH0jF5NRpSMGjKDzURqHgQGiH31uD9Cm5XjVtAnWw 6Q/Rdm813gJ/i9SS8V4lX1mgYqURjGIsBFCF6r6qdeW+jmAy/7MYGlQVnpvZ7vlZuJBc VuhtZk1dymHE+Q66WARM/uoRjrXnkQHMK7tnTQFA3hx0JPElQC0xSXcC5zGU/IwgrRjR j0Y0E3ejx0pq35JiInkRWFPT3OCkeQZdbVqvJXsKLYlvXT2pjuz00a+uoe9enjdUHMuM paog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707415204; x=1708020004; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=lkE1a9E+aHsAzeodl8+oHaYhPgSyiPGz72FGmbTYPfs=; b=l8Flxs1s6xSL6HN+rwu+Z3xf2vIB7AUhSuj6ZrdzxYFEW6/acYo67QsRyh/csDMK4l tdEHYERwMLUZqYLFckYpONnKNtJ/87asnPQ5K2ibAXz5WWxpRtvYx82jVWHBvOY24Tok E3BF25z5+8Da22+cDpW9Ax2bIM+j+HSWP/96onh4f1O0WRBncYgZm8vfohTyzHbEELVd RC8HiRCnW9pF4521IlN6TehqldxPb1oNINT6ENYjmujnMpBsaxA4GXV6yxu04DncXLlN 4OpUWr1l9YdSszIboUs6dBaCvwldjXtI1TG3DVe7ZBtzJKM2ah+eDFT67ZhgNKIsR5DL Bnbg== X-Forwarded-Encrypted: i=1; AJvYcCWEgr6TrJDbiF6YuUb+/VAlqjtqLJ6+Ytlu7DES2IEfo+Xb/3SysfPH7Z+stsGFxdVBcernohF5zXnQCZeKuWDP3ovRYAJREn4il3QZ X-Gm-Message-State: AOJu0YyEE/87rqtqUq/IJw55EJbXj6MVMTVE0OYueFpv1UpKfavNykX2 iYLKryeeFRmDVXE+Wh9IbnU8IHiADFZ3Hc6PWm7RwDJpMj43lkG6 X-Google-Smtp-Source: AGHT+IEJPpyrNWNY3kHVWuFDykoMP/AjgypdVW8Bl1CpsIMYcvKiDW0G9OzxtqBmJyA5HS0DdmQxhw== X-Received: by 2002:ac2:5443:0:b0:511:71be:be72 with SMTP id d3-20020ac25443000000b0051171bebe72mr605082lfn.5.1707415203556; Thu, 08 Feb 2024 10:00:03 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCX307U8amQCdjtk3tL1X5dETFSgKhW56DzpqEZsl4GAbPSZHhbkTjplJ08MWh6NZQ2aDxHq7+iZL6aR6eTwqdWKFer9mcskcxPbJ43I Received: from [1.0.0.7] ([91.185.76.174]) by smtp.gmail.com with ESMTPSA id n18-20020a195512000000b005115ee258f7sm19733lfe.171.2024.02.08.10.00.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 08 Feb 2024 10:00:02 -0800 (PST) Message-ID: Date: Thu, 8 Feb 2024 21:00:01 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: Race condition in FetchTableStates() breaks synchronization of subscription tables Content-Language: en-US To: vignesh C Cc: "Zhijie Hou (Fujitsu)" , pgsql-hackers References: <711a6afe-edb7-1211-cc27-1bef8239eec7@gmail.com> <858a7622-2c81-1687-d1df-1322dfcb2e72@gmail.com> From: Alexander Lakhin In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 08.02.2024 12:25, vignesh C wrote: > Yes, the wakeup call sent by the "CREATE SUBSCRIPTION" command was > getting missed in this case. The wakeup call can be sent during > subscription creation/modification and when the apply worker exits. > WaitForReplicationWorkerAttach should not reset the latch here as it > will end up delaying the apply worker to get started after 180 seconds > timeout(DEFAULT_NAPTIME_PER_CYCLE). The attached patch does not reset > the latch and lets ApplyLauncherMain to reset the latch and checks if > any new worker or missing worker needs to be started. Thank you for the updated patch! I ran all the subscription tests in a loop (with the sleeps added as before) and observed no failures and 180+ seconds duration. Best regards, Alexander