Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > bdb: txn.abort/txn.commit immediately exits the txn_begin block

Reply
Thread Tools

bdb: txn.abort/txn.commit immediately exits the txn_begin block

 
 
Yohanes Santoso
Guest
Posts: n/a
 
      09-29-2003
Executing txn.abort/txn.commit within a txn_begin block immediately
exits the block.

Is this the expected behaviour? If so, then it means not all the code
in the ensure block is executed, as guaranteed.


ruby 1.8, bdb 0.4.8, libdb4.1

--------------------------------------------------
require 'bdb41'
db = BDB::Env.new("testdb", BDB::CREATE|BDB::INIT_TRANSACTION|BDB::THREAD)
table = db.open_db(BDB::BTREE, "test", nil, BDB::CREATE)
db.txn_begin(table) {|txn, t|
begin
t[234]='sdfds'
rescue Exception => e
p e
ensure
puts "Aborting trans..."
txn.abort # txn.commit also produces the same result
puts "Trans aborted."
end
}
puts "Test DONE"
--------------------------------------------------

produces:

$ ruby1.8 storage_test.rb
Aborting trans...
Test DONE



YS.

 
Reply With Quote
 
 
 
 
ts
Guest
Posts: n/a
 
      09-29-2003
>>>>> "Y" == Yohanes Santoso <(E-Mail Removed)> writes:

Y> Is this the expected behaviour?

Yes, it's implemented internally with catch/throw


Guy Decoux



 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
splwow64.exe exits immediately and CreateDC fails under IIS Ben Liddicott Windows 64bit 0 07-29-2009 03:06 PM
Problem: Terminal (OS X) window exits immediately on opening. & Solution. Lou Pecora Python 6 03-17-2009 11:56 AM
Fo:Block can you check to see if a block contains any text by using the block id? morrell XML 1 10-10-2006 07:18 PM
system call exits the loop Bob Helber Perl 1 01-13-2004 03:19 PM



Advertisments