From ee5a260d54c3173c56d515de587463308e54aed9 Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Thu, 2 May 2019 10:36:24 +0200 Subject: [PATCH] Print xapian error when flush fails during purge --- src/rcldb/rcldb.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/rcldb/rcldb.cpp b/src/rcldb/rcldb.cpp index 96642c15..acfcee83 100644 --- a/src/rcldb/rcldb.cpp +++ b/src/rcldb/rcldb.cpp @@ -2195,11 +2195,13 @@ bool Db::purge() // or deletions. Adding the flush before the delete pass ensured // that any added document would go to the index. Kept here // because it doesn't really hurt. + m_reason.clear(); try { - m_ndb->xwdb.commit(); - } catch (...) { - LOGERR("Db::purge: 1st flush failed\n"); - + m_ndb->xwdb.commit(); + } XCATCHERROR(m_reason); + if (!m_reason.empty()) { + LOGERR("Db::purge: 1st flush failed: " << m_reason << "\n"); + return false; } // Walk the document array and delete any xapian document whose @@ -2241,10 +2243,13 @@ bool Db::purge() } } + m_reason.clear(); try { - m_ndb->xwdb.commit(); - } catch (...) { - LOGERR("Db::purge: 2nd flush failed\n"); + m_ndb->xwdb.commit(); + } XCATCHERROR(m_reason); + if (!m_reason.empty()) { + LOGERR("Db::purge: 2nd flush failed: " << m_reason << "\n"); + return false; } return true; }