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 1soMv5-00Agpn-EM for pgsql-general@arkaria.postgresql.org; Wed, 11 Sep 2024 12:58:04 +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 1soMv3-00H87p-Fj for pgsql-general@arkaria.postgresql.org; Wed, 11 Sep 2024 12:58:01 +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 1soMv2-00H87g-W5 for pgsql-general@lists.postgresql.org; Wed, 11 Sep 2024 12:58:01 +0000 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1soMuz-000dVp-Tm for pgsql-general@lists.postgresql.org; Wed, 11 Sep 2024 12:57:59 +0000 Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-53653ee23adso6617821e87.3 for ; Wed, 11 Sep 2024 05:57:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726059476; x=1726664276; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=16EPoYnW2biEvxg7qFEtW6H3K+bvngniTDJz7VhupKc=; b=Y88kpp00sSJgfQh9X4EIByg1rpH0s+vLgaapahUNSBlCNrEN2eoFDcIkR4ygHENf6M fTOu50PZE3QPhZ6IjWTzkFU3nHrl/9aD38+guS63f3XoKDvLJh2xkfRy7m7pTMDsqrT4 4qy9c7qQbUwH2M79Arh270ShJPO4gkjbL/XKbyCXY24QNo1oxWptUuSSdMKizXTJ/c8p 8JROnZ7k6RWMOI361DUK+Nf+pgdirNmgy23q2JITwFjMhpk1xtlwqA7yKcAUyJobyXMF R7VBX4rFOPdusY+j/4QjeUslpjK9Nu7UQ25ds2T+F19AXur/LAfBQe6s3RKi7Ipgsqjn AAEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726059476; x=1726664276; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=16EPoYnW2biEvxg7qFEtW6H3K+bvngniTDJz7VhupKc=; b=J6B9DLyTZ+VNMfE/FAz3wrS0lpS2/CjYZwH5rrTosFmyjU0f9Q0zhUm4dhSOPJWIG2 NMJ4xNun9S/PXCHAdf+IJPsDWxZDHbpsX1xdQakui7fQhu+W4JEu/wVjKyzOp7YO7Itt H6AkveE5GHXOsEVp24TBX7h9jS0BzuhdXzF1k4c5jB1N81NQrWF9AmcQBLp+9y4i/gJu c5jcoDsJpwrLOm7ipKCLUtEmQBrk9/TL6FrVHnAKBN4Oews7zneDcHaB4ezPrc0EkvHm FMFr/Cx/4TI4QM5ZHVe7Y9A+mUZlf+FYSf2bJIMmnuv64f4cGczcGMWe5CCyfy5VC3KW pN1g== X-Gm-Message-State: AOJu0YwgyzM08Ecu/90NHDzdEMc9R8j0tunMQS3TlJSxwPp0EMVXNJcc im2eXtQ0QAuitxzGnhEeNyDo/+RiTrZ86tZ3W/h0RT6mMjBIhUj5q6VCyGE4K7IcQEB57NqWtWu LMKDZgTGAm4D2e9AFVF4hWvNWy78= X-Google-Smtp-Source: AGHT+IFBADvZQgpFTSiH+egUoEcDAOf/zehZuEavJXyY1RbcayCVblqnkG77F/BdRF9HWK80vhMAJTZMQX9JRRYLVVk= X-Received: by 2002:a05:6512:15a7:b0:534:3746:c623 with SMTP id 2adb3069b0e04-53658816358mr9718588e87.55.1726059476066; Wed, 11 Sep 2024 05:57:56 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Greg Sabino Mullane Date: Wed, 11 Sep 2024 08:57:17 -0400 Message-ID: Subject: Re: Ghost data from failed FDW transactions? To: Jacob Biesinger Cc: pgsql-general@lists.postgresql.org Content-Type: multipart/alternative; boundary="000000000000eeaf770621d78906" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000eeaf770621d78906 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Any updates on this? A few replies from me inline: On Wed, Aug 28, 2024 at 12:18=E2=80=AFPM Jacob Biesinger wrote: > There aren't many details in the docs around failure modes... is there > anything there that could cause this issue? > Nothing that I know of, but it's possible there is some sort of weird race condition/bug. But frankly, it's far more likely to be some sort of application bug / missed behavior. If you could trigger it at will by developing a self-contained test, that would be ideal. > The ordering shouldn't matter, but this also means that error handling > (e.g., when there is a conflict with the `EXCLUDE "serialNumber"` > constraint) may not stop the second `INSERT` statement from being attempt= ed > (and rejected by postgres). But I think that's all client-side details th= at > shouldn't affect the FDW txn semantics, right? > Correct, but it's hard to say for sure without seeing the code or knowing exactly how the serialization errors are being handled. I'm not clear on how the inserts are run "in parallel" if your flow is: BEGIN; > INSERT INTO "devices" ("orgId", "patientId", "deviceId", "data") ... > INSERT INTO "devices" ("orgId", "patientId", "deviceId", "data") ... SELECT * FROM "rootDb"."assets"; -- execute some logic client-side, nothing touching the DB UPDATE "rootDb"."assets" WHERE ...; COMMIT; Perhaps expand on that, because it almost sounds like you have two processes trying to talk to the same backend at once? Cheers, Greg --000000000000eeaf770621d78906 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Any updates on this?

A few r= eplies from me inline:

On Wed, Aug 28, 2024 at 12:18=E2=80=AFPM J= acob Biesinger <jake.biesing= er@gmail.com> wrote:
There aren't m= any details in the docs around failure modes... is there anything there tha= t could cause this issue?

Nothing that I know of, but it's possible there is some sort of weird = race condition/bug. But frankly, it's far more likely to be some sort o= f application bug=C2=A0 / missed behavior. If you could trigger it at will = by developing a self-contained test, that would be ideal.=C2=A0
= =C2=A0
The ordering shouldn't matter, but = this also means that=C2=A0error handling (e.g., when there is a conflict wi= th the `EXCLUDE "serialNumber"` constraint) may not stop the seco= nd `INSERT` statement from being attempted (and rejected by postgres). But = I think that's all client-side details that shouldn't affect the FD= W txn semantics, right?

C= orrect, but it's hard to say for sure without seeing the code or knowin= g exactly how the serialization errors are being handled. I'm not clear= on how the inserts are run "in parallel" if your flow is:
<= div>
BEGIN;
I= NSERT INTO "devices" ("orgId", "patientId", &= quot;deviceId", "data") ...
INSERT INTO "devices&quo= t; ("orgId", "patientId", "deviceId", "d= ata") ...=C2=A0
SELECT * FROM "rootDb"."assets";=C2=A0
-- execute some logic= client-side, nothing touching the DB=C2=A0
UPDATE "rootDb"."assets&quo= t; WHERE ...;=C2=A0
COMMIT;
=C2=A0
Perhaps expand on that= , because it almost sounds like you have two processes trying to talk to th= e same backend at once?

Cheers,
Greg

--000000000000eeaf770621d78906--