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 1sra6U-002wU6-7y for pgsql-hackers@arkaria.postgresql.org; Fri, 20 Sep 2024 09:39:07 +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 1sra6S-002Bhs-2y for pgsql-hackers@arkaria.postgresql.org; Fri, 20 Sep 2024 09:39:05 +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 1sra6R-002Bco-AO for pgsql-hackers@lists.postgresql.org; Fri, 20 Sep 2024 09:39:05 +0000 Received: from m16.mail.163.com ([220.197.31.3]) by makus.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sra6I-0009Np-Vc for pgsql-hackers@lists.postgresql.org; Fri, 20 Sep 2024 09:39:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-ID:MIME-Version: Content-Type; bh=SP/TvfD7EKwWIv81B8xfaafvPYfFGHRHy0H8tpxEO48=; b=gqK6dRu+qlU5p6jFVJ6QREym9UPNjg+BikyxfmCJqvA4/v0dhZrV6Abpdp/WAo GU8mc3LD+crR/XWweOYYaHPPaMXSs0BupalxQv051F0d4cBnaM14NBodi+Vg6p1I KeoebBaHYlVo9c5021hyCJWDq32sELLitrLyZn8Sy8fNE= Received: from lovely-coding (unknown [101.227.46.166]) by gzga-smtp-mta-g2-1 (Coremail) with SMTP id _____wD3H7GgQu1mgazBGw--.18619S3; Fri, 20 Sep 2024 17:38:41 +0800 (CST) From: Andy Fan To: Pg Hackers Subject: FullTransactionIdAdvance question cc: Andres Freund Date: Fri, 20 Sep 2024 17:38:40 +0800 Message-ID: <87frpu4qcf.fsf@163.com> MIME-Version: 1.0 Content-Type: text/plain X-CM-TRANSID:_____wD3H7GgQu1mgazBGw--.18619S3 X-Coremail-Antispam: 1Uf129KBjvdXoWrZFWfXFyxKF18ZF1DArW5ZFb_yoWDXrcE9F yfGry8Jrn8XrWxtrsxGr15uF47GayDZry7X3Z5ua4jkr95ta97uw4kWFZ7t3Z7ArWxt3Z5 ArWftw1fCw42vjkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7xRiqXd7UUUUU== X-Originating-IP: [101.227.46.166] X-CM-SenderInfo: x2klx3xlid0iqsrtqiywtou0bp/xtbBhQJgU2WXxFmWOQABs1 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, static inline void FullTransactionIdAdvance(FullTransactionId *dest) { dest->value++; /* see FullTransactionIdAdvance() */ if (FullTransactionIdPrecedes(*dest, FirstNormalFullTransactionId)) return; while (XidFromFullTransactionId(*dest) < FirstNormalTransactionId) dest->value++; } I understand this functiona as: 'dest->value++' increases the epoch when necessary and we don't want use the TransactionId which is smaller than FirstNormalTransactionId. But what is the point of the below code: /* see FullTransactionIdAdvance() */ if (FullTransactionIdPrecedes(*dest, FirstNormalFullTransactionId)) return; It looks to me it will be never true(I added a 'Assert(false);' above the return, make check-world pass). and if it is true somehow, retruning a XID which is smaller than FirstNormalTransactionId looks strange as well. IIUC, should we remove it to save a prediction on each GetNewTransactionId call? -- Best Regards Andy Fan