search for: begin_transact

Displaying 6 results from an estimated 6 matches for "begin_transact".

2004 May 05
1
buffered tables, sessions, and transactions
...unimplemented transaction methods. The idea is to allow a group of operations to be specified as being applied as a unit. Either they all are applied, or none are. http://www.xapian.org/docs/apidoc/html/classXapian_1_1WritableDatabase.html#a7 This is actually very easy to implement like so: * begin_transaction flushes any pending changes and sets an "in_transaction" flag * if "in_transaction" is set, we ignore explicit flushes and don't autoflush * cancel_transaction closes and reopens the Btree table (or calls a new method of Btree which has this effect but without all t...
2008 Mar 14
0
Adding before / after blocks to every spec
...dry. I''m trying to write an rspec plugin module for merb that will run all specs within an ActiveRecord (initially) database transaction - to give functionality similar to rails transactional fixtures. Here is the module: module Merb module Test module TransactionalSpecs def begin_transaction ActiveRecord::Base.send :increment_open_transactions ActiveRecord::Base.connection.begin_db_transaction end def rollback_transaction if Thread.current[''open_transactions''] != 0 ActiveRecord::Base.connection.rollback_db_transaction...
2013 Jun 19
2
Compact databases and removing stale records at the same time
...Xapian::Enquire enquire(*srcdb); enquire.set_query(Xapian::Query::MatchAll); Xapian::MSet matches = enquire.get_mset(0, srcdb->get_doccount()); /* create a destination database */ Xapian::WritableDatabase *destdb = new Xapian::WritableDatabase(dest, Xapian::DB_CREATE_OR_OPEN); destdb->begin_transaction(); /* copy all matching documents to the new DB */ for (Xapian::MSetIterator i = matches.begin() ; i != matches.end() ; ++i) { Xapian::Document doc = i.get_document(); std::string cyrusid = doc.get_value(SLOT_CYRUSID); if (cb(cyrusid.c_str(), rock)) { destdb->add_document(...
2023 Mar 27
1
manual flushing thresholds for deletes?
On Mon, Mar 27, 2023 at 11:22:09AM +0000, Eric Wong wrote: > Olly Betts <olly at survex.com> wrote: > > 10 seems too long. You want the mean word length weighted by frequency > > of occurrence. For English that's typically around 5 characters, which > > is 5 bytes. If we go for +1 that's: > > Actually, 10 may be too short in my case since there's a
2018 Mar 30
2
sorting large msets
...; use Time::HiRes qw(clock_gettime CLOCK_MONOTONIC); my $tmp = tempdir('xapian-test-XXXXXXX', CLEANUP => 1, TMPDIR => 1); my $flag = Search::Xapian::DB_CREATE_OR_OPEN; my $xdb = Search::Xapian::WritableDatabase->new($tmp, $flag); my $n = shift || 100; for my $i (0..$n) { $xdb->begin_transaction; for my $j (0..2000) { my $doc = Search::Xapian::Document->new; my $num = Search::Xapian::sortable_serialise(($i * 1000) + $j); $doc->add_value(0, $num); $doc->set_data("$i $j"); $doc->add_boolean_term('T' . 'mail'); $xdb->add_document($doc);...
2023 May 03
1
manual flushing thresholds for deletes?
...Perl deletion code is something like: my $EST_LEN = 6; ... for my $docid (@docids) { $TXN_BYTES -= $xdb->get_doclength($docid) * $EST_LEN; $xdb->delete_document($docid); if ($TXN_BYTES < 0) { # flush within txn $xdb->commit_transaction; $TXN_BYTES = 8000000; $xdb->begin_transaction; } } > > (that awk bit should be overflow-free) <snip> > Or use a language which supports arbitrary precision > numbers. Actually, I just used gawk instead of mawk for GMP support :>