Browse Source

[1183] remove searchForRecords(), getNextRecord() and resetSearch()

since they can now be done through getRecords()
Jelte Jansen 13 years ago
parent
commit
d88becea33

+ 1 - 3
src/lib/datasrc/database.cc

@@ -362,22 +362,20 @@ DatabaseClient::Finder::find(const isc::dns::Name& name,
                 result_status = CNAME;
             }
         }
+    // TODO: some of these can be removed
     } catch (const DataSourceError& dse) {
         logger.error(DATASRC_DATABASE_FIND_ERROR)
             .arg(database_->getDBName()).arg(dse.what());
         // call cleanup and rethrow
-        database_->resetSearch();
         throw;
     } catch (const isc::Exception& isce) {
         logger.error(DATASRC_DATABASE_FIND_UNCAUGHT_ISC_ERROR)
             .arg(database_->getDBName()).arg(isce.what());
         // cleanup, change it to a DataSourceError and rethrow
-        database_->resetSearch();
         isc_throw(DataSourceError, isce.what());
     } catch (const std::exception& ex) {
         logger.error(DATASRC_DATABASE_FIND_UNCAUGHT_ERROR)
             .arg(database_->getDBName()).arg(ex.what());
-        database_->resetSearch();
         throw;
     }
 

+ 0 - 54
src/lib/datasrc/database.h

@@ -189,60 +189,6 @@ public:
     }
 
     /**
-     * \brief Starts a new search for records of the given name in the given zone
-     *
-     * The data searched by this call can be retrieved with subsequent calls to
-     * getNextRecord().
-     *
-     * \exception DataSourceError if there is a problem connecting to the
-     *                            backend database
-     *
-     * \param zone_id The zone to search in, as returned by getZone()
-     * \param name The name of the records to find
-     */
-    virtual void searchForRecords(int zone_id, const std::string& name) = 0;
-
-    /**
-     * \brief Retrieves the next record from the search started with searchForRecords()
-     *
-     * Returns a boolean specifying whether or not there was more data to read.
-     * In the case of a database error, a DatasourceError is thrown.
-     *
-     * The columns passed is an array of std::strings consisting of
-     * DatabaseConnection::COLUMN_COUNT elements, the elements of which
-     * are defined in DatabaseConnection::RecordColumns, in their basic
-     * string representation.
-     *
-     * If you are implementing a derived database connection class, you
-     * should have this method check the column_count value, and fill the
-     * array with strings conforming to their description in RecordColumn.
-     *
-     * \exception DatasourceError if there was an error reading from the database
-     *
-     * \param columns The elements of this array will be filled with the data
-     *                for one record as defined by RecordColumns
-     *                If there was no data, the array is untouched.
-     * \return true if there was a next record, false if there was not
-     */
-    virtual bool getNextRecord(std::string columns[], size_t column_count) = 0;
-
-    /**
-     * \brief Resets the current search initiated with searchForRecords()
-     *
-     * This method will be called when the called of searchForRecords() and
-     * getNextRecord() finds bad data, and aborts the current search.
-     * It should clean up whatever handlers searchForRecords() created, and
-     * any other state modified or needed by getNextRecord()
-     *
-     * Of course, the implementation of getNextRecord may also use it when
-     * it is done with a search. If it does, the implementation of this
-     * method should make sure it can handle being called multiple times.
-     *
-     * The implementation for this method should make sure it never throws.
-     */
-    virtual void resetSearch() = 0;
-
-    /**
      * Definitions of the fields as they are required to be filled in
      * by getNextRecord()
      *

+ 0 - 61
src/lib/datasrc/sqlite3_accessor.cc

@@ -362,10 +362,6 @@ convertToPlainChar(const unsigned char* ucp,
 }
 }
 
-// TODO: Once we want to have iterator returned from searchForRecords, this
-// class can be reused. It should be modified to take the sqlite3 statement
-// instead of creating it in constructor, it doesn't have to care which one
-// it is, just provide data from it.
 class SQLite3Database::Context : public DatabaseAccessor::IteratorContext {
 public:
     // Construct an iterator for all records. When constructed this
@@ -468,62 +464,5 @@ SQLite3Database::getAllRecords(const isc::dns::Name&, int id) const {
     return (IteratorContextPtr(new Context(shared_from_this(), id)));
 }
 
-void
-SQLite3Database::searchForRecords(int zone_id, const std::string& name) {
-    resetSearch();
-    if (sqlite3_bind_int(dbparameters_->q_any_, 1, zone_id) != SQLITE_OK) {
-        isc_throw(DataSourceError,
-                  "Error in sqlite3_bind_int() for zone_id " <<
-                  zone_id << ": " << sqlite3_errmsg(dbparameters_->db_));
-    }
-    // use transient since name is a ref and may disappear
-    if (sqlite3_bind_text(dbparameters_->q_any_, 2, name.c_str(), -1,
-                               SQLITE_TRANSIENT) != SQLITE_OK) {
-        isc_throw(DataSourceError,
-                  "Error in sqlite3_bind_text() for name " <<
-                  name << ": " << sqlite3_errmsg(dbparameters_->db_));
-    }
-}
-
-bool
-SQLite3Database::getNextRecord(std::string columns[], size_t column_count) {
-    if (column_count != COLUMN_COUNT) {
-            isc_throw(DataSourceError,
-                    "Datasource backend caller did not pass a column array "
-                    "of size " << COLUMN_COUNT << " to getNextRecord()");
-    }
-
-    sqlite3_stmt* current_stmt = dbparameters_->q_any_;
-    const int rc = sqlite3_step(current_stmt);
-
-    if (rc == SQLITE_ROW) {
-        for (int column = 0; column < column_count; ++column) {
-            try {
-                columns[column] = convertToPlainChar(sqlite3_column_text(
-                                                     current_stmt, column),
-                                                     dbparameters_);
-            } catch (const std::bad_alloc&) {
-                isc_throw(DataSourceError,
-                        "bad_alloc in Sqlite3Connection::getNextRecord");
-            }
-        }
-        return (true);
-    } else if (rc == SQLITE_DONE) {
-        // reached the end of matching rows
-        resetSearch();
-        return (false);
-    }
-    isc_throw(DataSourceError, "Unexpected failure in sqlite3_step: " <<
-                               sqlite3_errmsg(dbparameters_->db_));
-    // Compilers might not realize isc_throw always throws
-    return (false);
-}
-
-void
-SQLite3Database::resetSearch() {
-    sqlite3_reset(dbparameters_->q_any_);
-    sqlite3_clear_bindings(dbparameters_->q_any_);
-}
-
 }
 }

+ 0 - 46
src/lib/datasrc/sqlite3_accessor.h

@@ -99,52 +99,6 @@ public:
     virtual IteratorContextPtr getAllRecords(const isc::dns::Name&,
                                              int id) const;
 
-    /**
-     * \brief Start a new search for the given name in the given zone.
-     *
-     * This implements the searchForRecords from DatabaseConnection.
-     * This particular implementation does not raise DataSourceError.
-     *
-     * \exception DataSourceError when sqlite3_bind_int() or
-     *                            sqlite3_bind_text() fails
-     *
-     * \param zone_id The zone to seach in, as returned by getZone()
-     * \param name The name to find records for
-     */
-    virtual void searchForRecords(int zone_id, const std::string& name);
-
-    /**
-     * \brief Retrieve the next record from the search started with
-     *        searchForRecords
-     *
-     * This implements the getNextRecord from DatabaseConnection.
-     * See the documentation there for more information.
-     *
-     * If this method raises an exception, the contents of columns are undefined.
-     *
-     * \exception DataSourceError if there is an error returned by sqlite_step()
-     *                            When this exception is raised, the current
-     *                            search as initialized by searchForRecords() is
-     *                            NOT reset, and the caller is expected to take
-     *                            care of that.
-     * \param columns This vector will be cleared, and the fields of the record will
-     *                be appended here as strings (in the order rdtype, ttl, sigtype,
-     *                and rdata). If there was no data (i.e. if this call returns
-     *                false), the vector is untouched.
-     * \return true if there was a next record, false if there was not
-     */
-    virtual bool getNextRecord(std::string columns[], size_t column_count);
-
-    /**
-     * \brief Resets any state created by searchForRecords
-     *
-     * This implements the resetSearch from DatabaseConnection.
-     * See the documentation there for more information.
-     *
-     * This function never throws.
-     */
-    virtual void resetSearch();
-
     /// The SQLite3 implementation of this method returns a string starting
     /// with a fixed prefix of "sqlite3_" followed by the DB file name
     /// removing any path name.  For example, for the DB file

