Ticket #2212 (closed task: complete)

Opened 9 months ago

Last modified 7 months ago

support "load zone" command in the configurator thread

Reported by: jinmei Owned by: jinmei
Priority: medium Milestone: Sprint-20121106
Component: b10-auth Keywords:
Cc: CVSS Scoring:
Sensitive: no Defect Severity: N/A
Sub-Project: DNS Feature Depending on Ticket: background zone loading
Estimated Difficulty: 5 Add Hours to Ticket: 0
Total Hours: 5.5 Internal?: no

Description (last modified by jinmei) (diff)

(We probably don't have time to do this for the September release)

A subtask of #2201, depend on #2202, #2203, #2205, #2209

This task extends the newly introduced "data source configurator"
thread (#2205) to support background zone reloading.

It will be based on the current content of LoadZoneCommand::exec(),
but works as follows:

  • first call ConfigurableClientList::getCacheZoneUpdater() introduced in #2209
  • then call updater->load()
  • then acquire the lock introduced in #2202
  • then call updater->install()
  • then release the lock
  • then call updater->cleanup().

Note that updater operations can throw.

Change History

comment:1 Changed 9 months ago by jinmei

  • Description modified (diff)

comment:2 Changed 8 months ago by muks

  • Milestone set to Next-Sprint-Proposed

comment:3 Changed 8 months ago by jelte

  • Milestone set to Sprint-20121023

comment:4 Changed 7 months ago by jinmei

  • Owner set to jinmei
  • Status changed from new to accepted

comment:5 Changed 7 months ago by jinmei

I've pushed some initial work for this task at branch trac2212.

It added the "LODAZONE" command for the loader thread, and ported
the current command handler code in a mostly straightforward way.
corresponding tests in command_unittest were also ported.

When #2209 is done, we'll update the doLoadZone() internal
as described in this ticket based on (snapshot of) #2209, and
adjust tests.

I'm going to release this ticket now. Please feel free to take it
over if #2209 is completed soon.

comment:6 Changed 7 months ago by jinmei

  • Owner changed from jinmei to UnAssigned
  • Status changed from accepted to assigned

comment:7 Changed 7 months ago by jinmei

  • Owner changed from UnAssigned to jinmei
  • Status changed from assigned to accepted

comment:8 follow-up: ↓ 14 Changed 7 months ago by jinmei

This task is ready for review at the trac2212-2 branch (note: not
"trac2212", which has also been pushed).

I first merged a snapshot of trac2209 (03499b1), which should be
ignored.

The main changes (in datasrc_clients_mgr.h) should be pretty
straightforward. For tests, I mainly ported current tests using
the old interface in command_unittest. Porting them is mostly
straightforward, but see commit logs starting with "ported command
test".

There's one thing I may have to update when trac2209 is merged:

    case datasrc::ConfigurableClientList::ZONE_RELOADED: // XXX misleading name
        assert(writerpair.second);
        return (writerpair.second);

IMO this result code is misleading, and I pointed it out in my review
for trac2209. If we agree on changing this, we'll need to update this
code too. But this should be a trivial adjustment and I believe can
be done on merge of this branch.

comment:9 Changed 7 months ago by jinmei

  • Owner changed from jinmei to UnAssigned
  • Status changed from accepted to reviewing

comment:10 Changed 7 months ago by jelte

  • Owner changed from UnAssigned to jelte

comment:11 follow-up: ↓ 12 Changed 7 months ago by jelte

  • Owner changed from jelte to jinmei

there is a compilation issue in getZoneWriter() (datasrc_clients_mgr.h); some compilers still need a return statement;

I suggest adding something like

    // all cases above should either return or throw, but some compilers
    // still need a return statement
    return (boost::shared_ptr<datasrc::memory::ZoneWriter>());

at the end of getZoneWriter()

auth_messages.mes:

I have several small fixes for the COMMAND_ERROR log message, I'd propose making it this text:

The separate thread for maintaining data source clients failed to complete a
command given by the main thread.  In most cases this is some kind of
configuration or temporary error such as an attempt to load a non-existent
zone or a temporary DB connection failure.  So the event is just logged and
the thread keeps running.  In some rare cases, however, this may indicate an
internal bug and it may be better to restart the entire program, so the log
message should be carefully examined.

The death tests recently got an additional check (so that valgrind doesn't fail on them, at least if valgrind.h is available), so any code that does EXPECT_DEATH should include <util/unittests/check_valgrind.h>, and put

    if (!isc::util::unittests::runningOnValgrind()) {
    }

around the EXPECT_DEATH(_IF_SUPPORTED) macros
(as an example, see buffer_unittest.c)

(note that we are considering removing this again and provide an environment option to simply skip all death tests, as this is really the only place valgrind can't handle, but until that is decided this is the best we have for valgrind not to fail on death tests)

Oh, and FYI, maybe not entirely related to this branch (but it is about new code here), I plan to make a slight change in doLoadZone(); and put the 'default to IN if class not provided' code there, in trac2213; it is easier (both in code and in cycles) to do that check here, instead of in the code sending the thread command, as that code is dealing with a const element, and would need to recreate the 'entire' args variable (granted, it isn't that big). Other checks will go in the code i'll add in 2213, but it can only check, not modify data (without reconstructing 'everything').

comment:12 in reply to: ↑ 11 Changed 7 months ago by jinmei

Thanks for the review.

Replying to jelte:

there is a compilation issue in getZoneWriter() (datasrc_clients_mgr.h); some compilers still need a return statement;

I suggest adding something like

    // all cases above should either return or throw, but some compilers
    // still need a return statement
    return (boost::shared_ptr<datasrc::memory::ZoneWriter>());

at the end of getZoneWriter()

Ah, okay, added.

auth_messages.mes:

I have several small fixes for the COMMAND_ERROR log message, I'd propose making it this text:

Thanks, adopted.

The death tests recently got an additional check (so that valgrind doesn't fail on them, at least if valgrind.h is available), so any code that does EXPECT_DEATH should include <util/unittests/check_valgrind.h>, and put

    if (!isc::util::unittests::runningOnValgrind()) {
    }

around the EXPECT_DEATH(_IF_SUPPORTED) macros
(as an example, see buffer_unittest.c)

Okay, done.

Oh, and FYI, maybe not entirely related to this branch (but it is about new code here), I plan to make a slight change in doLoadZone(); and put the 'default to IN if class not provided' code there, in trac2213; it is easier (both in code and in cycles) to do that check here, instead of in the code sending the thread command, as that code is dealing with a const element, and would need to recreate the 'entire' args variable (granted, it isn't that big). Other checks will go in the code i'll add in 2213, but it can only check, not modify data (without reconstructing 'everything').

Hmm, I'm okay with leaving the default handling to the builder per se,
but I'd like to avoid hardcoding the value. The default is given in
the spec, and the implementation should retrieve the default from it.
But to do so, it needs to be able to access ModuleCCSession, and
at least right now the builder doesn't have the access (and I'd like
to keep it that way so that the builder is as independent as
possible). I know it requires the reconstructing the message, but in
this case it's a simple name, class pair, so I think it's not a big
overhead for the sender.

comment:13 Changed 7 months ago by jinmei

  • Owner changed from jinmei to jelte

comment:14 in reply to: ↑ 8 Changed 7 months ago by jinmei

Replying to jinmei:

There's one thing I may have to update when trac2209 is merged:

    case datasrc::ConfigurableClientList::ZONE_RELOADED: // XXX misleading name
        assert(writerpair.second);
        return (writerpair.second);

IMO this result code is misleading, and I pointed it out in my review
for trac2209. If we agree on changing this, we'll need to update this
code too. But this should be a trivial adjustment and I believe can
be done on merge of this branch.

Based on the latest status of #2209, I'll change this part as follows:

-    case datasrc::ConfigurableClientList::ZONE_RELOADED: // XXX misleading name
+    case datasrc::ConfigurableClientList::ZONE_SUCCESS:

(But I won't merge #2209 in this branch just for this, in order to
keep it easier to track. I'll just make this change on final merge -
if I forget it, the compiler will soon notice that).

comment:15 follow-up: ↓ 16 Changed 7 months ago by jelte

  • Owner changed from jelte to jinmei

Changes look fine, and this branch is good for merge, I'll see about the default issue in 2213

comment:16 in reply to: ↑ 15 Changed 7 months ago by jinmei

Replying to jelte:

Changes look fine, and this branch is good for merge, I'll see about the default issue in 2213

Okay, merge done, closing the ticket.

comment:17 Changed 7 months ago by jinmei

  • Status changed from reviewing to closed
  • Total Hours changed from 0 to 5.5
  • Resolution set to complete
Note: See TracTickets for help on using tickets.