timescale / timescaledb

An open-source time-series SQL database optimized for fast ingest and complex queries. Packaged as a PostgreSQL extension.
https://www.timescale.com/
Other
16.94k stars 858 forks source link

[Bug]: tuplefactory_make_tuple assertion failure #3969

Closed svenklemm closed 2 years ago

svenklemm commented 2 years ago

TimescaleDB version affected

master (0dd4329)

PostgreSQL version used

14.1

What operating system did you use?

Archlinux 2021.12.01 x64

What installation method did you use?

Source

What platform did you run on?

On prem/Self-hosted

Relevant log output and stack trace

#0  0x00007fd3beda9d22 in raise () from /usr/lib/libc.so.6
#1  0x00007fd3bed93862 in abort () from /usr/lib/libc.so.6
#2  0x0000555a050127a5 in ExceptionalCondition (conditionName=0x7fd3b59501e8 "!tf->attconv->binary", errorType=0x7fd3b594ffcf "FailedAssertion", fileName=0x7fd3b59500b8 "/home/sven/projects/timescaledb/tsl/src/remote/tuplefactory.c",
    lineNumber=297) at assert.c:69
#3  0x00007fd3b59234f9 in tuplefactory_make_tuple (tf=0x555a07157458, res=0x555a06de17d0, row=0, format=0) at /home/sven/projects/timescaledb/tsl/src/remote/tuplefactory.c:297
#4  0x00007fd3b5921913 in row_by_row_fetcher_complete (fetcher=0x555a07157300) at /home/sven/projects/timescaledb/tsl/src/remote/row_by_row_fetcher.c:196
#5  0x00007fd3b5921b5f in row_by_row_fetcher_fetch_data (df=0x555a07157300) at /home/sven/projects/timescaledb/tsl/src/remote/row_by_row_fetcher.c:252
#6  0x00007fd3b58fc799 in fetch_data (ass=0x555a06f0fdd0) at /home/sven/projects/timescaledb/tsl/src/fdw/data_node_scan_exec.c:163
#7  0x00007fd3b58fcfe1 in fetch_data (ass=0x555a06f0fdd0) at /home/sven/projects/timescaledb/tsl/src/nodes/async_append.c:248
#8  0x00007fd3b58fcf27 in iterate_data_nodes_and_exec (aas=0x555a06f0f340, dn_exec=0x7fd3b58fcfc1 <fetch_data>) at /home/sven/projects/timescaledb/tsl/src/nodes/async_append.c:229
#9  0x00007fd3b58fd0d3 in async_append_exec (node=0x555a06f0f340) at /home/sven/projects/timescaledb/tsl/src/nodes/async_append.c:269
#10 0x0000555a04c0b4d0 in ExecCustomScan (pstate=0x555a06f0f340) at nodeCustom.c:115
#11 0x0000555a04bec7f7 in ExecProcNodeFirst (node=0x555a06f0f340) at execProcnode.c:463
#12 0x0000555a04c2013f in ExecProcNode (node=0x555a06f0f340) at ../../../src/include/executor/executor.h:257
#13 0x0000555a04c203a4 in ExecLimit (pstate=0x555a06f0f038) at nodeLimit.c:96
#14 0x0000555a04bec7f7 in ExecProcNodeFirst (node=0x555a06f0f038) at execProcnode.c:463
#15 0x0000555a04c347b8 in ExecProcNode (node=0x555a06f0f038) at ../../../src/include/executor/executor.h:257
#16 0x0000555a04c36ee4 in ExecSetParamPlan (node=0x555a0785d580, econtext=0x555a0785a978) at nodeSubplan.c:1118
#17 0x0000555a04bd7585 in ExecEvalParamExec (state=0x555a0785b2c8, op=0x555a0785b358, econtext=0x555a0785a978) at execExprInterp.c:2414
#18 0x0000555a04bd4a42 in ExecInterpExpr (state=0x555a0785b2c8, econtext=0x555a0785a978, isnull=0x7ffe93064f4f) at execExprInterp.c:1062
#19 0x0000555a04bd64cc in ExecInterpExprStillValid (state=0x555a0785b2c8, econtext=0x555a0785a978, isNull=0x7ffe93064f4f) at execExprInterp.c:1824
#20 0x0000555a04c290f1 in ExecEvalExprSwitchContext (state=0x555a0785b2c8, econtext=0x555a0785a978, isNull=0x7ffe93064f4f) at ../../../src/include/executor/executor.h:339
#21 0x0000555a04c29169 in ExecProject (projInfo=0x555a0785b2c0) at ../../../src/include/executor/executor.h:373
#22 0x0000555a04c29632 in ExecProcessReturning (resultRelInfo=0x555a07134140, tupleSlot=0x555a0785d7b0, planSlot=0x555a07857388) at nodeModifyTable.c:190
#23 0x0000555a04c2c5d4 in ExecUpdate (mtstate=0x555a07133df0, resultRelInfo=0x555a07134140, tupleid=0x7ffe930650d2, oldtuple=0x0, slot=0x555a0785d7b0, planSlot=0x555a07857388, epqstate=0x555a07133ed8, estate=0x555a06f0ecb0,
    canSetTag=true) at nodeModifyTable.c:1967
