On Fri, Sep 8, 2017 at 9:03 PM, Victor Drobny <v.dro...@postgrespro.ru> wrote:
> Thank you very much for your review. In the attachment you can find v2 of
> the patch.

FYI this version crashes for me:

test test_rbtree              ... FAILED (test process exited with exit code 2)

It's trying to call rb->combiner which is null.

(lldb) bt
* thread #1: tid = 0x0000, 0x0000000000000000, stop reason = signal SIGSTOP
    frame #0: 0x0000000000000000
  * frame #1: 0x000000010c6fd9e0
postgres`rb_insert(rb=0x00007fe7e2029850, data=0x00007fff5380aa10,
isNew="") + 128 at rbtree.c:419
    frame #2: 0x000000010cffbfb9
test_rbtree.so`testdelete(size=100000, delsize=10000) + 425 at
test.c:558
    frame #3: 0x000000010cffb298
test_rbtree.so`testrbtree(fcinfo=0x00007fe7e200d9a8) + 104 at
test.c:630
    frame #4: 0x000000010c6a03be
postgres`ExecInterpExpr(state=0x00007fe7e200d8c0,
econtext=0x00007fe7e200d570, isnull="") + 2702 at execExprInterp.c:672
    frame #5: 0x000000010c6e005b
postgres`ExecEvalExprSwitchContext(state=0x00007fe7e200d8c0,
econtext=0x00007fe7e200d570, isNull="") + 59 at executor.h:309
    frame #6: 0x000000010c6dffee
postgres`ExecProject(projInfo=0x00007fe7e200d8b8) + 78 at
executor.h:343
    frame #7: 0x000000010c6dfd5c
postgres`ExecResult(pstate=0x00007fe7e200d458) + 332 at
nodeResult.c:136
    frame #8: 0x000000010c6b2912
postgres`ExecProcNodeFirst(node=0x00007fe7e200d458) + 82 at
execProcnode.c:430
    frame #9: 0x000000010c6af352
postgres`ExecProcNode(node=0x00007fe7e200d458) + 50 at executor.h:251
    frame #10: 0x000000010c6ab0f6
postgres`ExecutePlan(estate=0x00007fe7e200d240,
planstate=0x00007fe7e200d458, use_parallel_mode='\0',
operation=CMD_SELECT, sendTuples='\x01', numberTuples=0,
direction=ForwardScanDirection, dest=0x00007fe7e200aa20,
execute_once='\x01') + 182 at execMain.c:1720
    frame #11: 0x000000010c6aafcb
postgres`standard_ExecutorRun(queryDesc=0x00007fe7e2004040,
direction=ForwardScanDirection, count=0, execute_once='\x01') + 571 at
execMain.c:363
    frame #12: 0x000000010c6aad87
postgres`ExecutorRun(queryDesc=0x00007fe7e2004040,
direction=ForwardScanDirection, count=0, execute_once='\x01') + 87 at
execMain.c:306
    frame #13: 0x000000010c8b5bf2
postgres`PortalRunSelect(portal=0x00007fe7e2000040, forward='\x01',
count=0, dest=0x00007fe7e200aa20) + 306 at pquery.c:932
    frame #14: 0x000000010c8b55ba
postgres`PortalRun(portal=0x00007fe7e2000040,
count=9223372036854775807, isTopLevel='\x01', run_once='\x01',
dest=0x00007fe7e200aa20, altdest=0x00007fe7e200aa20, completionTag="")
+ 762 at pquery.c:773
    frame #15: 0x000000010c8b0f24
postgres`exec_simple_query(query_string="SELECT testrbtree(100000);")
+ 1316 at postgres.c:1109
    frame #16: 0x000000010c8b0127 postgres`PostgresMain(argc=1,
argv=0x00007fe7e180bd10, dbname="contrib_regression",
username="munro") + 2375 at postgres.c:4103
    frame #17: 0x000000010c7f712e
postgres`BackendRun(port=0x00007fe7e0d00db0) + 654 at
postmaster.c:4357
    frame #18: 0x000000010c7f64b3
postgres`BackendStartup(port=0x00007fe7e0d00db0) + 483 at
postmaster.c:4029
    frame #19: 0x000000010c7f54a5 postgres`ServerLoop + 597 at postmaster.c:1753
    frame #20: 0x000000010c7f2c91 postgres`PostmasterMain(argc=8,
argv=0x00007fe7e0c03860) + 5553 at postmaster.c:1361
    frame #21: 0x000000010c716799 postgres`main(argc=8,
argv=0x00007fe7e0c03860) + 761 at main.c:228
    frame #22: 0x00007fff8333a5ad libdyld.dylib`start + 1
(lldb) f 1
frame #1: 0x000000010c6fd9e0 postgres`rb_insert(rb=0x00007fe7e2029850,
data=0x00007fff5380aa10, isNew="") + 128 at rbtree.c:419
   416 /*
   417 * Found node with given key.  Apply combiner.
   418 */
-> 419 rb->combiner(current, data, rb->arg);
   420 *isNew = false;
   421 return current;
   422 }
(lldb) print *rb
(RBTree) $2 = {
  root = 0x00007fe7e4419b60
  node_size = 40
  comparator = 0x000000010cffc310 (test_rbtree.so`cmp at int_rbtree.h:28)
  combiner = 0x0000000000000000
  allocfunc = 0x000000010cffc340 (test_rbtree.so`alloc at int_rbtree.h:37)
  freefunc = 0x000000010cffc370 (test_rbtree.so`fr at int_rbtree.h:45)
  arg = 0x0000000000000000
}

-- 
Thomas Munro
http://www.enterprisedb.com


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to