This is an automated email from the ASF dual-hosted git repository. avamingli pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit 1b44ecea6a937cbac8eed69d0b58a33d0cd38f04 Author: Zhang Mingli <avamin...@gmail.com> AuthorDate: Fri Jul 11 15:13:12 2025 +0800 Disable offsetnumber assertion in ginPostingListDecodeAllSegments() Fix issue: https://github.com/apache/cloudberry/issues/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 assam...@gmail.com Reproduced-by: Zhang Mingli avamin...@gmail.com Authored-by: Zhang Mingli avamin...@gmail.com --- src/backend/access/gin/ginpostinglist.c | 6 ++++++ src/test/regress/expected/gin.out | 9 +++++++++ src/test/regress/expected/gin_optimizer.out | 9 +++++++++ src/test/regress/sql/gin.sql | 10 ++++++++++ 4 files changed, 34 insertions(+) diff --git a/src/backend/access/gin/ginpostinglist.c b/src/backend/access/gin/ginpostinglist.c index 8b166c738c7..de4d4d325fd 100644 --- a/src/backend/access/gin/ginpostinglist.c +++ b/src/backend/access/gin/ginpostinglist.c @@ -335,7 +335,13 @@ ginPostingListDecodeAllSegments(GinPostingList *segment, int len, int *ndecoded_ } /* copy the first item */ + /* + * Keep this commented out. + * See comments in itemptr_to_uint64(). + */ +#if 0 Assert(OffsetNumberIsValid(ItemPointerGetOffsetNumber(&segment->first))); +#endif Assert(ndecoded == 0 || ginCompareItemPointers(&segment->first, &result[ndecoded - 1]) > 0); result[ndecoded] = segment->first; ndecoded++; diff --git a/src/test/regress/expected/gin.out b/src/test/regress/expected/gin.out index 65730adcfe0..8454ee25bb8 100644 --- a/src/test/regress/expected/gin.out +++ b/src/test/regress/expected/gin.out @@ -310,3 +310,12 @@ select count(*) from t_gin_test_tbl where j @> '{}'::int[]; reset enable_seqscan; reset enable_bitmapscan; drop table t_gin_test_tbl; +-- +-- Github issue: https://github.com/apache/cloudberry/issues/1222 +-- +begin; +create table t_issue_1222(i int4[]) with (appendonly=true); +create index t_issue_1222_idx on t_issue_1222 using gin (i) + with (fastupdate = on, gin_pending_list_limit = 4096); +insert into t_issue_1222 select array[1, 2, g] from generate_series(1, 400000) g; +abort; diff --git a/src/test/regress/expected/gin_optimizer.out b/src/test/regress/expected/gin_optimizer.out index ef5c879df76..f7df2cf49e8 100644 --- a/src/test/regress/expected/gin_optimizer.out +++ b/src/test/regress/expected/gin_optimizer.out @@ -308,3 +308,12 @@ select count(*) from t_gin_test_tbl where j @> '{}'::int[]; reset enable_seqscan; reset enable_bitmapscan; drop table t_gin_test_tbl; +-- +-- Github issue: https://github.com/apache/cloudberry/issues/1222 +-- +begin; +create table t_issue_1222(i int4[]) with (appendonly=true); +create index t_issue_1222_idx on t_issue_1222 using gin (i) + with (fastupdate = on, gin_pending_list_limit = 4096); +insert into t_issue_1222 select array[1, 2, g] from generate_series(1, 400000) g; +abort; diff --git a/src/test/regress/sql/gin.sql b/src/test/regress/sql/gin.sql index db702e12adf..d52f19e2d36 100644 --- a/src/test/regress/sql/gin.sql +++ b/src/test/regress/sql/gin.sql @@ -172,3 +172,13 @@ reset enable_seqscan; reset enable_bitmapscan; drop table t_gin_test_tbl; + +-- +-- Github issue: https://github.com/apache/cloudberry/issues/1222 +-- +begin; +create table t_issue_1222(i int4[]) with (appendonly=true); +create index t_issue_1222_idx on t_issue_1222 using gin (i) + with (fastupdate = on, gin_pending_list_limit = 4096); +insert into t_issue_1222 select array[1, 2, g] from generate_series(1, 400000) g; +abort; --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cloudberry.apache.org For additional commands, e-mail: commits-h...@cloudberry.apache.org