Avoid dead code (contrib/pg_visibility/pg_visibility.c)

Started by Ranier Vilelaover 1 year ago5 messages
#1Ranier Vilela
ranier.vf@gmail.com
1 attachment(s)

Hi.

Per coverity.

I think that commit c582b75
<https://github.com/postgres/postgres/commit/c582b75851c2d096ce050d753494505a957cee75&gt;,
left an oversight.

The report is:
CID 1559993: (#1 of 1): Logically dead code (DEADCODE)

Trivial patch attached.

best regards,
Ranier Vilela

Attachments:

0001-avoid-dead-code-pg_visibility.patchapplication/octet-stream; name=0001-avoid-dead-code-pg_visibility.patchDownload
diff --git a/contrib/pg_visibility/pg_visibility.c b/contrib/pg_visibility/pg_visibility.c
index db796e35cb..1c0a0fbdfb 100644
--- a/contrib/pg_visibility/pg_visibility.c
+++ b/contrib/pg_visibility/pg_visibility.c
@@ -760,9 +760,9 @@ collect_corrupt_items(Oid relid, bool all_visible, bool all_frozen)
 		 * the page lock.  Recheck to avoid returning spurious results.
 		 */
 		if (all_frozen && !VM_ALL_FROZEN(rel, blkno, &vmbuffer))
-			check_frozen = false;
+			check_frozen = true;
 		if (all_visible && !VM_ALL_VISIBLE(rel, blkno, &vmbuffer))
-			check_visible = false;
+			check_visible = true;
 		if (!check_visible && !check_frozen)
 		{
 			UnlockReleaseBuffer(buffer);
#2Michael Paquier
michael@paquier.xyz
In reply to: Ranier Vilela (#1)
Re: Avoid dead code (contrib/pg_visibility/pg_visibility.c)

On Wed, Sep 04, 2024 at 01:50:24PM -0300, Ranier Vilela wrote:

I think that commit c582b75
<https://github.com/postgres/postgres/commit/c582b75851c2d096ce050d753494505a957cee75&gt;,
left an oversight.

The report is:
CID 1559993: (#1 of 1): Logically dead code (DEADCODE)

Trivial patch attached.

I am not sure to understand what you mean here and if this is still
relevant as of Noah's latest commit in 65c310b310a6.
--
Michael

#3Nazir Bilal Yavuz
byavuz81@gmail.com
In reply to: Michael Paquier (#2)
Re: Avoid dead code (contrib/pg_visibility/pg_visibility.c)

Hi,

On Thu, 12 Sept 2024 at 08:19, Michael Paquier <michael@paquier.xyz> wrote:

On Wed, Sep 04, 2024 at 01:50:24PM -0300, Ranier Vilela wrote:

I think that commit c582b75
<https://github.com/postgres/postgres/commit/c582b75851c2d096ce050d753494505a957cee75&gt;,
left an oversight.

The report is:
CID 1559993: (#1 of 1): Logically dead code (DEADCODE)

Thanks for the report!

I am not sure to understand what you mean here and if this is still
relevant as of Noah's latest commit in 65c310b310a6.

This should be fixed in 65c310b310a6.

--
Regards,
Nazir Bilal Yavuz
Microsoft

#4Ranier Vilela
ranier.vf@gmail.com
In reply to: Michael Paquier (#2)
Re: Avoid dead code (contrib/pg_visibility/pg_visibility.c)

Em qui., 12 de set. de 2024 às 02:18, Michael Paquier <michael@paquier.xyz>
escreveu:

On Wed, Sep 04, 2024 at 01:50:24PM -0300, Ranier Vilela wrote:

I think that commit c582b75
<

https://github.com/postgres/postgres/commit/c582b75851c2d096ce050d753494505a957cee75

,
left an oversight.

The report is:
CID 1559993: (#1 of 1): Logically dead code (DEADCODE)

Trivial patch attached.

I am not sure to understand what you mean here and if this is still
relevant as of Noah's latest commit in 65c310b310a6.

Sorry Michael, but this patch became irrelevant after ddfc556
<http://ddfc556a644404a8942e77651f75f09aa5188782&gt;
Note the omission to connect the dots, from the commit.

best regards,
Ranier Vilela

#5Michael Paquier
michael@paquier.xyz
In reply to: Nazir Bilal Yavuz (#3)
Re: Avoid dead code (contrib/pg_visibility/pg_visibility.c)

On Thu, Sep 12, 2024 at 09:10:44AM +0300, Nazir Bilal Yavuz wrote:

This should be fixed in 65c310b310a6.

Thanks for the confirmation.
--
Michael