#24 0x0000555a04c2d7d6 in ExecModifyTable (pstate=0x555a07133df0) at nodeModifyTable.c:2594
#25 0x0000555a04bec7f7 in ExecProcNodeFirst (node=0x555a07133df0) at execProcnode.c:463
#26 0x0000555a04be0427 in ExecProcNode (node=0x555a07133df0) at ../../../src/include/executor/executor.h:257
#27 0x0000555a04be2fe7 in ExecutePlan (estate=0x555a06f0ecb0, planstate=0x555a07133df0, use_parallel_mode=false, operation=CMD_UPDATE, sendTuples=true, numberTuples=0, direction=ForwardScanDirection, dest=0x555a0708bb18,
    execute_once=true) at execMain.c:1551
#28 0x0000555a04be0b4e in standard_ExecutorRun (queryDesc=0x555a0708bbb0, direction=ForwardScanDirection, count=0, execute_once=true) at execMain.c:361
#29 0x0000555a04be093d in ExecutorRun (queryDesc=0x555a0708bbb0, direction=ForwardScanDirection, count=0, execute_once=true) at execMain.c:305
#30 0x0000555a04e5a8ed in ProcessQuery (plan=0x555a0781d8d8,
    sourceText=0x555a06c8eda0 "update public.gapfill_plan_test set \n  time = public.gapfill_plan_test.time\nreturning \n  (select v3 from public.metrics_dist limit 1 offset 78)\n     as c0", params=0x0, queryEnv=0x0,
    dest=0x555a0708bb18, qc=0x7ffe930653a0) at pquery.c:160
#31 0x0000555a04e5c478 in PortalRunMulti (portal=0x555a06d00f40, isTopLevel=true, setHoldSnapshot=true, dest=0x555a0708bb18, altdest=0x555a053392a0 <donothingDR>, qc=0x7ffe930653a0) at pquery.c:1274
#32 0x0000555a04e5bf98 in FillPortalStore (portal=0x555a06d00f40, isTopLevel=true) at pquery.c:1023
#33 0x0000555a04e5b8a2 in PortalRun (portal=0x555a06d00f40, count=9223372036854775807, isTopLevel=true, run_once=true, dest=0x555a0781fd40, altdest=0x555a0781fd40, qc=0x7ffe930655e0) at pquery.c:760
#34 0x0000555a04e5488a in exec_simple_query (query_string=0x555a06c8eda0 "update public.gapfill_plan_test set \n  time = public.gapfill_plan_test.time\nreturning \n  (select v3 from public.metrics_dist limit 1 offset 78)\n     as c0")
    at postgres.c:1214
#35 0x0000555a04e596e5 in PostgresMain (argc=1, argv=0x7ffe93065800, dbname=0x555a06cc5228 "smith", username=0x555a06cc5208 "sven") at postgres.c:4486
#36 0x0000555a04d7ffff in BackendRun (port=0x555a06cb8e80) at postmaster.c:4530
#37 0x0000555a04d7f866 in BackendStartup (port=0x555a06cb8e80) at postmaster.c:4252
#38 0x0000555a04d7b5ef in ServerLoop () at postmaster.c:1745
#39 0x0000555a04d7ad64 in PostmasterMain (argc=3, argv=0x555a06c88650) at postmaster.c:1417
#40 0x0000555a04c6c989 in main (argc=3, argv=0x555a06c88650) at main.c:209

Query triggering the assertion

update public.gapfill_plan_test set
  time = public.gapfill_plan_test.time
returning
  (select v3 from public.metrics_dist limit 1 offset 78)
     as c0
svenklemm commented 2 years ago

Fixed by #3948