+ 2 - 132
src/lib/datasrc/tests/database_unittest.cc

@@ -62,12 +62,6 @@ public:
         return (database_name_);
     }
 
-    // These are just to compile, they won't be called
-    virtual void searchForRecords(int, const std::string&) { }
-    virtual bool getNextRecord(string*, size_t) {
-        return (false);
-    }
-    virtual void resetSearch() { }
 private:
     const std::string database_name_;
 
@@ -82,7 +76,7 @@ private:
  */
 class MockAccessor : public NopAccessor {
 public:
-    MockAccessor() : cur_record(0), search_running_(false)
+    MockAccessor()
     {
         fillData();
     }
@@ -267,83 +261,11 @@ public:
         }
     }
 
-    virtual void searchForRecords(int zone_id, const std::string& name) {
-        search_running_ = true;
-
-        // 'hardcoded' name to trigger exceptions (for testing
-        // the error handling of find() (the other on is below in
-        // if the name is "exceptiononsearch" it'll raise an exception here
-        if (name == "dsexception.in.search.") {
-            isc_throw(DataSourceError, "datasource exception on search");
-        } else if (name == "iscexception.in.search.") {
-            isc_throw(isc::Exception, "isc exception on search");
-        } else if (name == "basicexception.in.search.") {
-            throw std::exception();
-        }
-        searched_name_ = name;
-
-        // we're not aiming for efficiency in this test, simply
-        // copy the relevant vector from records
-        cur_record = 0;
-        if (zone_id == 42) {
-            if (records.count(name) > 0) {
-                cur_name = records.find(name)->second;
-            } else {
-                cur_name.clear();
-            }
-        } else {
-            cur_name.clear();
-        }
-    };
-
-    virtual bool getNextRecord(std::string columns[], size_t column_count) {
-        if (searched_name_ == "dsexception.in.getnext.") {
-            isc_throw(DataSourceError, "datasource exception on getnextrecord");
-        } else if (searched_name_ == "iscexception.in.getnext.") {
-            isc_throw(isc::Exception, "isc exception on getnextrecord");
-        } else if (searched_name_ == "basicexception.in.getnext.") {
-            throw std::exception();
-        }
-
-        if (column_count != DatabaseAccessor::COLUMN_COUNT) {
-            isc_throw(DataSourceError, "Wrong column count in getNextRecord");
-        }
-        if (cur_record < cur_name.size()) {
-            for (size_t i = 0; i < column_count; ++i) {
-                columns[i] = cur_name[cur_record][i];
-            }
-            cur_record++;
-            return (true);
-        } else {
-            resetSearch();
-            return (false);
-        }
-    };
-
-    virtual void resetSearch() {
-        search_running_ = false;
-    };
-
-    bool searchRunning() const {
-        return (search_running_);
-    }
 private:
     std::map<std::string, std::vector< std::vector<std::string> > > records;
-    // used as internal index for getNextRecord()
-    size_t cur_record;
-    // used as temporary storage after searchForRecord() and during
-    // getNextRecord() calls, as well as during the building of the
-    // fake data
+    // used as temporary storageduring the building of the fake data
     std::vector< std::vector<std::string> > cur_name;
 
