Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[YSQL][SQLsmith] TRAP: FailedAssertion("!(bms_is_subset(appendrel->lateral_relids, required_outer))", File: "../../../../../../../src/postgres/src/backend/optimizer/util/relnode.c", Line: 1543) #11233

Open
def- opened this issue Jan 26, 2022 · 1 comment
Assignees
Labels
area/ysql Yugabyte SQL (YSQL) kind/bug This issue is a bug kind/failing-test Tests and testing infra priority/medium Medium priority issue qa_automation Bugs identified via itest-system, LST, Stress automation or causing automation failures

Comments

@def-
Copy link
Contributor

def- commented Jan 26, 2022

Jira Link: DB-945

Description

SQLsmith found this in Debug build, reproducible:

CREATE TABLE mvtest_boxes (id serial primary key, b box);
INSERT INTO mvtest_boxes (b) VALUES
  ('(32,32),(31,31)'),
  ('(2.0000004,2.0000004),(1,1)'),
  ('(1.9999996,1.9999996),(1,1)');
CREATE MATERIALIZED VIEW mvtest_boxmv AS SELECT * FROM mvtest_boxes;
CREATE TABLE test_yb (col int);
INSERT INTO test_yb VALUES (null);
CREATE MATERIALIZED VIEW mtest_yb AS SELECT * FROM test_yb;

select  
  ref_11.cfgname as c0, 
  subq_6.c8 as c1, 
  subq_7.c0 as c2
from 
  (select  
          case when subq_4.c4 >= subq_4.c0 then ref_0.idx_blks_read else ref_0.idx_blks_read end
             as c0, 
          subq_3.c8 as c1, 
          subq_5.c1 as c2, 
          subq_3.c8 as c3, 
          subq_1.c2 as c4, 
          subq_5.c1 as c5, 
          subq_4.c0 as c6, 
          28 as c7, 
          ref_0.idx_blks_hit as c8, 
          subq_5.c0 as c9, 
          subq_4.c3 as c10, 
          (select pg_catalog.max(partnatts) from pg_catalog.pg_partitioned_table)
             as c11, 
          subq_1.c1 as c12
        from 
          pg_catalog.pg_statio_user_indexes as ref_0,
          lateral (select  
                ref_1.lanispl as c0, 
                ref_0.idx_blks_hit as c1, 
                ref_0.schemaname as c2
              from 
                pg_catalog.pg_language as ref_1
              where (cast(null as jsonb) @> (select pg_catalog.jsonb_agg(trftype) from pg_catalog.pg_transform)
                    ) 
                and (EXISTS (
                  select  
                      subq_0.c4 as c0, 
                      ref_2.authorization_identifier as c1, 
                      (select classoid from pg_catalog.pg_shseclabel limit 1 offset 6)
                         as c2, 
                      ref_0.idx_blks_hit as c3, 
                      ref_0.idx_blks_hit as c4, 
                      ref_0.idx_blks_read as c5, 
                      ref_2.foreign_data_wrapper_name as c6, 
                      subq_0.c0 as c7, 
                      ref_0.relname as c8, 
                      ref_1.laninline as c9, 
                      ref_0.relname as c10, 
                      subq_0.c1 as c11, 
                      subq_0.c1 as c12, 
                      ref_0.schemaname as c13, 
                      68 as c14, 
                      ref_0.relid as c15, 
                      ref_2.foreign_data_wrapper_language as c16
                    from 
                      information_schema._pg_foreign_data_wrappers as ref_2,
                      lateral (select  
                            ref_3.trflang as c0, 
                            ref_2.foreign_data_wrapper_name as c1, 
                            ref_2.fdwowner as c2, 
                            ref_2.foreign_data_wrapper_name as c3, 
                            ref_1.lanispl as c4, 
                            ref_3.trftype as c5, 
                            ref_1.laninline as c6, 
                            ref_1.lanname as c7
                          from 
                            pg_catalog.pg_transform as ref_3
                          where ref_3.trftosql is not NULL) as subq_0
                    where cast(null as polygon) &<| cast(null as polygon)
                    limit 108))
              limit 80) as subq_1,
          lateral (select  
                subq_1.c2 as c0, 
                ref_0.idx_blks_hit as c1, 
                subq_1.c2 as c2, 
                ref_0.indexrelid as c3, 
                ref_4.funcname as c4, 
                subq_2.c0 as c5, 
                subq_1.c2 as c6, 
                subq_1.c0 as c7, 
                subq_1.c2 as c8
              from 
                pg_catalog.pg_stat_xact_user_functions as ref_4,
                lateral (select  
                      ref_0.relid as c0, 
                      ref_0.schemaname as c1, 
                      ref_5.col as c2
                    from 
                      public.mtest_yb as ref_5
                    where (select b from public.mvtest_boxmv limit 1 offset 2)
                         <@ (select b from public.mvtest_boxes limit 1 offset 1)
                        
                    limit 182) as subq_2
              where cast(null as float8) = cast(null as float4)
              limit 137) as subq_3,
          lateral (select  
                subq_3.c6 as c0, 
                subq_1.c2 as c1, 
                subq_3.c3 as c2, 
                ref_0.indexrelid as c3, 
                ref_0.relname as c4
              from 
                information_schema.column_options as ref_6
              where cast(null as reltime) = cast(null as reltime)) as subq_4,
          lateral (select  
                ref_0.indexrelid as c0, 
                subq_4.c2 as c1, 
                ref_7.numeric_scale as c2, 
                ref_7.table_catalog as c3, 
                subq_4.c1 as c4, 
                (select pg_catalog.stddev(enumsortorder) from pg_catalog.pg_enum)
                   as c5
              from 
                information_schema.columns as ref_7
              where cast(null as aclitem) = cast(null as aclitem)) as subq_5
        where pg_catalog.date_in(
            cast(cast(null as cstring) as cstring)) <> cast(null as "timestamp")) as subq_6
    right join (select  
            ref_9.evtfoid as c0, 
            ref_8.last_archived_wal as c1, 
            ref_9.evtowner as c2, 
            49 as c3, 
            ref_8.stats_reset as c4
          from 
            pg_catalog.pg_stat_archiver as ref_8
              inner join pg_catalog.pg_event_trigger as ref_9
              on (cast(null as lseg) @ cast(null as line))
          where cast(null as jsonb) <@ cast(null as jsonb)
          limit 107) as subq_7
      inner join pg_catalog.pg_policies as ref_10
        right join pg_catalog.pg_ts_config as ref_11
          inner join pg_catalog.pg_largeobject as ref_12
          on (ref_12.loid is NULL)
        on (ref_12.loid is NULL)
      on (subq_7.c2 = ref_12.loid )
    on ((pg_catalog.varbit_in(
            cast(cast(null as cstring) as cstring),
            cast(subq_6.c10 as oid),
            cast(ref_12.pageno as int4)) < case when cast(null as circle) @ cast(null as circle) then cast(null as varbit) else cast(null as varbit) end
            ) 
        or ((subq_7.c3 is not NULL) 
          and (cast(null as oidvector) <= cast(null as oidvector))))
