You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Server crashes when executing SELECT documentdb_api.shard_collection(...); #462
SET documentdb.next_collection_id TO 1290;
CALL documentdb_api.insert_bulk('db', '{"insert":"system.views", "documents":[{"a":1}],"ordered":true}');
CALL documentdb_api.insert_bulk('db', '{"insert":"system.profile", "documents":[{"a":1}],"ordered":true}');CALL documentdb_api.insert_bulk('db', '{"insert":"collection0", "documents":[{"_id":99,"a":99}]}');
SET documentdb.next_collection_id TO 1290;
CALL documentdb_api.insert_bulk('dB', '{"insert":"collection9", "documents":[{"_id":99,"a":99}]}');CALL documentdb_api.insert_bulk('db', '{"insert":"collection8", "documents":[{"_id":99,"a":99}]}');CALL documentdb_api.insert_bulk('db', '{"insert":"collection2", "documents":[{"_id":1,"$a":1},{"_id":2,"a":2}]}');
CALL documentdb_api.insert_bulk('db', '{"insert":"collection3", "documents":[{"_id":1,"$a":1},{"_id":2,"a":2}],"ordered":false}');
select documentdb_api.shard_collection('db', 'collection4', '{"_id":"hashed"}', false);
Expected behavior
Expected ERROR to be shown or sql query to be successfully executed
Actual behavior
Segmentation Fault
Bactrace:
Program terminated with signal SIGSEGV, Segmentation fault.
#0 ShardCollectionCore (args=0x7ffd14a5f550) at src/sharding/sharding.c:1220
1220 if (collection->shardKey == NULL &&
(gdb) bt
#0 ShardCollectionCore (args=0x7ffd14a5f550) at src/sharding/sharding.c:1220
#1 0x0000767bdcfa7e4e in ShardCollectionLegacy (fcinfo=<optimized out>) at src/sharding/sharding.c:1185
#2 command_shard_collection (fcinfo=<optimized out>) at src/sharding/sharding.c:164
#3 0x00005ae0dff6d457 in ExecInterpExpr (state=0x5ae0e1377198, econtext=0x5ae0e1376f68, isnull=<optimized out>) at execExprInterp.c:764
#4 0x00005ae0dff9f4c4 in ExecEvalExprSwitchContext (isNull=0x7ffd14a5f777, econtext=0x5ae0e1376f68, state=0x5ae0e1377198) at ../../../src/include/executor/executor.h:357
#5 ExecProject (projInfo=0x5ae0e1377190) at ../../../src/include/executor/executor.h:391
#6 ExecResult (pstate=<optimized out>) at nodeResult.c:135
#7 0x00005ae0dff70d6b in ExecProcNode (node=0x5ae0e1376e60) at ../../../src/include/executor/executor.h:275
#8 ExecutePlan (dest=0x5ae0e129df68, direction=<optimized out>, numberTuples=0, sendTuples=true, operation=CMD_SELECT, queryDesc=0x5ae0e12dcda8) at execMain.c:1648
#9 standard_ExecutorRun (queryDesc=0x5ae0e12dcda8, direction=<optimized out>, count=0, execute_once=<optimized out>) at execMain.c:360
#10 0x00005ae0e0117f8a in PortalRunSelect (portal=portal@entry=0x5ae0e12ffc18, forward=forward@entry=true, count=0, count@entry=9223372036854775807,
dest=dest@entry=0x5ae0e129df68) at pquery.c:922
#11 0x00005ae0e0119426 in PortalRun (portal=portal@entry=0x5ae0e12ffc18, count=count@entry=9223372036854775807, isTopLevel=isTopLevel@entry=true,
run_once=run_once@entry=true, dest=dest@entry=0x5ae0e129df68, altdest=altdest@entry=0x5ae0e129df68, qc=0x7ffd14a5f9f0) at pquery.c:766
#12 0x00005ae0e011585c in exec_simple_query (query_string=0x5ae0e125d148 "SELECT documentdb_api.shard_collection('fam','retryable_update', '{\"a\":\"hashed\"}', false);")
at postgres.c:1278
#13 0x00005ae0e0116c0b in PostgresMain (dbname=<optimized out>, username=<optimized out>) at postgres.c:4767
#14 0x00005ae0e0111e55 in BackendMain (startup_data=<optimized out>, startup_data_len=<optimized out>) at backend_startup.c:105
#15 0x00005ae0e00825cf in postmaster_child_launch (child_type=child_type@entry=B_BACKEND, startup_data=startup_data@entry=0x7ffd14a5fe20 "",
startup_data_len=startup_data_len@entry=4, client_sock=client_sock@entry=0x7ffd14a5fe40) at launch_backend.c:277
#16 0x00005ae0e0086099 in BackendStartup (client_sock=0x7ffd14a5fe40) at postmaster.c:3594
#17 ServerLoop () at postmaster.c:1676
#18 0x00005ae0e0087e31 in PostmasterMain (argc=argc@entry=5, argv=argv@entry=0x5ae0e12170f0) at postmaster.c:1374
#19 0x00005ae0dfdc5ab2 in main (argc=5, argv=0x5ae0e12170f0) at main.c:199
Additional context
The same crash (segmentation fault) also occurs with another test.sql script:
SET search_path TO documentdb_core, documentdb_api, public;
SET documentdb.next_collection_id TO 9100;
SELECT documentdb_api.create_collection('list_metadata_db1', 'list_metadata_coll1');
SET documentdb.next_collection_id TO 9100;
SELECT documentdb_api.shard_collection('list_metadata_db1', 'list_metadata_coll2', '{ "_id": "hashed" }', false);
Activity
Merged PR 1968053: [Bugfix|Copilot] Fix null crash in lookup project,…
Merged PR 1968053: [Bugfix|Copilot] Fix null crash in lookup project,…