[pybsddb] BDB Indexing and Joined Cursor issue

Sury Soni ssoni at nextdigital.com
Tue Oct 21 03:37:49 CEST 2008



Your idea is interesting. That should work.


But, I am getting another small exception, is there any work around this
as well.


Exception in search, case 0:  (22, 'Invalid argument -- Cursor position
must be set before performing this operation')

Traceback (most recent call last):

  File "/.../Replica.py", line 282, in search

    if cur.count()>0:

DBInvalidArgError: (22, 'Invalid argument -- Cursor position must be set
before performing this operation')


I am using before invoking cur.count(), 


cur.pget(key=queries[i], flags=DB_SET_RANGE)


I can handle this error, by catching this exception around. But seems
like there is something fundamentally wrong for this cursor







From: pybsddb-bounces at argo.es [mailto:pybsddb-bounces at argo.es] On Behalf
Of phu
Sent: Tuesday, 21 October 2008 12:11 PM
To: Python bindings for Oracle Berkeley DB
Subject: Re: [pybsddb] BDB Indexing and Joined Cursor issue


A workaround (which I had to use) is to ensure that any cursor you're
going to join has at least one result (via count(), I think it was),
only join those that do, and be sure to test for the case of having no
such cursors.

On Mon, Oct 20, 2008 at 7:57 PM, Sury Soni <ssoni at nextdigital.com>

Hi All,


I am having issue in using joined cursor for indexed database.


When, there are no records for given joined cursor, ideally,
jonedCursor.get(0) should return None or raise some exception.


But, in my case, I am getting 


(-30975, 'DB_RUNRECOVERY: Fatal error, run database recovery -- PANIC:
Invalid argument')

Traceback (most recent call last):

  File "dbNode.py", line 71, in next

    data = self.joinedCursor.get(0)




Exception in destroy:  (-30975, 'DB_RUNRECOVERY: Fatal error, run
database recovery -- PANIC: fatal region error detected; run recovery')

Traceback (most recent call last):

  File "dbNode.py", line 91, in destroy



Is there any quick fix solution I can do?


If these exceptions are getting raised due to some other replication
related issue, there is no mechanism I can get that error code and
handle the error accordingly.


When I look into the source code, I can see following comments around
this join function wrapper API.


    /* FIXME: this is a buggy interface.  The returned cursor

       contains internal references to the passed in cursors

       but does not hold python references to them or prevent

       them from being closed prematurely.  This can cause

       python to crash when things are done in the wrong order. */

Sury Prakash Soni

Next Digital
Level 8, 15 William St, Melbourne 
VIC 3000 Australia
p +61 3 8612 6888
f  +61 3 8612 6899
m 0433 661 327
ssoni at nextdigital.com <mailto:ssoni at nextdigital.com> 
www.nextdigital.com <http://www.nextdigital.com/> 

This email and any attachments are intended only for the use of the
recipient and may be confidential and/or legally privileged. Next
Digital Group Pty Ltd ("Next Digital") disclaims liability for any
errors, omissions, viruses, loss and/or damage arising from using,
opening or transmitting this email. If you are not the intended
recipient you must not use, interfere with, disclose, copy or retain
this email and you should notify the sender immediately by return email
or by contacting Next Digital by telephone on +61 3 8612 6888.


pybsddb mailing list
pybsddb at argo.es


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.jcea.es/pipermail/pybsddb/attachments/20081021/90ace3bd/attachment.htm>

More information about the pybsddb mailing list