where cast(nullif((select pg_catalog.sum(reltuples) from pg_catalog.pg_class)
      ,
    case when EXISTS (
        select  
            subq_7.c2 as c0, 
            ref_11.cfgowner as c1, 
            subq_6.c11 as c2, 
            subq_6.c8 as c3, 
            subq_7.c3 as c4
          from 
            pg_catalog.pg_indexes as ref_13
          where (cast(null as aclitem) = cast(null as aclitem)) 
            or ((subq_6.c11 is NULL) 
              or (cast(null as anyrange) <= cast(null as anyrange)))
          limit 137) then cast(null as float4) else cast(null as float4) end
      ) as float4) < cast(coalesce(cast(null as float4),
    cast(null as float4)) as float4);

Failure from ysqlsh:

server closed the connection unexpectedly
	This probably means the server terminated abnormally
	before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.

Failure in tserver log:

W0126 18:17:41.024987 1864462336 backfill_index.cc:1393] TS ce34e4813bc24c909b60627bcada17d0: backfill failed for tablet ea7f75b2d6b94a0e98a8478735549afa (table mvtest_mv [id=0000400000003000800000000000405a]) no further retry: Illegal state (yb/tablet/tablet.cc:1945): backfill connection to DB failed: server closed the connection unexpectedly
	This probably means the server terminated abnormally
	before or while processing the request. response was error { code: OPERATION_NOT_SUPPORTED status { code: ILLEGAL_STATE message: "backfill connection to DB failed: server closed the connection unexpectedly\n\tThis probably means the server terminated abnormally\n\tbefore or while processing the request." source_file: "../../src/yb/tablet/tablet.cc" source_line: 1945 errors: "\000" } } propagated_hybrid_time: 6730618720356921344 backfilled_until: "" failed_index_ids: "0000400000003000800000000000431a" number_rows_processed: 0
E0126 18:17:41.028297 1864462336 backfill_index.cc:836] Backfill Index Table(s) { mvtest_mv_a_idx2 } failed to backfill the index: [0000400000003000800000000000431a] due to Illegal state (yb/tablet/tablet.cc:1945): backfill connection to DB failed: server closed the connection unexpectedly
	This probably means the server terminated abnormally
	before or while processing the request.

(These TRAPs would be easier to catch during testing if the query returned the failure instead of a generic "terminated abnormally" message.)

@def- def- added kind/bug This issue is a bug area/ysql Yugabyte SQL (YSQL) labels Jan 26, 2022
@def-
Copy link
Contributor Author

def- commented Jan 26, 2022

Was trying to find materialized view bugs, but the same error also happens without matviews, occurs quite often.

@def- def- changed the title [YSQL] TRAP: FailedAssertion("!(bms_is_subset(appendrel->lateral_relids, required_outer))", File: "../../../../../../../src/postgres/src/backend/optimizer/util/relnode.c", Line: 1543) [YSQL][SQLsmith] TRAP: FailedAssertion("!(bms_is_subset(appendrel->lateral_relids, required_outer))", File: "../../../../../../../src/postgres/src/backend/optimizer/util/relnode.c", Line: 1543) Feb 3, 2022
@yugabyte-ci yugabyte-ci added the priority/medium Medium priority issue label Jun 8, 2022
@kripasreenivasan kripasreenivasan added the qa_automation Bugs identified via itest-system, LST, Stress automation or causing automation failures label Sep 13, 2022
@yugabyte-ci yugabyte-ci added the kind/failing-test Tests and testing infra label Oct 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ysql Yugabyte SQL (YSQL) kind/bug This issue is a bug kind/failing-test Tests and testing infra priority/medium Medium priority issue qa_automation Bugs identified via itest-system, LST, Stress automation or causing automation failures
Projects
None yet
Development

No branches or pull requests

4 participants