~rdoering/ubuntu/karmic/erlang/fix-535090

« back to all changes in this revision

Viewing changes to lib/sasl/doc/src/appup.xml

  • Committer: Bazaar Package Importer
  • Author(s): Sergei Golovan
  • Date: 2009-02-15 16:42:52 UTC
  • mfrom: (3.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090215164252-q5x4rcf8a5pbesb1
Tags: 1:12.b.5-dfsg-2
Upload to unstable after lenny is released.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="latin1" ?>
 
2
<!DOCTYPE fileref SYSTEM "fileref.dtd">
 
3
 
 
4
<fileref>
 
5
  <header>
 
6
    <copyright>
 
7
      <year>1997</year>
 
8
      <year>2007</year>
 
9
      <holder>Ericsson AB, All Rights Reserved</holder>
 
10
    </copyright>
 
11
    <legalnotice>
 
12
  The contents of this file are subject to the Erlang Public License,
 
13
  Version 1.1, (the "License"); you may not use this file except in
 
14
  compliance with the License. You should have received a copy of the
 
15
  Erlang Public License along with this software. If not, it can be
 
16
  retrieved online at http://www.erlang.org/.
 
17
 
 
18
  Software distributed under the License is distributed on an "AS IS"
 
19
  basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
 
20
  the License for the specific language governing rights and limitations
 
21
  under the License.
 
22
 
 
23
  The Initial Developer of the Original Code is Ericsson AB.
 
24
    </legalnotice>
 
25
 
 
26
    <title>appup</title>
 
27
    <prepared></prepared>
 
28
    <docno></docno>
 
29
    <date></date>
 
30
    <rev></rev>
 
31
  </header>
 
32
  <file>appup</file>
 
33
  <filesummary>Application upgrade file.</filesummary>
 
34
  <description>
 
35
    <p>The <em>application upgrade file</em> defines how an application
 
36
      is upgraded or downgraded in a running system.</p>
 
37
    <p>This file is used by the functions in <c>systools</c> when
 
38
      generating a release upgrade file <c>relup</c>.</p>
 
39
  </description>
 
40
 
 
41
  <section>
 
42
    <title>FILE SYNTAX</title>
 
43
    <p>The application upgrade file should be called
 
44
      <c>Application.appup</c> where <c>Application</c> is the name of
 
45
      the application.  The file should be located in the <c>ebin</c>
 
46
      directory for the application.</p>
 
47
    <p>The <c>.appup</c> file contains one single Erlang term, which
 
48
      defines the instructions used to upgrade or downgrade
 
49
      the application.  The file has the following syntax:</p>
 
50
    <code type="none">
 
51
{Vsn,
 
52
  [{UpFromVsn, Instructions}, ...],
 
53
  [{DownToVsn, Instructions}, ...]}.
 
54
    </code>
 
55
    <list type="bulleted">
 
56
      <item>
 
57
        <p><c>Vsn = string()</c> is the current version of
 
58
          the application.</p>
 
59
      </item>
 
60
      <item>
 
61
        <p><c>UpFromVsn = string()</c> is an earlier version of
 
62
          the application to upgrade from.</p>
 
63
      </item>
 
64
      <item>
 
65
        <p><c>DownToVsn = string()</c> is an earlier version of
 
66
          the application to downgrade to.</p>
 
67
      </item>
 
68
      <item>
 
69
        <p><c>Instructions</c> is a list of <em>release upgrade instructions</em>, see below. It is recommended to use
 
70
          high-level instructions only. These are automatically
 
71
          translated to low-level instructions by <c>systools</c> when
 
72
          creating the <c>relup</c> file.</p>
 
73
      </item>
 
74
    </list>
 
75
  </section>
 
76
 
 
77
  <section>
 
78
    <title>RELEASE UPGRADE INSTRUCTIONS</title>
 
79
    <p>Release upgrade instructions are interpreted by the release
 
80
      handler when an upgrade or downgrade is made. For more
 
81
      information about release handling, refer to <em>OTP Design Principes</em>.</p>
 
82
    <p>A process is said to <em>use</em> a module <c>Mod</c>, if
 
83
      <c>Mod</c> is listed in the <c>Modules</c> part of the child
 
84
      specification used to start the process, see <c>supervisor(3)</c>.
 
85
      In the case of gen_event, an event manager process is said to use
 
86
      <c>Mod</c> if <c>Mod</c> is an installed event handler.</p>
 
87
    <p><em>High-level instructions</em></p>
 
88
    <pre>
 
89
{update, Mod}
 
90
{update, Mod, supervisor}
 
91
{update, Mod, Change}
 
92
{update, Mod, DepMods}
 
93
{update, Mod, Change, DepMods}
 
94
{update, Mod, Change, PrePurge, PostPurge, DepMods}
 
95
{update, Mod, Timeout, Change, PrePurge, PostPurge, DepMods}
 
96
{update, Mod, ModType, Timeout, Change, PrePurge, PostPurge, DepMods}
 
97
  Mod = atom()
 
98
  ModType = static | dynamic
 
99
  Timeout = int()>0 | default | infinity
 
100
  Change = soft | {advanced,Extra}
 
101
    Extra = term()
 
102
  PrePurge = PostPurge = soft_purge | brutal_purge
 
103
  DepMods = [Mod]
 
104
    </pre>
 
105
    <p>Synchronized code replacement of processes using the module
 
106
      <c>Mod</c>. All those processes are suspended using
 
107
      <c>sys:suspend</c>, the new version of the module is loaded and
 
108
      then the processes are resumed using <c>sys:resume</c>.</p>
 
109
    <p><c>Change</c> defaults to <c>soft</c> and defines the type of
 
110
      code change. If it is set to <c>{advanced,Extra}</c>, processes
 
111
      implemented using gen_server, gen_fsm or gen_event will transform
 
112
      their internal state by calling the callback function
 
113
      <c>code_change</c>. Special processes will call the callback
 
114
      function <c>system_code_change/4</c>. In both cases, the term
 
115
      <c>Extra</c> is passed as an argument to the callback function.</p>
 
116
    <p><c>PrePurge</c> defaults to <c>brutal_purge</c> and controls
 
117
      what action to take with processes that are executing old code
 
118
      before loading the new version of the module. If the value
 
119
      is <c>brutal_purge</c>, the processes are killed. If the value is
 
120
      <c>soft_purge</c>, <c>release_handler:install_release/1</c>
 
121
      returns <c>{error,{old_processes,Mod}}</c>.</p>
 
122
    <p><c>PostPurge</c> defaults to <c>brutal_purge</c> and controls
 
123
      what action to take with processes that are executing old code
 
124
      when the new version of the module has been loaded. If the value
 
125
      is <c>brutal_purge</c>, the code is purged when the release is
 
126
      made permanent and the processes are killed. If the value is
 
127
      <c>soft_purge</c>, the release handler will purge the old code
 
128
      when no remaining processes execute the code.</p>
 
129
    <p><c>DepMods</c> defaults to [] and defines which other modules
 
130
      <c>Mod</c> is dependent on. In <c>relup</c>, instructions for
 
131
      suspending processes using <c>Mod</c> will come before
 
132
      instructions for suspending processes using modules in
 
133
      <c>DepMods</c> when upgrading, and vice versa when downgrading.
 
134
      In case of circular dependencies, the order of the instructions in
 
135
      the <c>appup</c> script is kept.</p>
 
136
    <p><c>Timeout</c> defines the timeout when suspending processes.
 
137
      If no value or <c>default</c> is given, the default value for
 
138
      <c>sys:suspend</c> is used.</p>
 
139
    <p><c>ModType</c> defaults to <c>dynamic</c> and specifies if
 
140
      the code is "dynamic", that is if a process using the module does
 
141
      spontaneously switch to new code, or if it is "static".
 
142
      When doing an advanced update and upgrading, the new version of a
 
143
      dynamic module is loaded before the process is asked to change
 
144
      code. When downgrading, the process is asked to change code before
 
145
      loading the new version. For static modules, the new version is
 
146
      loaded before the process is asked to change code, both in
 
147
      the case of upgrading and downgrading. Callback modules are
 
148
      dynamic.</p>
 
149
    <p><c>update</c> with argument <c>supervisor</c> is used when
 
150
      changing the start specification of a supervisor.</p>
 
151
    <pre>
 
152
{load_module, Mod}
 
153
{load_module, Mod, DepMods}
 
154
{load_module, Mod, PrePurge, PostPurge, DepMods}
 
155
  Mod = atom()
 
156
  PrePurge = PostPurge = soft_purge | brutal_purge
 
157
  DepMods = [Mod]
 
158
    </pre>
 
159
    <p>Simple code replacement of the module <c>Mod</c>.</p>
 
160
    <p>See <c>update</c> above for a description of <c>PrePurge</c> and
 
161
      <c>PostPurge</c>.</p>
 
162
    <p><c>DepMods</c> defaults to [] and defines which other modules
 
163
      <c>Mod</c> is dependent on. In <c>relup</c>, instructions for
 
164
      loading these modules will come before the instruction for loading
 
165
      <c>Mod</c> when upgrading, and vice versa when downgrading.</p>
 
166
    <pre>
 
167
{add_module, Mod}
 
168
  Mod = atom()
 
169
    </pre>
 
170
    <p>Loads a new module <c>Mod</c>.</p>
 
171
    <pre>
 
172
{delete_module, Mod}
 
173
  Mod = atom()
 
174
    </pre>
 
175
    <p>Deletes a module <c>Mod</c> using the low-level instructions
 
176
      <c>remove</c> and <c>purge</c>.</p>
 
177
    <pre>
 
178
{add_application, Application}
 
179
  Application = atom()
 
180
    </pre>
 
181
    <p>Adding an application means that the modules defined by
 
182
      the <c>modules</c> key in the <c>.app</c> file are loaded using
 
183
      <c>add_module</c>, then the application is started.</p>
 
184
    <pre>
 
185
{remove_application, Application}
 
186
  Application = atom()
 
187
    </pre>
 
188
    <p>Removing an application means that the application is stopped,
 
189
      the modules are unloaded using <c>delete_module</c> and then
 
190
      the application specification is unloaded from the application
 
191
      controller.</p>
 
192
    <pre>
 
193
{restart_application, Application}
 
194
  Application = atom()
 
195
    </pre>
 
196
    <p>Restarting an application means that the application is
 
197
      stopped and then started again similar to using the instructions
 
198
      <c>remove_application</c> and <c>add_application</c> in sequence.</p>
 
199
    <p><em>Low-level instructions</em></p>
 
200
    <pre>
 
201
{load_object_code, {App, Vsn, [Mod]}}
 
202
  App = Mod = atom()
 
203
  Vsn = string()
 
204
    </pre>
 
205
    <p>Reads each <c>Mod</c> from the directory <c>App-Vsn/ebin</c> as
 
206
      a binary. It does not load the modules. The instruction should be
 
207
      placed first in the script in order to read all new code from file
 
208
      to make the suspend-load-resume cycle less time consuming. After
 
209
      this instruction has been executed, the code server with the new
 
210
      version of <c>App</c>.</p>
 
211
    <pre>
 
212
point_of_no_return
 
213
    </pre>
 
214
    <p>If a crash occurs after this instruction, the system cannot
 
215
      recover and is restarted from the old version of the release.
 
216
      The instruction must only occur once in a script. It should be
 
217
      placed after all <c>load_object_code</c> instructions.</p>
 
218
    <pre>
 
219
{load, {Mod, PrePurge, PostPurge}}
 
220
  Mod = atom()
 
221
  PrePurge = PostPurge = soft_purge | brutal_purge
 
222
    </pre>
 
223
    <p>Before this instruction occurs, <c>Mod</c> must have been loaded
 
224
      using <c>load_object_code</c>. This instruction loads the module.
 
225
      <c>PrePurge</c> is ignored. See the high-level instruction
 
226
      <c>update</c> for a description of <c>PostPurge</c>.</p>
 
227
    <pre>
 
228
{remove, {Mod, PrePurge, PostPurge}}
 
229
  Mod = atom()
 
230
  PrePurge = PostPurge = soft_purge | brutal_purge
 
231
    </pre>
 
232
    <p>Makes the current version of <c>Mod</c> old.
 
233
      <c>PrePurge</c> is ignored. See the high-level instruction
 
234
      <c>update</c> for a description of <c>PostPurge</c>.</p>
 
235
    <pre>
 
236
{purge, [Mod]}
 
237
  Mod = atom()
 
238
    </pre>
 
239
    <p>Purges each module <c>Mod</c>, that is removes the old code.
 
240
      Note that any process executing purged code is killed.</p>
 
241
    <pre>
 
242
{suspend, [Mod | {Mod, Timeout}]}
 
243
  Mod = atom()
 
244
  Timeout = int()>0 | default | infinity
 
245
    </pre>
 
246
    <p>Tries to suspend all processes using a module <c>Mod</c>. If a
 
247
      process does not respond, it is ignored. This may cause
 
248
      the process to die, either because it crashes when it
 
249
      spontaneously switches to new code, or as a result of a purge
 
250
      operation. If no <c>Timeout</c> is specified or <c>default</c> is
 
251
      given, the default value for <c>sys:suspend</c> is used.</p>
 
252
    <pre>
 
253
{resume, [Mod]}
 
254
  Mod = atom()
 
255
    </pre>
 
256
    <p>Resumes all suspended processes using a module <c>Mod</c>.</p>
 
257
    <pre>
 
258
{code_change, [{Mod, Extra}]}
 
259
{code_change, Mode, [{Mod, Extra}]}
 
260
  Mod = atom()
 
261
  Mode = up | down
 
262
  Extra = term()
 
263
    </pre>
 
264
    <p><c>Mode</c> defaults to <c>up</c> and specifies if it is an
 
265
      upgrade or downgrade.</p>
 
266
    <p>This instruction sends a <c>code_change</c> system message to
 
267
      all processes using a module <c>Mod</c> by calling the function
 
268
      <c>sys:change_code</c>, passing the term <c>Extra</c> as argument.</p>
 
269
    <pre>
 
270
{stop, [Mod]}
 
271
  Mod = atom()
 
272
    </pre>
 
273
    <p>Stops all processes using a module <c>Mod</c> by calling
 
274
      <c>supervisor:terminate_child/2</c>. The instruction is useful
 
275
      when the simplest way to change code is to stop and restart the
 
276
      processes which run the code.</p>
 
277
    <pre>
 
278
{start, [Mod]}
 
279
  Mod = atom()
 
280
    </pre>
 
281
    <p>Starts all stopped processes using a module <c>Mod</c> by calling
 
282
      <c>supervisor:restart_child/2</c>.</p>
 
283
    <pre>
 
284
{sync_nodes, Id, [Node]}
 
285
{sync_nodes, Id, {M, F, A}}
 
286
  Id = term()
 
287
  Node = node()
 
288
  M = F = atom()
 
289
  A = [term()]
 
290
    </pre>
 
291
    <p><c>apply(M, F, A)</c> must return a list of nodes.</p>
 
292
    <p>The instruction synchronizes the release installation with other
 
293
      nodes. Each <c>Node</c> must evaluate this command, with the same
 
294
      <c>Id</c>. The local node waits for all other nodes to evaluate
 
295
      the instruction before execution continues. In case a node goes
 
296
      down, it is considered to be an unrecoverable error, and
 
297
      the local node is restarted from the old release. There is no
 
298
      timeout for this instruction, which means that it may hang
 
299
      forever.</p>
 
300
    <pre>
 
301
{apply, {M, F, A}}
 
302
  M = F = atom()
 
303
  A = [term()]
 
304
    </pre>
 
305
    <p>Evaluates <c>apply(M, F, A)</c>. If the instruction appears
 
306
      before the <c>point_of_no_return</c> instruction, a failure is
 
307
      caught. <c>release_handler:install_release/1</c> then returns
 
308
      <c>{error,{'EXIT',Reason}}</c>, unless <c>{error,Error}</c> is
 
309
      thrown or returned. Then it returns <c>{error,Error}</c>.</p>
 
310
    <p>If the instruction appears after the <c>point_of_no_return</c>
 
311
      instruction, and the function call fails, the system is
 
312
      restarted.</p>
 
313
    <pre>
 
314
restart_new_emulator
 
315
    </pre>
 
316
    <p>Shuts down the current emulator and starts a ne one. All
 
317
      processes are terminated gracefully. The new release must still
 
318
      be made permanent when the new emulator is up and running.
 
319
      Otherwise, the old emulator is started in case of a emulator
 
320
      restart. This instruction should be used when a new emulator is
 
321
      introduced, or if a complete reboot of the system should be done.</p>
 
322
  </section>
 
323
 
 
324
  <section>
 
325
    <title>SEE ALSO</title>
 
326
    <p><seealso marker="relup">relup(4)</seealso>,
 
327
      <seealso marker="release_handler">release_handler(3)</seealso>,
 
328
      supervisor(3),
 
329
      <seealso marker="systools">systools(3)</seealso></p>
 
330
  </section>
 
331
</fileref>
 
332