upgrade of supervisors child specifications

Bengt Kleberg eleberg@REDACTED
Fri Apr 25 17:06:24 CEST 2003


greetings,

how do i change (when doing an upgrade) the contents of a supervisors
child specifications?


background:

there exists a supervisor with its children. the output of
supervisor:which_children(my_supervisor) => [{Id, Child,Type,Modules},
...]

due to reasons it has been decided to change Id to OtherId during
upgrade. i have identified the other places where Id is stored
(ets/mnesia tables) and successfully transformed these tables. now i
need to change the contents of my_supervisor's child specifications.

the code in supervisor.erl hints at a tantelising possiblity:

code_change(_, State, _) ->
    case apply(State#state.module, init,
	       [State#state.args]) of
	{ok, {SupFlags, StartSpec}} ->
	    case catch check_flags(SupFlags) of
		ok ->
		    update_childspec(State, StartSpec);

as one can see StartSpec is returned from
<my_supervisors_module>:init/1. is this possible to use? how? (ie,
when/why is supervisor:code_change/3 called)
it is fine to just point me to the right place in the documentation.


bengt




More information about the erlang-questions mailing list