Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Berkely DB > Queue Peek
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 1751 of 1804
Post > Topic >>

Queue Peek

by yoav.aviram@[EMAIL PROTECTED] May 27, 2007 at 08:52 AM

I am working on implementing a persistent queue system based on
Berkeley DB queue access method.
For my new queue implementation I need to implement a 'peek' method.
This method should return the next available record from the head of
the queue, but not delete it.

The desired behavior is much like doing a 'get' with 'DB_CONSUME' or
'DB_CONSUME_WAIT', but without the CONSUME part.
How would I go about implementing such behavior?

For now I only see two alternatives - both having problems:
1. I can use a cursor starting at the head of the queue, and working
my way down (using 'DB_NEXT').
   The problem with this method is that in parallel to the 'peek'
operations, pop operations are done (actually more like delete).
   This causes the tail of the queue to become a hotspot - locking the
cursor.
   Also I have cases where the cursor skips records despite the use of
' DB_INORDER'.
2. I can use a 'get' operation with 'DB_CONSUME_WAIT', and then
rollback the transaction.
    This seems both inelegant and IO wasteful.

Any ideas?
- Thanks, Yoav.
 




 1 Posts in Topic:
Queue Peek
yoav.aviram@[EMAIL PROTEC  2007-05-27 08:52:24 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan13V112 Sun Jul 20 0:29:26 CDT 2008.