|
a/src/rcldb/rcldb.cpp |
|
b/src/rcldb/rcldb.cpp |
|
... |
|
... |
498 |
bool w = m_ndb->m_iswritable;
|
498 |
bool w = m_ndb->m_iswritable;
|
499 |
if (w) {
|
499 |
if (w) {
|
500 |
if (!m_ndb->m_noversionwrite)
|
500 |
if (!m_ndb->m_noversionwrite)
|
501 |
m_ndb->xwdb.set_metadata(cstr_RCL_IDX_VERSION_KEY, cstr_RCL_IDX_VERSION);
|
501 |
m_ndb->xwdb.set_metadata(cstr_RCL_IDX_VERSION_KEY, cstr_RCL_IDX_VERSION);
|
502 |
LOGDEB(("Rcl::Db:close: xapian will close. May take some time\n"));
|
502 |
LOGDEB(("Rcl::Db:close: xapian will close. May take some time\n"));
|
503 |
}
|
|
|
504 |
#ifdef IDX_THREADS
|
503 |
#ifdef IDX_THREADS
|
505 |
waitUpdIdle();
|
504 |
waitUpdIdle();
|
506 |
#endif
|
505 |
#endif
|
507 |
// Used to do a flush here. Cant see why it should be necessary.
|
506 |
}
|
508 |
deleteZ(m_ndb);
|
507 |
deleteZ(m_ndb);
|
509 |
if (w)
|
508 |
if (w)
|
510 |
LOGDEB(("Rcl::Db:close() xapian close done.\n"));
|
509 |
LOGDEB(("Rcl::Db:close() xapian close done.\n"));
|
511 |
if (final) {
|
510 |
if (final) {
|
512 |
return true;
|
511 |
return true;
|
|
... |
|
... |
1488 |
|
1487 |
|
1489 |
// Test for doc existence.
|
1488 |
// Test for doc existence.
|
1490 |
bool Db::docExists(const string& uniterm)
|
1489 |
bool Db::docExists(const string& uniterm)
|
1491 |
{
|
1490 |
{
|
1492 |
#ifdef IDX_THREADS
|
1491 |
#ifdef IDX_THREADS
|
1493 |
// If we're not running our own (single) thread, need to protect
|
1492 |
// Need to protect read db against multiaccess.
|
1494 |
// read db against multiaccess (e.g. from needUpdate(), or this method).
|
|
|
1495 |
PTMutexLocker lock(m_ndb->m_mutex, m_ndb->m_havewriteq);
|
1493 |
PTMutexLocker lock(m_ndb->m_mutex);
|
1496 |
#endif
|
1494 |
#endif
|
1497 |
|
1495 |
|
1498 |
string ermsg;
|
1496 |
string ermsg;
|
1499 |
try {
|
1497 |
try {
|
1500 |
Xapian::PostingIterator docid = m_ndb->xrdb.postlist_begin(uniterm);
|
1498 |
Xapian::PostingIterator docid = m_ndb->xrdb.postlist_begin(uniterm);
|
|
... |
|
... |
1541 |
}
|
1539 |
}
|
1542 |
|
1540 |
|
1543 |
bool Db::purgeFileWrite(const string& udi, const string& uniterm)
|
1541 |
bool Db::purgeFileWrite(const string& udi, const string& uniterm)
|
1544 |
{
|
1542 |
{
|
1545 |
#if defined(IDX_THREADS)
|
1543 |
#if defined(IDX_THREADS)
|
1546 |
// If we have a write queue we're called from there, and single
|
1544 |
// We need a mutex even if we have a write queue (so we can only
|
1547 |
// threaded, no locking. Else need to mutex other threads from
|
1545 |
// be called by a single thread) to protect about multiple acces
|
1548 |
// above
|
1546 |
// to xrdb from subDocs() which is also called from needupdate()
|
|
|
1547 |
// (called from outside the write thread !
|
1549 |
PTMutexLocker lock(m_ndb->m_mutex, m_ndb->m_havewriteq);
|
1548 |
PTMutexLocker lock(m_ndb->m_mutex);
|
1550 |
#endif // IDX_THREADS
|
1549 |
#endif // IDX_THREADS
|
1551 |
|
1550 |
|
1552 |
Xapian::WritableDatabase db = m_ndb->xwdb;
|
1551 |
Xapian::WritableDatabase db = m_ndb->xwdb;
|
1553 |
string ermsg;
|
1552 |
string ermsg;
|
1554 |
try {
|
1553 |
try {
|