dbTalk Databases Forums  

Strange cursor problem after upgrading to db-4.4

comp.databases.berkeley-db comp.databases.berkeley-db


Discuss Strange cursor problem after upgrading to db-4.4 in the comp.databases.berkeley-db forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
leon
 
Posts: n/a

Default Strange cursor problem after upgrading to db-4.4 - 12-01-2005 , 09:48 AM






Hello
My application does iteration in reverse order over duplicate keys in a
secondary database.
It uses the following code:

bool res;
if (res = (cursorPtr->get(&dbKey, &dbData, DB_SET) == 0)) {
// if iterating backwards, need to find last element with the same key
// by DB_NEXT_NODUP, and then DB_PREV
if (res = cursorPtr->get(&dbKey, &dbData, DB_NEXT_NODUP) ==
0) { // <=== CRASH
res = cursorPtr->get(&dbKey, &dbData, DB_PREV)
== 0;
}
}

the code crashes when trying to get data from cursor with DB_NEXT_NODUP
flag.

The weird thing is, in db-4.3.29 it works fine

The stack is:
#0 0x404a40b4 in __db_c_get (dbc_arg=0x868b0d0, key=0x8645314,
data=0xbfff72c0, flags=20) at ../dist/../db/db_cam.c:801
#1 0x404a5cfb in __db_c_pget (dbc=0x868cc10, skey=0x8645314,
pkey=0xbfff72c0, data=0x864532c, flags=20) at
.../dist/../db/db_cam.c:1776
#2 0x404b0177 in __db_c_pget_pp (dbc=0x868cc10, skey=0x8645314,
pkey=0x0, data=0x864532c, flags=20) at ../dist/../db/db_iface.c:2109
#3 0x404a59ce in __db_c_secondary_get_pp (dbc=0x868cc10,
skey=0x8645314, data=0x864532c, flags=20) at
.../dist/../db/db_cam.c:1621
#4 0x4054a366 in Dbc::get (this=0x868cc10, key=0x8645314,
data=0x864532c, _flags=20) at ../dist/../cxx/cxx_dbc.cpp:80

Please help!!
Thanks in advance,

Leon


Reply With Quote
  #2  
Old   
Ron
 
Posts: n/a

Default Re: Strange cursor problem after upgrading to db-4.4 - 12-02-2005 , 10:48 AM






We have opened a Support Request inside Sleepycat to investigate and
resolve
this issue.

Ron


Reply With Quote
  #3  
Old   
leon
 
Posts: n/a

Default Re: Strange cursor problem after upgrading to db-4.4 - 12-09-2005 , 07:23 AM



Hi,
apparently, DB_NEXT_NODUP needs some extra memory allocation, so the
memory supplied for the key in DB_SET isn't sufficient.
I've tried the following code:

if (res = cursorPtr->get(&dbKey, &dbData, DB_SET) == 0) {
Dbt tmpKey;
memset(&tmpKey, 0, sizeof(tmpKey));
tmp.set_flags(DB_DBT_REALLOC);
if (res = cursorPtr->get(&tmpKey, &dbData, DB_NEXT_NODUP) == 0)

also, I've upgraded the g++ compiler version to 3.4.3, and the
application seems to work ok now.
Thank you

Regards,
Leon


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.