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 1romw8-003MTY-Ix for pgsql-hackers@arkaria.postgresql.org; Mon, 25 Mar 2024 16:12:37 +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 1romw7-005ch6-61 for pgsql-hackers@arkaria.postgresql.org; Mon, 25 Mar 2024 16:12:35 +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 1romw6-005cgy-Sw for pgsql-hackers@lists.postgresql.org; Mon, 25 Mar 2024 16:12:35 +0000 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1romw3-006MQw-Io; Mon, 25 Mar 2024 16:12:34 +0000 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-4148ca200a7so755415e9.0; Mon, 25 Mar 2024 09:12:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711383151; x=1711987951; darn=postgresql.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=+2wNxbiwfbZHYukLkmXlZIobUOQpT9cskCqxsdz+/tQ=; b=FjCpbGZukZQ/DS7pk/FDVJ8sKe6q2BF4Dg1j4iODQWKyJR28hOWrk2zVNFfe073DVT 9c5lPjDTmTQgNV8QFkydBCyXNSqh3s+sjbo3Ly03lmgmMNSdvO7d9HcD6OZ3lxV0/FHD I86DICwqUbR1tX+7uw1euC7xT3+ocji3mVrW4Dn9o5bC7XNLAdOi+HfgoFCf/33cV2mH lIBxsXaoUa14o7dw57K3RE4X8dLq58dRZu4ZwkuZmX6NBdOjBTzWCxZnXkMuuzvwKxTR 38iV04Gu3X+cYhThqXCESsGRpL4PGroaGLpYpaLFA571qe9hvRq4g34M/giHcdQ4Z3di Sp8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711383151; x=1711987951; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+2wNxbiwfbZHYukLkmXlZIobUOQpT9cskCqxsdz+/tQ=; b=ndScKuQWbo629d+81Kae0UcQK6q3Cyp6GiU6JOh2Xt6YnuKy/sjPo7wZT9uFc2Vpy7 ex7YD+VKsKkVLa3qc1xciYsv7UYWfWOrTUu/KgGS2j9wPn38nm/iGvsyAdZESn85b+Pn z7loY7jNdZyUlhURdaPryBnCZqiMnX9DC1H/tlRz6V5h0DEPc2iEAimc/P7RIKhTrglF bpRk8C+2Z/y8q6cFPzhXj55v7rG9TvNUl4h3iCN/Xx72ze6jpHT0xluLh49If4aYF41S Pcl6pRyRGFT4f2X7jJ0nlW//14Y01M4vfk33j67wAjY7c9LPirgNLmdjvbw8IjgBN1Tr 7ysA== X-Forwarded-Encrypted: i=1; AJvYcCU9aYBKL2v+41D2w2ngPtzfx+CKQ1iAK1zjaNzJs89Ir2/B03AHmkddp8dIB8laWVO1iork3uUieBVxcuuFYypWChNYpdX014vhPYHH54tPAfIgsrLpNCCL8mlfVsoPpeprDald X-Gm-Message-State: AOJu0YzcoMg9P52CG6Ly9PEppeF2tPdyjrDfyQLHwwu2XyKk/XPy38u2 lZGt5c/JVnSavGMF5MYYDui+89bI+v71jaEPi7+7Uthp8x1CkWEVwiX+1WWx X-Google-Smtp-Source: AGHT+IHlXeWrMFb0pjQRkQaM+6hLrc9tcCgiEq31REkIUR+lqdxQICyV2DMgwRJb8tNVLSzBQbHn/A== X-Received: by 2002:a05:6000:1082:b0:33e:7896:a9d7 with SMTP id y2-20020a056000108200b0033e7896a9d7mr5252990wrw.67.1711383151015; Mon, 25 Mar 2024 09:12:31 -0700 (PDT) Received: from ip-10-97-1-34.eu-west-3.compute.internal (ec2-15-236-134-5.eu-west-3.compute.amazonaws.com. [15.236.134.5]) by smtp.gmail.com with ESMTPSA id z15-20020a5d4d0f000000b003418016b04csm9855308wrt.76.2024.03.25.09.12.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 09:12:30 -0700 (PDT) Date: Mon, 25 Mar 2024 16:12:29 +0000 From: Bertrand Drouvot To: Robert Haas Cc: Amit Kapila , shveta malik , Bharath Rupireddy , Amit Kapila , "pgsql-hackers@postgresql.org" Subject: Re: pgsql: Track last_inactive_time in pg_replication_slots. Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On Mon, Mar 25, 2024 at 11:49:00AM -0400, Robert Haas wrote: > On Mon, Mar 25, 2024 at 11:16 AM Bertrand Drouvot > wrote: > > > IIUC, Bertrand's point was that users can interpret last_active_time > > > as a value that gets updated each time they decode a change which is > > > not what we are doing. So, this can confuse users. Your expectation of > > > answer (NULL) when the slot is active is correct and that is what will > > > happen. > > > > Yeah, and so would be the confusion: why is last_active_time NULL while one is > > using the slot? > > I agree that users could get confused here, but the solution to that > shouldn't be to give the field a name that is the opposite of what it > actually does. I expect a field called last_inactive_time to tell me > the last time that the slot was inactive. Here, it tells me the last > time that a currently-inactive slot previously *WAS* active. How can > you justify calling that the last *INACTIVE* time? > > AFAICS, the user who has the confusion that you mention here is simply > wrong. If they are looking at a field called "last active time" and > the slot is active, then the correct answer is "right now" or > "undefined" and that is what they will see. Sure, they might not > understand that. But flipping the name of the field on its head cannot > be the right way to help them. > > With the current naming, I expect to have the exact opposite confusion > as your hypothetical confused user. I'm going to be looking at a slot > that's currently inactive, and it's going to tell me that the > last_inactive_time was at some time in the past. And I'm going to say > "what the heck is going on here, the slot is inactive *right now*!" > > Half of me wonders whether we should avoid this whole problem by > renaming it to something like last_state_change or > last_state_change_time, or maybe just state_change like we do in > pg_stat_activity, and making it mean the last time the slot flipped > between active and inactive in either direction. I'm not sure if this > is better, but unless I'm misunderstanding something, the current > situation is terrible. > Now that I read your arguments I think that last__time could be both missleading because at the end they rely on users "expectation". Would "released_time" sounds better? (at the end this is exactly what it does represent unless for the case where it is restored from disk for which the meaning would still makes sense to me though). It seems to me that released_time does not lead to any expectation then removing any confusion. Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com