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 1sFCa3-0000gj-15 for pgsql-hackers@arkaria.postgresql.org; Thu, 06 Jun 2024 12:50:59 +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 1sFCa0-0015qk-Tx for pgsql-hackers@arkaria.postgresql.org; Thu, 06 Jun 2024 12:50:56 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sFCa0-0015qc-K6 for pgsql-hackers@lists.postgresql.org; Thu, 06 Jun 2024 12:50:56 +0000 Received: from mail-lf1-x132.google.com ([2a00:1450:4864:20::132]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sFCZt-000IHT-FF for pgsql-hackers@postgresql.org; Thu, 06 Jun 2024 12:50:56 +0000 Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-52b83225088so1088622e87.3 for ; Thu, 06 Jun 2024 05:50:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717678248; x=1718283048; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=cFJxPp5ErfpKYikxLF2Dg91pesFTqo+fWi/MHup527E=; b=cNTLR2Jf3LcADHQ3RNdnm1NHTdLPtx5O+SDz4jd4D/oWt5xBb5iDdzFJeqyI67lpVS FOg9lL/5Sr4nE9MNDiDoUUe+wtzC5aUZalnDiewxRz1U5zgzByLUN9+NDI/RhqdI2+7x M7p1ZfCD4G+TecFub1MaqfEYH1kqr0mB7D+Jzdpt1UQEq6STBVRkKLQ1VTsgaXryve4v AJHmsJUCMQJfzsETDZWX+63na3h2ifszqrWTbVO3geJMaRiFPULXSYNVY0mUBB2BrzO0 jvfHq64JWfzDpIfTK91fQjTyrHjGC/PFduAigMRYQmd092bsoKBFhkpLDSVVzWeQZ0/t Dy6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717678248; x=1718283048; h=content-transfer-encoding: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=cFJxPp5ErfpKYikxLF2Dg91pesFTqo+fWi/MHup527E=; b=vjv72HVDZu2LNmQEBm616YREnpNGHIxEVRbRxsXHpm+7qm9JODnQ/1mREg9t3Y7eUT OELFrZjDBUQCi82PVANvuqbe2hkXw5oO+uXMfqUdicwFZrPNtVkNN90zLlrScThdqfmr +YwR2SOBKe+r55MaIkCJ0sNIOcgvGXjH/6/FsXRckA39Cp55FiexPKyLUZ2xzVMciEkO 478zqlvx4SOmUaaIXj0G6X+iRutUDEdONsQkUH9w95gc3RAci9RatWbJU1UiLdwvS6HX NlIJD81CnZ1GHOJO0OEgkOYF7ePBaMCoS2+SNE4o9J2pgYhY+TQzQI2eSQHSBaO426wc D/Ug== X-Gm-Message-State: AOJu0YxK2kVgMQI36AiSYr8Y/o0YzSV4s7Ut3Hl4F8x5KRmwL2rhpR6K 64sQ74dQx+MaDuHITNjOAh3ddj1Pq2uOceOQWhiE3qIxV4yg1u0cYWNoviXTj0pmWTS7//ToyCv LHxoTA2B2aJr338Suhz7c/Ie2/NqgIDDQ X-Google-Smtp-Source: AGHT+IHu/Sc1b9mRyZOOx9XsnKHWZFz63GDa4iUumNih42RvycNZgfjzstH40Md1/9AX8SdFdTybZev9nMzfamGCc3Q= X-Received: by 2002:a05:6512:2fa:b0:52b:85bd:8de8 with SMTP id 2adb3069b0e04-52bab4c9622mr3458307e87.21.1717678248006; Thu, 06 Jun 2024 05:50:48 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Dilip Kumar Date: Thu, 6 Jun 2024 18:20:30 +0530 Message-ID: Subject: Re: How about using dirty snapshots to locate dependent objects? To: Ashutosh Sharma Cc: pgsql-hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Jun 6, 2024 at 5:59=E2=80=AFPM Ashutosh Sharma wrote: > > Hello everyone, > > At present, we use MVCC snapshots to identify dependent objects. This imp= lies that if a new dependent object is inserted within a transaction that i= s still ongoing, our search for dependent objects won't include this recent= ly added one. Consequently, if someone attempts to drop the referenced obje= ct, it will be dropped, and when the ongoing transaction completes, we will= end up having an entry for a referenced object that has already been dropp= ed. This situation can lead to an inconsistent state. Below is an example i= llustrating this scenario: I don't think it's correct to allow the index to be dropped while a transaction is creating it. Instead, the right solution should be for the create index operation to protect the object it is using from being dropped. Specifically, the create index operation should acquire a shared lock on the Access Method (AM) to ensure it doesn't get dropped concurrently while the transaction is still in progress. --=20 Regards, Dilip Kumar EnterpriseDB: http://www.enterprisedb.com