BIND 10 trac1976-cont-3, updated. 64d096e98b2f1803e0e5f5f36986a59c4cd90dff [1976] Remove more unused code
BIND 10 source code commits
bind10-changes at lists.isc.org
Thu Jul 19 09:31:19 UTC 2012
The branch, trac1976-cont-3 has been updated
via 64d096e98b2f1803e0e5f5f36986a59c4cd90dff (commit)
from 65a9d49f2f80d46fd1852a9ebc789a7c1367a398 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 64d096e98b2f1803e0e5f5f36986a59c4cd90dff
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Thu Jul 19 11:27:53 2012 +0200
[1976] Remove more unused code
This one is mostly the hot-spot cache. The new data source model does
not use it at all. Also, the parameters to tune it were removed.
-----------------------------------------------------------------------
Summary of changes:
src/bin/auth/auth_srv.cc | 30 +++--------------
src/bin/auth/auth_srv.h | 24 +-------------
src/bin/auth/b10-auth.xml | 13 --------
src/bin/auth/benchmarks/query_bench.cc | 38 ++++------------------
src/bin/auth/main.cc | 9 ++---
src/bin/auth/tests/auth_srv_unittest.cc | 14 ++------
src/bin/auth/tests/command_unittest.cc | 2 +-
src/bin/auth/tests/config_unittest.cc | 2 +-
src/bin/bind10/bind10.xml | 11 -------
src/bin/bind10/bind10_src.py.in | 9 ++---
src/bin/bind10/tests/bind10_test.py.in | 2 --
tests/lettuce/features/terrain/bind10_control.py | 2 +-
12 files changed, 22 insertions(+), 134 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/bin/auth/auth_srv.cc b/src/bin/auth/auth_srv.cc
index dbba26f..a6e5996 100644
--- a/src/bin/auth/auth_srv.cc
+++ b/src/bin/auth/auth_srv.cc
@@ -221,10 +221,9 @@ private:
AuthSrvImpl(const AuthSrvImpl& source);
AuthSrvImpl& operator=(const AuthSrvImpl& source);
public:
- AuthSrvImpl(const bool use_cache, AbstractXfroutClient& xfrout_client,
+ AuthSrvImpl(AbstractXfroutClient& xfrout_client,
BaseSocketSessionForwarder& ddns_forwarder);
~AuthSrvImpl();
- isc::data::ConstElementPtr setDbFile(isc::data::ConstElementPtr config);
bool processNormalQuery(const IOMessage& io_message, Message& message,
OutputBuffer& buffer,
@@ -247,10 +246,6 @@ public:
ModuleCCSession* config_session_;
AbstractSession* xfrin_session_;
- /// In-memory data source. Currently class IN only for simplicity.
- /// Hot spot cache
- isc::datasrc::HotCache cache_;
-
/// Interval timer for periodic submission of statistics counters.
IntervalTimer statistics_timer_;
@@ -313,8 +308,7 @@ private:
auth::Query query_;
};
-AuthSrvImpl::AuthSrvImpl(const bool use_cache,
- AbstractXfroutClient& xfrout_client,
+AuthSrvImpl::AuthSrvImpl(AbstractXfroutClient& xfrout_client,
BaseSocketSessionForwarder& ddns_forwarder) :
config_session_(NULL),
xfrin_session_(NULL),
@@ -324,10 +318,7 @@ AuthSrvImpl::AuthSrvImpl(const bool use_cache,
xfrout_connected_(false),
xfrout_client_(xfrout_client),
ddns_forwarder_("update", ddns_forwarder)
-{
- // enable or disable the cache
- cache_.setEnabled(use_cache);
-}
+{}
AuthSrvImpl::~AuthSrvImpl() {
if (xfrout_connected_) {
@@ -386,11 +377,10 @@ private:
AuthSrv* server_;
};
-AuthSrv::AuthSrv(const bool use_cache,
- isc::xfr::AbstractXfroutClient& xfrout_client,
+AuthSrv::AuthSrv(isc::xfr::AbstractXfroutClient& xfrout_client,
isc::util::io::BaseSocketSessionForwarder& ddns_forwarder)
{
- impl_ = new AuthSrvImpl(use_cache, xfrout_client, ddns_forwarder);
+ impl_ = new AuthSrvImpl(xfrout_client, ddns_forwarder);
checkin_ = new ConfigChecker(this);
dns_lookup_ = new MessageLookup(this);
dns_answer_ = new MessageAnswer(this);
@@ -470,16 +460,6 @@ AuthSrv::getIOService() {
}
void
-AuthSrv::setCacheSlots(const size_t slots) {
- impl_->cache_.setSlots(slots);
-}
-
-size_t
-AuthSrv::getCacheSlots() const {
- return (impl_->cache_.getSlots());
-}
-
-void
AuthSrv::setXfrinSession(AbstractSession* xfrin_session) {
impl_->xfrin_session_ = xfrin_session;
}
diff --git a/src/bin/auth/auth_srv.h b/src/bin/auth/auth_srv.h
index ef2f121..3d0c5fb 100644
--- a/src/bin/auth/auth_srv.h
+++ b/src/bin/auth/auth_srv.h
@@ -92,13 +92,11 @@ private:
public:
/// The constructor.
///
- /// \param use_cache Whether to enable hot spot cache for lookup results.
/// \param xfrout_client Communication interface with a separate xfrout
/// process. It's normally a reference to an xfr::XfroutClient object,
/// but can refer to a local mock object for testing (or other
/// experimental) purposes.
- AuthSrv(const bool use_cache,
- isc::xfr::AbstractXfroutClient& xfrout_client,
+ AuthSrv(isc::xfr::AbstractXfroutClient& xfrout_client,
isc::util::io::BaseSocketSessionForwarder& ddns_forwarder);
~AuthSrv();
//@}
@@ -187,26 +185,6 @@ public:
/// \brief Return pointer to the Checkin callback function
isc::asiolink::SimpleCallback* getCheckinProvider() const { return (checkin_); }
- /// \brief Set or update the size (number of slots) of hot spot cache.
- ///
- /// If the specified size is 0, it means the size will be unlimited.
- /// The specified size is recorded even if the cache is disabled; the
- /// new size will be effective when the cache is enabled.
- ///
- /// This method never throws an exception.
- ///
- /// \param slots The number of cache slots.
- void setCacheSlots(const size_t slots);
-
- /// \brief Get the current size (number of slots) of hot spot cache.
- ///
- /// It always returns the recorded size regardless of the cache is enabled.
- ///
- /// This method never throws an exception.
- ///
- /// \return The current number of cache slots.
- size_t getCacheSlots() const;
-
/// \brief Set the communication session with a separate process for
/// outgoing zone transfers.
///
diff --git a/src/bin/auth/b10-auth.xml b/src/bin/auth/b10-auth.xml
index 44c036f..37843e3 100644
--- a/src/bin/auth/b10-auth.xml
+++ b/src/bin/auth/b10-auth.xml
@@ -44,7 +44,6 @@
<refsynopsisdiv>
<cmdsynopsis>
<command>b10-auth</command>
- <arg><option>-n</option></arg>
<arg><option>-v</option></arg>
</cmdsynopsis>
</refsynopsisdiv>
@@ -80,18 +79,6 @@
<variablelist>
<varlistentry>
- <term><option>-n</option></term>
- <listitem><para>
- Do not cache answers in memory.
- The default is to use the cache for faster responses.
- The cache keeps the most recent 30,000 answers (positive
- and negative) in memory for 30 seconds (instead of querying
- the data source, such as SQLite3 database, each time).
- </para></listitem>
-<!-- TODO: this is SQLite3 only -->
- </varlistentry>
-
- <varlistentry>
<term><option>-v</option></term>
<listitem><para>
Enable verbose logging mode. This enables logging of
diff --git a/src/bin/auth/benchmarks/query_bench.cc b/src/bin/auth/benchmarks/query_bench.cc
index 2e705e4..6314ab9 100644
--- a/src/bin/auth/benchmarks/query_bench.cc
+++ b/src/bin/auth/benchmarks/query_bench.cc
@@ -77,10 +77,9 @@ protected:
private:
typedef boost::shared_ptr<const IOEndpoint> IOEndpointPtr;
protected:
- QueryBenchMark(const bool enable_cache,
- const BenchQueries& queries, Message& query_message,
+ QueryBenchMark(const BenchQueries& queries, Message& query_message,
OutputBuffer& buffer) :
- server_(new AuthSrv(enable_cache, xfrout_client, ddns_forwarder)),
+ server_(new AuthSrv(xfrout_client, ddns_forwarder)),
queries_(queries),
query_message_(query_message),
buffer_(buffer),
@@ -119,17 +118,12 @@ private:
class Sqlite3QueryBenchMark : public QueryBenchMark {
public:
- Sqlite3QueryBenchMark(const int cache_slots,
- const char* const datasrc_file,
+ Sqlite3QueryBenchMark(const char* const datasrc_file,
const BenchQueries& queries,
Message& query_message,
OutputBuffer& buffer) :
- QueryBenchMark(cache_slots >= 0 ? true : false, queries,
- query_message, buffer)
+ QueryBenchMark(queries, query_message, buffer)
{
- if (cache_slots >= 0) {
- server_->setCacheSlots(cache_slots);
- }
server_->updateConfig(Element::fromJSON("{\"database_file\": \"" +
string(datasrc_file) + "\"}"));
}
@@ -142,7 +136,7 @@ public:
const BenchQueries& queries,
Message& query_message,
OutputBuffer& buffer) :
- QueryBenchMark(false, queries, query_message, buffer)
+ QueryBenchMark(queries, query_message, buffer)
{
configureAuthServer(*server_,
Element::fromJSON(
@@ -274,27 +268,9 @@ main(int argc, char* argv[]) {
switch (datasrc_type) {
case SQLITE3:
- cout << "Benchmark enabling Hot Spot Cache with unlimited slots "
- << endl;
- BenchMark<Sqlite3QueryBenchMark>(
- iteration, Sqlite3QueryBenchMark(0, datasrc_file, queries,
- message, buffer));
-
- cout << "Benchmark enabling Hot Spot Cache with 10*#queries slots "
- << endl;
- BenchMark<Sqlite3QueryBenchMark>(
- iteration, Sqlite3QueryBenchMark(10 * queries.size(), datasrc_file,
- queries, message, buffer));
-
- cout << "Benchmark enabling Hot Spot Cache with #queries/2 slots "
- << endl;
- BenchMark<Sqlite3QueryBenchMark>(
- iteration, Sqlite3QueryBenchMark(queries.size() / 2, datasrc_file,
- queries, message, buffer));
-
- cout << "Benchmark disabling Hot Spot Cache" << endl;
+ cout << "Benchmark with SQLite3" << endl;
BenchMark<Sqlite3QueryBenchMark>(
- iteration, Sqlite3QueryBenchMark(-1, datasrc_file, queries,
+ iteration, Sqlite3QueryBenchMark(datasrc_file, queries,
message, buffer));
break;
case MEMORY:
diff --git a/src/bin/auth/main.cc b/src/bin/auth/main.cc
index be854c9..0abb5b2 100644
--- a/src/bin/auth/main.cc
+++ b/src/bin/auth/main.cc
@@ -85,9 +85,8 @@ my_command_handler(const string& command, ConstElementPtr args) {
void
usage() {
- cerr << "Usage: b10-auth [-u user] [-nv]"
+ cerr << "Usage: b10-auth [-v]"
<< endl;
- cerr << "\t-n: do not cache answers in memory" << endl;
cerr << "\t-v: verbose logging (debug-level)" << endl;
exit(1);
}
@@ -97,14 +96,10 @@ usage() {
int
main(int argc, char* argv[]) {
int ch;
- bool cache = true;
bool verbose = false;
while ((ch = getopt(argc, argv, ":nu:v")) != -1) {
switch (ch) {
- case 'n':
- cache = false;
- break;
case 'v':
verbose = true;
break;
@@ -143,7 +138,7 @@ main(int argc, char* argv[]) {
specfile = string(AUTH_SPECFILE_LOCATION);
}
- auth_server = new AuthSrv(cache, xfrout_client, ddns_forwarder);
+ auth_server = new AuthSrv(xfrout_client, ddns_forwarder);
LOG_INFO(auth_logger, AUTH_SERVER_CREATED);
SimpleCallback* checkin = auth_server->getCheckinProvider();
diff --git a/src/bin/auth/tests/auth_srv_unittest.cc b/src/bin/auth/tests/auth_srv_unittest.cc
index c8b870a..1db1527 100644
--- a/src/bin/auth/tests/auth_srv_unittest.cc
+++ b/src/bin/auth/tests/auth_srv_unittest.cc
@@ -91,7 +91,7 @@ class AuthSrvTest : public SrvTestBase {
protected:
AuthSrvTest() :
dnss_(),
- server(true, xfrout, ddns_forwarder),
+ server(xfrout, ddns_forwarder),
// The empty string is expected value of the parameter of
// requestSocket, not the app_name (there's no fallback, it checks
// the empty string is passed).
@@ -1032,16 +1032,6 @@ TEST_F(AuthSrvTest,
opcode.getCode(), QR_FLAG | AA_FLAG, 1, 1, 1, 0);
}
-TEST_F(AuthSrvTest, cacheSlots) {
- // simple check for the get/set operations
- server.setCacheSlots(10); // 10 = arbitrary choice
- EXPECT_EQ(10, server.getCacheSlots());
-
- // 0 is a valid size
- server.setCacheSlots(0);
- EXPECT_EQ(00, server.getCacheSlots());
-}
-
// Submit UDP normal query and check query counter
TEST_F(AuthSrvTest, queryCounterUDPNormal) {
// The counter should be initialized to 0.
@@ -1677,7 +1667,7 @@ TEST_F(AuthSrvTest, DDNSForwardPushFail) {
}
TEST_F(AuthSrvTest, DDNSForwardClose) {
- scoped_ptr<AuthSrv> tmp_server(new AuthSrv(true, xfrout, ddns_forwarder));
+ scoped_ptr<AuthSrv> tmp_server(new AuthSrv(xfrout, ddns_forwarder));
UnitTestUtil::createRequestMessage(request_message, Opcode::UPDATE(),
default_qid, Name("example.com"),
RRClass::IN(), RRType::SOA());
diff --git a/src/bin/auth/tests/command_unittest.cc b/src/bin/auth/tests/command_unittest.cc
index a679aa7..bb2e7c3 100644
--- a/src/bin/auth/tests/command_unittest.cc
+++ b/src/bin/auth/tests/command_unittest.cc
@@ -63,7 +63,7 @@ namespace {
class AuthCommandTest : public ::testing::Test {
protected:
AuthCommandTest() :
- server_(false, xfrout_, ddns_forwarder_),
+ server_(xfrout_, ddns_forwarder_),
rcode_(-1),
expect_rcode_(0),
itimer_(server_.getIOService())
diff --git a/src/bin/auth/tests/config_unittest.cc b/src/bin/auth/tests/config_unittest.cc
index 748e63b..c4d1db7 100644
--- a/src/bin/auth/tests/config_unittest.cc
+++ b/src/bin/auth/tests/config_unittest.cc
@@ -54,7 +54,7 @@ protected:
AuthConfigTest() :
dnss_(),
rrclass(RRClass::IN()),
- server(true, xfrout, ddns_forwarder),
+ server(xfrout, ddns_forwarder),
// The empty string is expected value of the parameter of
// requestSocket, not the app_name (there's no fallback, it checks
// the empty string is passed).
diff --git a/src/bin/bind10/bind10.xml b/src/bin/bind10/bind10.xml
index 4053783..cfd5b52 100644
--- a/src/bin/bind10/bind10.xml
+++ b/src/bin/bind10/bind10.xml
@@ -47,7 +47,6 @@
<arg><option>-c <replaceable>config-filename</replaceable></option></arg>
<arg><option>-i</option></arg>
<arg><option>-m <replaceable>file</replaceable></option></arg>
- <arg><option>-n</option></arg>
<arg><option>-p <replaceable>data_path</replaceable></option></arg>
<arg><option>-u <replaceable>user</replaceable></option></arg>
<arg><option>-v</option></arg>
@@ -57,7 +56,6 @@
<arg><option>--config-file</option> <replaceable>config-filename</replaceable></arg>
<arg><option>--data-path</option> <replaceable>directory</replaceable></arg>
<arg><option>--msgq-socket-file <replaceable>file</replaceable></option></arg>
- <arg><option>--no-cache</option></arg>
<arg><option>--no-kill</option></arg>
<arg><option>--pid-file</option> <replaceable>filename</replaceable></arg>
<arg><option>--pretty-name <replaceable>name</replaceable></option></arg>
@@ -169,15 +167,6 @@
</varlistentry>
<varlistentry>
- <term><option>-n</option>, <option>--no-cache</option></term>
- <listitem>
- <para>Disables the hot-spot caching used by the
- <citerefentry><refentrytitle>b10-auth</refentrytitle><manvolnum>8</manvolnum></citerefentry>
- daemon.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
<term><option>-i</option>, <option>--no-kill</option></term>
<listitem>
<para>When this option is passed, <command>bind10</command>
diff --git a/src/bin/bind10/bind10_src.py.in b/src/bin/bind10/bind10_src.py.in
index b9dbc36..7b71737 100755
--- a/src/bin/bind10/bind10_src.py.in
+++ b/src/bin/bind10/bind10_src.py.in
@@ -168,7 +168,7 @@ class BoB:
"""Boss of BIND class."""
def __init__(self, msgq_socket_file=None, data_path=None,
- config_filename=None, clear_config=False, nocache=False,
+ config_filename=None, clear_config=False,
verbose=False, nokill=False, setuid=None, setgid=None,
username=None, cmdctl_port=None, wait_time=10):
"""
@@ -192,7 +192,6 @@ class BoB:
self.ccs = None
self.curproc = None
self.msgq_socket_file = msgq_socket_file
- self.nocache = nocache
self.component_config = {}
# Some time in future, it may happen that a single component has
# multple processes (like a pipeline-like component). If so happens,
@@ -568,8 +567,6 @@ class BoB:
if self.uid is not None and self.__started:
logger.warn(BIND10_START_AS_NON_ROOT_AUTH)
authargs = ['b10-auth']
- if self.nocache:
- authargs += ['-n']
if self.verbose:
authargs += ['-v']
@@ -1052,8 +1049,6 @@ def parse_args(args=sys.argv[1:], Parser=OptionParser):
parser.add_option("-m", "--msgq-socket-file", dest="msgq_socket_file",
type="string", default=None,
help="UNIX domain socket file the b10-msgq daemon will use")
- parser.add_option("-n", "--no-cache", action="store_true", dest="nocache",
- default=False, help="disable hot-spot cache in authoritative DNS server")
parser.add_option("-i", "--no-kill", action="store_true", dest="nokill",
default=False, help="do not send SIGTERM and SIGKILL signals to modules during shutdown")
parser.add_option("-u", "--user", dest="user", type="string", default=None,
@@ -1208,7 +1203,7 @@ def main():
# Go bob!
boss_of_bind = BoB(options.msgq_socket_file, options.data_path,
options.config_file, options.clear_config,
- options.nocache, options.verbose, options.nokill,
+ options.verbose, options.nokill,
setuid, setgid, username, options.cmdctl_port,
options.wait_time)
startup_result = boss_of_bind.startup()
diff --git a/src/bin/bind10/tests/bind10_test.py.in b/src/bin/bind10/tests/bind10_test.py.in
index 6ed7411..0a17230 100644
--- a/src/bin/bind10/tests/bind10_test.py.in
+++ b/src/bin/bind10/tests/bind10_test.py.in
@@ -349,7 +349,6 @@ class TestBoB(unittest.TestCase):
self.assertEqual(bob.runnable, False)
self.assertEqual(bob.uid, None)
self.assertEqual(bob.username, None)
- self.assertEqual(bob.nocache, False)
self.assertIsNone(bob._socket_cache)
def test_set_creator(self):
@@ -377,7 +376,6 @@ class TestBoB(unittest.TestCase):
self.assertEqual(bob.runnable, False)
self.assertEqual(bob.uid, None)
self.assertEqual(bob.username, None)
- self.assertEqual(bob.nocache, False)
def test_command_handler(self):
class DummySession():
diff --git a/tests/lettuce/features/terrain/bind10_control.py b/tests/lettuce/features/terrain/bind10_control.py
index a08a887..c0370a9 100644
--- a/tests/lettuce/features/terrain/bind10_control.py
+++ b/tests/lettuce/features/terrain/bind10_control.py
@@ -52,7 +52,7 @@ def start_bind10(step, config_file, cmdctl_port, msgq_sockfile, process_name):
It will also fail if there is a running process with the given process_name
already.
"""
- args = [ 'bind10', '-n', '-v' ]
+ args = [ 'bind10', '-v' ]
if config_file is not None:
args.append('-p')
args.append("configurations/")
More information about the bind10-changes
mailing list