BIND 10 #2857: memory manager initial exchanges
BIND 10 Development
do-not-reply at isc.org
Mon Jun 17 15:58:38 UTC 2013
#2857: memory manager initial exchanges
-------------------------------------+-------------------------------------
Reporter: jinmei | Owner:
Type: task | Status: new
Priority: medium | Milestone: New
Component: shmem | Tasks
manager | Resolution:
Keywords: | CVSS Scoring:
Sensitive: 0 | Defect Severity: N/A
Sub-Project: DNS | Feature Depending on Ticket:
Estimated Difficulty: 5 | shared memory data source
Total Hours: 0 | Add Hours to Ticket: 0
| Internal?: 0
-------------------------------------+-------------------------------------
Description changed by jinmei:
Old description:
> Subtask of #2830. Depend on #2856, and msgq membership notification
> framework (#2931).
>
> In this task, complete the memmgr side of
> http://bind10.isc.org/wiki/SharedMemoryIPC#a5.1.InitialStartup
>
> Deal with the case where a reader dies at any timing.
New description:
(Revised, based on more details of resulting #2854, although the
details may even change more after review.)
Subtask of #2830. Depend on #2856.
In this task, we focus on the exchange between the main memmgr thread
and the builder thread introduced in #2855. Handling users will be
deferred to #2858 (on a closer look the initial and update exchanges
don't seem to be so different).
In this ticket we extend the `Memmgr` class as follows:
- add a new `__init_segments()` method. It passes to the builder a
set of 'load' commands for all initial `SegmentInfo` objects.
It would look like:
{{{#!python
def __init_segments(self, datasrc_info):
for key, sgmt_info in datasrc_info.segment_info_map.items():
rrclass, dsrc_name = key
clist = self._datasrc_clients_mgr.get_client_list(rrclass)
cmd = ('load', None, dsrc_name, rrclass, clist, sgmt_info)
sgmt_info.add_event(cmd)
init_cmd = sgmt_info.start_update()
assert cmd == ret_cmd and sgmt_info.state == UPDATING
with self.__cv_commands:
self.__command_queue.append(cmd)
self.__cv_command.notify()
}}}
- update `_setup_module()` so it will register the socket with the
builder thread with a callback method of `__handle_builder_result`:
{{{#!python
def _setup_module(self):
"""Module specific initialization for BIND10Server."""
# create the builder thread. register read event with callback
sockets = socket.socketpair()
self.__builder = SegmentBuilder(sockets[1])
self.watch_fileno(sockets[0], self.__handle_builder_result, None,
None)
....
}}}
- update `_datasrc_config_handler()` to call `__init_segments()`:
{{{#!python
self._datasrc_info_list.append(datasrc_info)
self.__init_segments(datasrc_info) # #2857 fodder
}}}
- add `__handle_builder_result()` method. for now it only handles the
case where `SegmentInfo.complete_update()` returns a new command:
{{{#!python
def __handle_builder_result(self):
self.__sock_from_builder.recv(1) # received data don't matter
updates = []
with self.__lock_update_queue:
updates = self.__update_queue
self.__update_queue = []
# for each update, do the following:
event, dsrc_info, rrclass, dsrc_name = updates.pop(0)
if event == 'load-completed':
sgmt_info = dsrc_info.segment_info_map((rrclass, dsrc_name))
cmd = sgmt_info.complete_update()
if cmd is not None:
# send the command to the builder
elif len(sgmt_info.old_readers) > 0:
# notify old readers, deferred to #2858
}}}
--
--
Ticket URL: <http://bind10.isc.org/ticket/2857#comment:2>
BIND 10 Development <http://bind10.isc.org>
BIND 10 Development
More information about the bind10-tickets
mailing list