-    // This boolean is used to make sure find() calls resetSearch
-    // when it encounters an error
-    bool search_running_;
-
-    // We store the name passed to searchForRecords, so we can
-    // hardcode some exceptions into getNextRecord
-    std::string searched_name_;
-
     // Adds one record to the current name in the database
     // The actual data will not be added to 'records' until
     // addCurName() is called
@@ -567,7 +489,6 @@ public:
         shared_ptr<DatabaseClient::Finder> finder(
             dynamic_pointer_cast<DatabaseClient::Finder>(zone.zone_finder));
         EXPECT_EQ(42, finder->zone_id());
-        EXPECT_FALSE(current_database_->searchRunning());
 
         return (finder);
     }
@@ -753,7 +674,6 @@ TEST_F(DatabaseClientTest, find) {
                isc::dns::RRTTL(3600),
                ZoneFinder::SUCCESS,
                expected_rdatas_, expected_sig_rdatas_);
-    EXPECT_FALSE(current_database_->searchRunning());
 
     expected_rdatas_.clear();
     expected_sig_rdatas_.clear();
@@ -764,7 +684,6 @@ TEST_F(DatabaseClientTest, find) {
                isc::dns::RRTTL(3600),
                ZoneFinder::SUCCESS,
                expected_rdatas_, expected_sig_rdatas_);
-    EXPECT_FALSE(current_database_->searchRunning());
 
     expected_rdatas_.clear();
     expected_sig_rdatas_.clear();
@@ -775,7 +694,6 @@ TEST_F(DatabaseClientTest, find) {
                isc::dns::RRTTL(3600),
                ZoneFinder::SUCCESS,
                expected_rdatas_, expected_sig_rdatas_);
-    EXPECT_FALSE(current_database_->searchRunning());
 
     expected_rdatas_.clear();
     expected_sig_rdatas_.clear();
@@ -784,7 +702,6 @@ TEST_F(DatabaseClientTest, find) {
                isc::dns::RRTTL(3600),
                ZoneFinder::NXRRSET,
                expected_rdatas_, expected_sig_rdatas_);
-    EXPECT_FALSE(current_database_->searchRunning());
 
     expected_rdatas_.clear();
     expected_sig_rdatas_.clear();
@@ -794,7 +711,6 @@ TEST_F(DatabaseClientTest, find) {
                isc::dns::RRTTL(3600),
                ZoneFinder::CNAME,
                expected_rdatas_, expected_sig_rdatas_);
-    EXPECT_FALSE(current_database_->searchRunning());
 
     expected_rdatas_.clear();
     expected_sig_rdatas_.clear();
@@ -804,7 +720,6 @@ TEST_F(DatabaseClientTest, find) {
                isc::dns::RRTTL(3600),
                ZoneFinder::SUCCESS,
                expected_rdatas_, expected_sig_rdatas_);
-    EXPECT_FALSE(current_database_->searchRunning());
 
     expected_rdatas_.clear();
     expected_sig_rdatas_.clear();
@@ -813,7 +728,6 @@ TEST_F(DatabaseClientTest, find) {
                isc::dns::RRTTL(3600),
                ZoneFinder::NXDOMAIN,
                expected_rdatas_, expected_sig_rdatas_);
-    EXPECT_FALSE(current_database_->searchRunning());
 
     expected_rdatas_.clear();
     expected_sig_rdatas_.clear();
@@ -825,7 +739,6 @@ TEST_F(DatabaseClientTest, find) {
                isc::dns::RRTTL(3600),
                ZoneFinder::SUCCESS,
                expected_rdatas_, expected_sig_rdatas_);
-    EXPECT_FALSE(current_database_->searchRunning());
 
     expected_rdatas_.clear();
     expected_sig_rdatas_.clear();
