yugabyte / yugabyte-db

YugabyteDB - the cloud native distributed SQL database for mission-critical applications.
https://www.yugabyte.com
Other
8.88k stars 1.05k forks source link

[DocDB][SQLsmith] ERROR: transaction ID is in the future #11237

Open def- opened 2 years ago

def- commented 2 years ago

Jira Link: DB-1299

Description

Taken from https://github.com/yugabyte/yugabyte-db/issues/11066#issuecomment-1021697503:

CREATE VIEW mvtest_vt1 AS SELECT 1 moo;

delete from information_schema.sql_implementation_info
where
case when pg_catalog.pg_notification_queue_usage() >= case when information_schema.sql_implementation_info.character_value is NULL then (select stanullfrac from pg_catalog.pg_statistic limit 1 offset 6)
           else (select stanullfrac from pg_catalog.pg_statistic limit 1 offset 6)
           end
         then cast(null as bpchar) else cast(null as bpchar) end
     ~* case when (select moo from public.mvtest_vt1 limit 1 offset 2)
         is not NULL then pg_catalog.txid_status(
      cast((select pg_catalog.sum(indnatts) from pg_catalog.pg_index)
         as int8)) else pg_catalog.txid_status(
      cast((select pg_catalog.sum(indnatts) from pg_catalog.pg_index)
         as int8)) end

returning
  case when information_schema.sql_implementation_info.implementation_info_name is not NULL then information_schema.sql_implementation_info.implementation_info_name else information_schema.sql_implementation_info.implementation_info_name end
     as c0,
  information_schema.sql_implementation_info.integer_value as c1,
  case when cast(null as "char") > pg_catalog.char(
        cast((select pg_catalog.max(application_name) from pg_catalog.pg_stat_activity)
           as text)) then information_schema.sql_implementation_info.implementation_info_id else information_schema.sql_implementation_info.implementation_info_id end
     as c2,
  information_schema.sql_implementation_info.character_value as c3,
  pg_catalog.yb_mem_usage_sql_b() as c4,
  88 as c5;

fails deterministically with:

ERROR:  transaction ID 208 is in the future

Found with SQLsmith while I was looking for something else, but might still be worth investigating if this is unexpected behavior.

def- commented 2 years ago
CREATE VIEW mvtest_vt1 AS SELECT 1 moo;