dbTalk Databases Forums  

recovery question

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


Discuss recovery question in the comp.databases.berkeley-db forum.



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

Default recovery question - 07-06-2005 , 01:36 PM






the following little piece of code works fine. Now i want to undo the
"myDb.puttid,&key,&data,0)", which means i don't want to store the data
after i done the .put. I know I can delete the record, but can i use
recovery or other way to achieve the undo. Could anyone help me,
thanks!
************************************************** *********
u_int32_t env_flags=DB_CREATE|DB_INIT_MPOOL|DB_INIT_TXN;
u_int32_t db_flags=DB_CREATE

DbEnv my Env(0);
myEnv.open("env", env_flags,0);

DbTxn *tid;
myEnv.txn_begin(NULL,&tid,0);

Db myDb(&myEnv,0);
myDb.open(tid,"../test_db/myDb.db",NULL,DB_BTREE,db_flags,0);

int i=1;
char *a="hello world"

Dbt key(&i, sizeof(int));
Dbt data(a, strlen(a)+1);

myDb.put(tid,&key,&data,0);

tid->commit(0);
*****************************************


Reply With Quote
  #2  
Old   
Michael Cahill
 
Posts: n/a

Default Re: recovery question - 07-06-2005 , 06:24 PM






Quote:
the following little piece of code works fine. Now i want to undo the
"myDb.puttid,&key,&data,0)", which means i don't want to store the data
after i done the .put. I know I can delete the record, but can i use
recovery or other way to achieve the undo.
If you abort the transaction instead of committing it, the Db.put will
be undone (but so will the open -- it's all or nothing).

Regards,
Michael.



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 - 2013, Jelsoft Enterprises Ltd.