@@ -837,7 +750,6 @@ TEST_F(DatabaseClientTest, find) {
                isc::dns::RRTTL(3600),
                ZoneFinder::SUCCESS,
                expected_rdatas_, expected_sig_rdatas_);
-    EXPECT_FALSE(current_database_->searchRunning());
 
     expected_rdatas_.clear();
     expected_sig_rdatas_.clear();
@@ -846,7 +758,6 @@ TEST_F(DatabaseClientTest, find) {
                isc::dns::RRTTL(3600),
                ZoneFinder::NXRRSET,
                expected_rdatas_, expected_sig_rdatas_);
-    EXPECT_FALSE(current_database_->searchRunning());
 
     expected_rdatas_.clear();
     expected_sig_rdatas_.clear();
@@ -857,7 +768,6 @@ TEST_F(DatabaseClientTest, find) {
                isc::dns::RRTTL(3600),
                ZoneFinder::CNAME,
                expected_rdatas_, expected_sig_rdatas_);
-    EXPECT_FALSE(current_database_->searchRunning());
 
     expected_rdatas_.clear();
     expected_sig_rdatas_.clear();
@@ -869,7 +779,6 @@ TEST_F(DatabaseClientTest, find) {
                isc::dns::RRTTL(3600),
                ZoneFinder::SUCCESS,
                expected_rdatas_, expected_sig_rdatas_);
-    EXPECT_FALSE(current_database_->searchRunning());
 
     expected_rdatas_.clear();
     expected_sig_rdatas_.clear();
@@ -881,7 +790,6 @@ TEST_F(DatabaseClientTest, find) {
                isc::dns::RRTTL(3600),
                ZoneFinder::SUCCESS,
                expected_rdatas_, expected_sig_rdatas_);
-    EXPECT_FALSE(current_database_->searchRunning());
 
     expected_rdatas_.clear();
     expected_sig_rdatas_.clear();
@@ -890,7 +798,6 @@ TEST_F(DatabaseClientTest, find) {
                isc::dns::RRTTL(3600),
                ZoneFinder::NXRRSET,
                expected_rdatas_, expected_sig_rdatas_);
-    EXPECT_FALSE(current_database_->searchRunning());
 
     expected_rdatas_.clear();
     expected_sig_rdatas_.clear();
@@ -901,7 +808,6 @@ TEST_F(DatabaseClientTest, find) {
                isc::dns::RRTTL(3600),
                ZoneFinder::CNAME,
                expected_rdatas_, expected_sig_rdatas_);
-    EXPECT_FALSE(current_database_->searchRunning());
 
 
     expected_rdatas_.clear();
@@ -913,7 +819,6 @@ TEST_F(DatabaseClientTest, find) {
                isc::dns::RRTTL(3600),
                ZoneFinder::SUCCESS,
                expected_rdatas_, expected_sig_rdatas_);
-    EXPECT_FALSE(current_database_->searchRunning());
 
     expected_rdatas_.clear();
     expected_sig_rdatas_.clear();
@@ -924,7 +829,6 @@ TEST_F(DatabaseClientTest, find) {
                isc::dns::RRTTL(3600),
                ZoneFinder::SUCCESS,
                expected_rdatas_, expected_sig_rdatas_);
-    EXPECT_FALSE(current_database_->searchRunning());
 
     expected_rdatas_.clear();
     expected_sig_rdatas_.clear();
@@ -935,7 +839,6 @@ TEST_F(DatabaseClientTest, find) {
                isc::dns::RRTTL(3600),
                ZoneFinder::SUCCESS,
                expected_rdatas_, expected_sig_rdatas_);
-    EXPECT_FALSE(current_database_->searchRunning());
 
     expected_rdatas_.clear();
     expected_sig_rdatas_.clear();
@@ -946,7 +849,6 @@ TEST_F(DatabaseClientTest, find) {
                isc::dns::RRTTL(360),
                ZoneFinder::SUCCESS,
                expected_rdatas_, expected_sig_rdatas_);
-    EXPECT_FALSE(current_database_->searchRunning());
 
     expected_rdatas_.clear();
     expected_sig_rdatas_.clear();
@@ -957,77 +859,63 @@ TEST_F(DatabaseClientTest, find) {
                isc::dns::RRTTL(360),
                ZoneFinder::SUCCESS,
                expected_rdatas_, expected_sig_rdatas_);
-    EXPECT_FALSE(current_database_->searchRunning());
 
 
     EXPECT_THROW(finder->find(isc::dns::Name("badcname1.example.org."),
                                               isc::dns::RRType::A(),
                                               NULL, ZoneFinder::FIND_DEFAULT),
                  DataSourceError);
-    EXPECT_FALSE(current_database_->searchRunning());
     EXPECT_THROW(finder->find(isc::dns::Name("badcname2.example.org."),
                                               isc::dns::RRType::A(),
                                               NULL, ZoneFinder::FIND_DEFAULT),
                  DataSourceError);
-    EXPECT_FALSE(current_database_->searchRunning());
     EXPECT_THROW(finder->find(isc::dns::Name("badcname3.example.org."),
                                               isc::dns::RRType::A(),
                                               NULL, ZoneFinder::FIND_DEFAULT),
                  DataSourceError);
-    EXPECT_FALSE(current_database_->searchRunning());
     EXPECT_THROW(finder->find(isc::dns::Name("badrdata.example.org."),
                                               isc::dns::RRType::A(),
                                               NULL, ZoneFinder::FIND_DEFAULT),
                  DataSourceError);
-    EXPECT_FALSE(current_database_->searchRunning());
     EXPECT_THROW(finder->find(isc::dns::Name("badtype.example.org."),
                                               isc::dns::RRType::A(),
                                               NULL, ZoneFinder::FIND_DEFAULT),
                  DataSourceError);
-    EXPECT_FALSE(current_database_->searchRunning());
     EXPECT_THROW(finder->find(isc::dns::Name("badttl.example.org."),
                                               isc::dns::RRType::A(),
                                               NULL, ZoneFinder::FIND_DEFAULT),
                  DataSourceError);
-    EXPECT_FALSE(current_database_->searchRunning());
     EXPECT_THROW(finder->find(isc::dns::Name("badsig.example.org."),
                                               isc::dns::RRType::A(),
                                               NULL, ZoneFinder::FIND_DEFAULT),
                  DataSourceError);
-    EXPECT_FALSE(current_database_->searchRunning());
 
     // Trigger the hardcoded exceptions and see if find() has cleaned up
     EXPECT_THROW(finder->find(isc::dns::Name("dsexception.in.search."),
                                               isc::dns::RRType::A(),
                                               NULL, ZoneFinder::FIND_DEFAULT),
                  DataSourceError);
-    EXPECT_FALSE(current_database_->searchRunning());
     EXPECT_THROW(finder->find(isc::dns::Name("iscexception.in.search."),
                                               isc::dns::RRType::A(),
                                               NULL, ZoneFinder::FIND_DEFAULT),
                  DataSourceError);
-    EXPECT_FALSE(current_database_->searchRunning());
     EXPECT_THROW(finder->find(isc::dns::Name("basicexception.in.search."),
                                               isc::dns::RRType::A(),
                                               NULL, ZoneFinder::FIND_DEFAULT),
                  std::exception);
-    EXPECT_FALSE(current_database_->searchRunning());
 
     EXPECT_THROW(finder->find(isc::dns::Name("dsexception.in.getnext."),
                                               isc::dns::RRType::A(),
                                               NULL, ZoneFinder::FIND_DEFAULT),
                  DataSourceError);
-    EXPECT_FALSE(current_database_->searchRunning());
     EXPECT_THROW(finder->find(isc::dns::Name("iscexception.in.getnext."),
                                               isc::dns::RRType::A(),
                                               NULL, ZoneFinder::FIND_DEFAULT),
                  DataSourceError);
