Skip to content

Conversation

@avamingli
Copy link
Contributor

Fix issue: #1222

As comments in itemptr_to_uint64:
Greenplum allow 16 bits for the offsetnumber, which turns the below upstream assertion into an always-true comparison which generates a compiler warning; thus we need to keep this commented out.

For sql in issue 1222, we will get assert failure as:

DETAIL: FailedAssertion("!(((_Bool) ((( ((void) ((_Bool) (! (!(((_Bool) (((const void*)(&segment->first) != ((void )0)) && ((&segment->first)->ip_posid != 0))))) ||
(ExceptionalCondition("!(((_Bool) (((const void
)(&segment->first) != ((void )0)) && ((&segment->first)->ip_posid != 0))))", ("FailedAssertion"), "ginpostinglist.c", 338), 0)))), ( (&segment->first)->ip_posid ) ) != ((OffsetNumber) 0)) && (( ((void) ((_Bool) (! (!(((_Bool) (((const void)(&segment->first) != ((void )0)) && ((&segment->first)->ip_posid != 0))))) ||
(ExceptionalCondition("!(((_Bool) (((const void
)(&segment->first) != ((void *)0)) && ((&segment->first)->ip_posid != 0))))", ("FailedAssertion"), "ginpostinglist.c", 338), 0)))), ( (&segment->first)->ip_posid ) ) <= ((OffsetNumber) (32768 / sizeof(ItemIdData)))))))", File: "ginpostinglist.c", Line: 338)

Reported-by: assam258-5892 [email protected]
Reproduced-by: Zhang Mingli [email protected]
Authored-by: Zhang Mingli [email protected]

Fixes #ISSUE_Number

What does this PR do?

Type of Change

  • Bug fix (non-breaking change)
  • New feature (non-breaking change)
  • Breaking change (fix or feature with breaking changes)
  • Documentation update

Breaking Changes

Test Plan

  • Unit tests added/updated
  • Integration tests added/updated
  • Passed make installcheck
  • Passed make -C src/test installcheck-cbdb-parallel

Impact

Performance:

User-facing changes:

Dependencies:

Checklist

Additional Context

CI Skip Instructions


@assam258-5892
Copy link

Copilot warns that the problem can also occur on line 112 of the same file and in B-tree, GiST, SP-GiST, Hash, and BRIN indexes.

@my-ship-it my-ship-it self-requested a review July 11, 2025 03:54
@avamingli
Copy link
Contributor Author

Copilot warns that the problem can also occur on line 112 of the same file and in B-tree, GiST, SP-GiST, Hash, and BRIN indexes.

I currently don’t use Copilot, appreciate it if you could help verify whether the issue is reproducible. If you confirm it’s a problem, please feel free to:

  1. Open an issue with details (steps to reproduce) or
  2. Submit a fix if you’re comfortable doing so.

Happy to collaborate on resolving this if it’s indeed an issue!

@avamingli avamingli force-pushed the fix_gin branch 2 times, most recently from 5e8db67 to 8e16a66 Compare July 11, 2025 08:08
@gfphoenix78
Copy link
Contributor

What's the offset value when assert failure happens? 0, or exceed the maximum number of MaxOffsetNumber?

@avamingli
Copy link
Contributor Author

Add a FIXME for potential failures in other files. see ed13150

Fix issue: apache#1222

As comments in itemptr_to_uint64:
Greenplum allow 16 bits for the offsetnumber, which turns the
below upstream assertion into an always-true comparison which
generates a compiler warning; thus we need to keep this commented out.

For sql in issue 1222, we will get assert failure as:

DETAIL:  FailedAssertion("!(((_Bool) ((( ((void) ((_Bool) (! (!(((_Bool)
(((const void*)(&segment->first) != ((void *)0)) &&
((&segment->first)->ip_posid != 0))))) ||
(ExceptionalCondition("!(((_Bool) (((const void*)(&segment->first) !=
((void *)0)) && ((&segment->first)->ip_posid != 0))))",
("FailedAssertion"), "ginpostinglist.c", 338), 0)))), (
(&segment->first)->ip_posid ) ) != ((OffsetNumber) 0)) && (( ((void)
((_Bool) (! (!(((_Bool) (((const void*)(&segment->first) != ((void *)0))
&& ((&segment->first)->ip_posid != 0))))) ||
(ExceptionalCondition("!(((_Bool) (((const void*)(&segment->first) !=
((void *)0)) && ((&segment->first)->ip_posid != 0))))",
("FailedAssertion"), "ginpostinglist.c", 338), 0)))), (
(&segment->first)->ip_posid ) ) <= ((OffsetNumber) (32768 /
sizeof(ItemIdData)))))))", File: "ginpostinglist.c", Line: 338)

Reported-by: assam258-5892 [email protected]
Reproduced-by: Zhang Mingli [email protected]
Authored-by: Zhang Mingli [email protected]
@avamingli avamingli merged commit 54a402c into apache:main Aug 4, 2025
27 checks passed
@avamingli avamingli deleted the fix_gin branch August 4, 2025 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants