[Xapian-discuss] xapian-tcpsrv need to reopen database?

Rafael Jorge sdm at underlinux.com.br
Mon May 22 03:52:08 BST 2006


On 5/20/06, Olly Betts <olly at survex.com> wrote:
>
> You already can - use a stub database to specify each remote database and
> get Omega to open the stub databases by specifying multiple DB
> parameters (or multiple databases in one DB parameter, separated by '/').
>
> Or you can list multiple remote databases (or a mixture of local and
> remote) in a single stub database if that's more useful.
>
> The stub database is a text file whose format is documented here:
>
> http://www.xapian.org/docs/overview.html


yes, I'm thinking in use the Omega with some modifications, no Python
code...xD

You should just be able to call reopen() on the Xapian.Database object
> in your python script, but this doesn't appear to be implemented.  I'll
> sort that out.
>

Look my (ugly) patch (looks work):
---------------------------------------->8 Cut here
8<---------------------------------------
bash-3.00$ diff -u xapian-core-0.9.5/net/tcpserver.cc
xapian-core-0.9.5-patch1/net/tcpserver.cc
--- xapian-core-0.9.5/net/tcpserver.cc  2006-04-08 16:59:34.000000000 -0300
+++ xapian-core-0.9.5-patch1/net/tcpserver.cc   2006-05-21 23:42:
01.000000000 -0300
@@ -182,7 +182,20 @@
                               msecs_idle_timeout, timing);
 #endif /* TIMING_PATCH */
            sserv.run();
-       } catch (const Xapian::Error &err) {
+    } catch (const Xapian::DatabaseModifiedError &) {
+        cerr << "Database modified - calling db.reopen()" << endl;
+        db.reopen();
+#ifndef TIMING_PATCH
+        SocketServer sserv(db, connected_socket, -1,
+                   msecs_active_timeout,
+                   msecs_idle_timeout);
+#else /* TIMING_PATCH */
+        SocketServer sserv(db, connected_socket, -1,
+                   msecs_active_timeout,
+                   msecs_idle_timeout, timing);
+#endif /* TIMING_PATCH */
+        sserv.run();
+    } catch (const Xapian::Error &err) {
            cerr << "Got exception " << err.get_type()
                 << ": " << err.get_msg() << endl;
        } catch (...) {
---------------------------------------->8 Cut here
8<---------------------------------------

It's just a copy-paste from the "catch"s of line 266 with the code of the
line 175~184 (yes, I know that should be another function, but I'm just
testing)

I hope that this help with the project

-- 
SDM Underlinux
Garimpar.com
--
PEP-8
"Mais vale um ponteiro na mao do que duas classes voando"


More information about the Xapian-discuss mailing list