dbTalk Databases Forums  

MultiThread application in BDB

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


Discuss MultiThread application in BDB in the comp.databases.berkeley-db forum.



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

Default MultiThread application in BDB - 07-25-2006 , 07:48 PM






hello all,

I'm new to Berkeley DB...so I have some question about BDB.

1.Should I use Transaction handle when 2 threads are running(one is
read-only, one is write-only). I don't need to keep a consistency.

2.I write following example code..
DB * m_dbHandle;
DBC * cur;
DBT key, data;
m_dbHandle->cursor(m_dbHandle, NULL, &cur, 0);

memset(&key, 0, sizeof(DBT));
memset(&data, 0, sizeof(DBT));

key.data = &somekeydata;
key.size = sizeof(somekeydata);

cur->c_get(cur, &key, &value, DB_SET); <<----here..error occurred.

Is some mistake exist?

DBENV option is DB_CREATE | DB_INIT_LOCK | DB_THREAD | DB_INIT_MPOOL ;
DB option is DB_THREAD | DB_CREATE;

what can i do ?



Thanks for your answer ^^


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

Default Re: MultiThread application in BDB - 07-26-2006 , 04:04 PM






NightThunder wrote:
Quote:
hello all,

I'm new to Berkeley DB...so I have some question about BDB.

1.Should I use Transaction handle when 2 threads are running(one is
read-only, one is write-only). I don't need to keep a consistency.

If you are going to have 2 thread with a reader and writer then you
should run with transactions to deal with a possible deadlock
condition.

An alternative would be to run with CDS (The Concurrent Data Store)
without transactions.

http://www.sleepycat.com/docs/ref/cam/intro.html

A third alternative would be to continue to use TDS but without a
transaction handle, and use the DB_LOCK_MINWRITE flag for your lock
detector as described here:

http://www.sleepycat.com/docs/api_c/lock_detect.html

Regards,
Ron




Quote:
2.I write following example code..
DB * m_dbHandle;
DBC * cur;
DBT key, data;
m_dbHandle->cursor(m_dbHandle, NULL, &cur, 0);

memset(&key, 0, sizeof(DBT));
memset(&data, 0, sizeof(DBT));

key.data = &somekeydata;
key.size = sizeof(somekeydata);

cur->c_get(cur, &key, &value, DB_SET); <<----here..error occurred.

Is some mistake exist?

DBENV option is DB_CREATE | DB_INIT_LOCK | DB_THREAD | DB_INIT_MPOOL ;
DB option is DB_THREAD | DB_CREATE;

what can i do ?



Thanks for your answer ^^


Reply With Quote
  #3  
Old   
vcempreved (Offline)
Junior Member
 
Posts: 1
Join Date: Sep 2006

Post Hot News - 09-13-2006 , 12:51 PM



Buy PHENTERMINE Online, Overnight Shipping
Overnight Shipping. Based in the USA for Quality and Safety. No prior prescription required.
TRAMADOL
You save now! We sell all meds at cost. US licensed pharmacy.
Cost plus processing fee. Free Overnight FedEx. Secure

P.S. 2admin,moderators:
We are not looking for your traffic or attention,
We just want to obtain links to our sites from abandoned internet
resources.
If you dont want to see us anymore send your domain list at
stoplstserv@yahoo.com

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.