-    EXPECT_FALSE(current_database_->searchRunning());
     EXPECT_THROW(finder->find(isc::dns::Name("basicexception.in.getnext."),
                                               isc::dns::RRType::A(),
                                               NULL, ZoneFinder::FIND_DEFAULT),
                  std::exception);
-    EXPECT_FALSE(current_database_->searchRunning());
 
     // This RRSIG has the wrong sigtype field, which should be
     // an error if we decide to keep using that field
@@ -1041,7 +929,6 @@ TEST_F(DatabaseClientTest, find) {
                isc::dns::RRTTL(3600),
                ZoneFinder::SUCCESS,
                expected_rdatas_, expected_sig_rdatas_);
-    EXPECT_FALSE(current_database_->searchRunning());
 }
 
 TEST_F(DatabaseClientTest, findDelegation) {
@@ -1056,7 +943,6 @@ TEST_F(DatabaseClientTest, findDelegation) {
                isc::dns::RRType::A(), isc::dns::RRType::A(),
                isc::dns::RRTTL(3600), ZoneFinder::SUCCESS, expected_rdatas_,
                expected_sig_rdatas_);
-    EXPECT_FALSE(current_database_->searchRunning());
 
     expected_rdatas_.clear();
     expected_rdatas_.push_back("ns.example.com.");
@@ -1066,7 +952,6 @@ TEST_F(DatabaseClientTest, findDelegation) {
                isc::dns::RRType::NS(), isc::dns::RRType::NS(),
                isc::dns::RRTTL(3600), ZoneFinder::SUCCESS, expected_rdatas_,
                expected_sig_rdatas_);
-    EXPECT_FALSE(current_database_->searchRunning());
 
     // Check when we ask for something below delegation point, we get the NS
     // (Both when the RRset there exists and doesn't)
@@ -1081,7 +966,6 @@ TEST_F(DatabaseClientTest, findDelegation) {
                isc::dns::RRTTL(3600), ZoneFinder::DELEGATION, expected_rdatas_,
                expected_sig_rdatas_,
                isc::dns::Name("delegation.example.org."));
-    EXPECT_FALSE(current_database_->searchRunning());
     doFindTest(finder, isc::dns::Name("ns.delegation.example.org."),
                isc::dns::RRType::AAAA(), isc::dns::RRType::NS(),
                isc::dns::RRTTL(3600), ZoneFinder::DELEGATION, expected_rdatas_,
@@ -1092,7 +976,6 @@ TEST_F(DatabaseClientTest, findDelegation) {
                isc::dns::RRTTL(3600), ZoneFinder::DELEGATION, expected_rdatas_,
                expected_sig_rdatas_,
                isc::dns::Name("delegation.example.org."));
-    EXPECT_FALSE(current_database_->searchRunning());
 
     // Even when we check directly at the delegation point, we should get
     // the NS
@@ -1100,14 +983,12 @@ TEST_F(DatabaseClientTest, findDelegation) {
                isc::dns::RRType::AAAA(), isc::dns::RRType::NS(),
                isc::dns::RRTTL(3600), ZoneFinder::DELEGATION, expected_rdatas_,
                expected_sig_rdatas_);
-    EXPECT_FALSE(current_database_->searchRunning());
 
     // And when we ask direcly for the NS, we should still get delegation
     doFindTest(finder, isc::dns::Name("delegation.example.org."),
                isc::dns::RRType::NS(), isc::dns::RRType::NS(),
                isc::dns::RRTTL(3600), ZoneFinder::DELEGATION, expected_rdatas_,
                expected_sig_rdatas_);
-    EXPECT_FALSE(current_database_->searchRunning());
 
     // Now test delegation. If it is below the delegation point, we should get
     // the DNAME (the one with data under DNAME is invalid zone, but we test
@@ -1122,17 +1003,14 @@ TEST_F(DatabaseClientTest, findDelegation) {
                isc::dns::RRType::A(), isc::dns::RRType::DNAME(),
                isc::dns::RRTTL(3600), ZoneFinder::DNAME, expected_rdatas_,
                expected_sig_rdatas_, isc::dns::Name("dname.example.org."));
-    EXPECT_FALSE(current_database_->searchRunning());
     doFindTest(finder, isc::dns::Name("below.dname.example.org."),
                isc::dns::RRType::AAAA(), isc::dns::RRType::DNAME(),
                isc::dns::RRTTL(3600), ZoneFinder::DNAME, expected_rdatas_,
                expected_sig_rdatas_, isc::dns::Name("dname.example.org."));
-    EXPECT_FALSE(current_database_->searchRunning());
     doFindTest(finder, isc::dns::Name("really.deep.below.dname.example.org."),
                isc::dns::RRType::AAAA(), isc::dns::RRType::DNAME(),
                isc::dns::RRTTL(3600), ZoneFinder::DNAME, expected_rdatas_,
                expected_sig_rdatas_, isc::dns::Name("dname.example.org."));
-    EXPECT_FALSE(current_database_->searchRunning());
 
     // Asking direcly for DNAME should give SUCCESS
     doFindTest(finder, isc::dns::Name("dname.example.org."),
@@ -1148,33 +1026,27 @@ TEST_F(DatabaseClientTest, findDelegation) {
                isc::dns::RRType::A(), isc::dns::RRType::A(),
                isc::dns::RRTTL(3600), ZoneFinder::SUCCESS, expected_rdatas_,
                expected_sig_rdatas_);
-    EXPECT_FALSE(current_database_->searchRunning());
     expected_rdatas_.clear();
     doFindTest(finder, isc::dns::Name("dname.example.org."),
                isc::dns::RRType::AAAA(), isc::dns::RRType::AAAA(),
                isc::dns::RRTTL(3600), ZoneFinder::NXRRSET, expected_rdatas_,
                expected_sig_rdatas_);
-    EXPECT_FALSE(current_database_->searchRunning());
 
     // This is broken dname, it contains two targets
     EXPECT_THROW(finder->find(isc::dns::Name("below.baddname.example.org."),
                               isc::dns::RRType::A(), NULL,
                               ZoneFinder::FIND_DEFAULT),
                  DataSourceError);
-    EXPECT_FALSE(current_database_->searchRunning());
 
     // Broken NS - it lives together with something else
-    EXPECT_FALSE(current_database_->searchRunning());
     EXPECT_THROW(finder->find(isc::dns::Name("brokenns1.example.org."),
                               isc::dns::RRType::A(), NULL,
                               ZoneFinder::FIND_DEFAULT),
                  DataSourceError);
-    EXPECT_FALSE(current_database_->searchRunning());
     EXPECT_THROW(finder->find(isc::dns::Name("brokenns2.example.org."),
                               isc::dns::RRType::A(), NULL,
                               ZoneFinder::FIND_DEFAULT),
                  DataSourceError);
-    EXPECT_FALSE(current_database_->searchRunning());
 }
 
 // Glue-OK mode. Just go trough NS delegations down (but not trough
@@ -1229,13 +1101,11 @@ TEST_F(DatabaseClientTest, glueOK) {
                isc::dns::RRTTL(3600), ZoneFinder::DNAME, expected_rdatas_,
                expected_sig_rdatas_, isc::dns::Name("dname.example.org."),
                ZoneFinder::FIND_GLUE_OK);
-    EXPECT_FALSE(current_database_->searchRunning());
     doFindTest(finder, isc::dns::Name("below.dname.example.org."),
                isc::dns::RRType::AAAA(), isc::dns::RRType::DNAME(),
                isc::dns::RRTTL(3600), ZoneFinder::DNAME, expected_rdatas_,
                expected_sig_rdatas_, isc::dns::Name("dname.example.org."),
                ZoneFinder::FIND_GLUE_OK);
-    EXPECT_FALSE(current_database_->searchRunning());
 }
 
 TEST_F(DatabaseClientTest, getOrigin) {