[erlang-questions] DepMods in OTP appup "downgrade update" instructions

Michael FIG fig@REDACTED
Thu Mar 13 11:15:54 CET 2008


Hi all,

I recently wanted to simplify my .appup files by introducing a central configuration OTP application (starconf) that understands how to set up configuration files for various versions of external programs.  Each of these external programs has a corresponding Erlang application that provides a supervisor and gen_server interface.

Now here is the problem I have: given that I had made many naive releases of one of these applications, proport, I accumulated an appup file that looked something like this:

{"3.3.0", % -*-Erlang-*-
 [{"3.2.1", [{restart_application, proport}]},
  {"3.2.2", [{restart_application, proport}]},
  {"3.2.3", [{restart_application, proport}]},
  ...
 ],
 [{"3.2.1", [{restart_application, proport}]},
  {"3.2.2", [{restart_application, proport}]},
  {"3.2.3", [{restart_application, proport}]},
  ...
 ]
}.

What I wanted to do was to rewrite this appup file so that I could use my new, spiffy starconf-dependent code_change callbacks for the gen_server (named proport), so I tried:

{"3.3.0", % -*-Erlang-*-
 [{"3.2.1", [{update, proport, {advanced, restart}, [starconf]}]},
  {"3.2.2", [{update, proport, {advanced, restart}, [starconf]}]},
  {"3.2.3", [{update, proport, {advanced, restart}, [starconf]}]},
  ...
 ],
 [{"3.2.1", [{update, proport, {advanced, restart}, [starconf]}]},
  {"3.2.2", [{update, proport, {advanced, restart}, [starconf]}]},
  {"3.2.3", [{update, proport, {advanced, restart}, [starconf]}]},
  ...
 ]
}.

But, to my chagrin, this equally naive appup file failed with "Undefined module: starconf" when I tried to run make_relup.  Some binary search testing revealed that I could use it as a dependency in all of the upgrade instructions, but none of the downgrade instructions.

This made me wonder: what is the state of the runtime when a "downgrade update" instruction is being executed?  Why are modules that are included in the current release (but notably not in any prior release) not accessible to the downgrade process?  If this is insurmountable, how would you suggest I refactor the downgrade code when the latest starconf is always going to know the best way to downgrade?

The OTP appup documentation seems to imply that putting starconf in the downgrade's DepMods is the right thing to do, and it means that starconf will be suspended only after proport has been downgraded.  If somebody could shed some light on this matter, I would be very grateful, and would also suggest adding it to the official appup docs.

Thanks for any help you can offer,

-- 
Michael FIG <fig@REDACTED>, PMP
MarkeTel Multi-Line Dialing Systems, Ltd.
Phone: (306) 359-6893 ext. 528




More information about the erlang-questions mailing list