| 7 | | <sect1 id="usingslonik"> <title>Using Slonik</title> |
|---|
| 8 | | |
|---|
| 9 | | <indexterm><primary>using slonik</primary></indexterm> |
|---|
| 10 | | |
|---|
| 11 | | <para> It's a bit of a pain writing <application>Slonik</application> |
|---|
| 12 | | scripts by hand, particularly as you start working with &slony1; |
|---|
| 13 | | clusters that may be comprised of increasing numbers of nodes and |
|---|
| 14 | | sets. Some problems that have been noticed include the following: |
|---|
| 15 | | |
|---|
| 16 | | <itemizedlist> |
|---|
| 17 | | |
|---|
| 18 | | <listitem><para> If you are using &slony1; as a |
|---|
| 19 | | <quote>master/slave</quote> replication system with one |
|---|
| 20 | | <quote>master</quote> node and one <quote>slave</quote> node, it may |
|---|
| 21 | | be sufficiently mnemonic to call the <quote>master</quote> node 1 and |
|---|
| 22 | | the <quote>slave</quote> node 2.</para> |
|---|
| 23 | | |
|---|
| 24 | | <para> Unfortunately, as the number of nodes increases, the mapping of |
|---|
| 25 | | IDs to nodes becomes way less obvious, particularly if you have a |
|---|
| 26 | | cluster where the origin might shift from node to node over |
|---|
| 27 | | time.</para></listitem> |
|---|
| 28 | | |
|---|
| 29 | | <listitem><para> Similarly, if there is only one replication set, it's |
|---|
| 30 | | fine for that to be <quote>set 1,</quote> but if there are a |
|---|
| 31 | | multiplicity of sets, the numbering involved in using set numbers may |
|---|
| 32 | | grow decreasingly intuitive.</para></listitem> |
|---|
| 33 | | |
|---|
| 34 | | <listitem><para> People have observed that |
|---|
| 35 | | <application>Slonik</application> does not provide any notion of |
|---|
| 36 | | iteration. It is common to want to create a set of similar <xref |
|---|
| 37 | | linkend="stmtstorepath"/> entries, since, in most cases, hosts will |
|---|
| 38 | | likely access a particular server via the same host name or IP |
|---|
| 39 | | address.</para></listitem> |
|---|
| 40 | | |
|---|
| 41 | | <listitem><para> Users seem interested in wrapping everything possible |
|---|
| 42 | | in <command>TRY</command> blocks, which is regrettably somewhat |
|---|
| 43 | | <emphasis>less</emphasis> useful than might be |
|---|
| 44 | | hoped...</para></listitem> |
|---|
| | 7 | <sect1 id="usingslonik"> <title>Utiliser Slonik</title> |
|---|
| | 8 | |
|---|
| | 9 | <indexterm><primary>utiliser slonik</primary></indexterm> |
|---|
| | 10 | |
|---|
| | 11 | <para> Il est parfois pénible d'écrire les scripts <application>Slonik</application> |
|---|
| | 12 | Ã la main, en particulier lorsqu'on travaille avec des clusters &slony1; |
|---|
| | 13 | dont le nombre de noeuds et d'ensemble de réplication augmente réguliÚrement. |
|---|
| | 14 | Les problÚmes suivants ont été identifiés. |
|---|
| | 15 | |
|---|
| | 16 | <itemizedlist> |
|---|
| | 17 | |
|---|
| | 18 | <listitem><para> Si vous utilisez &slony1; pour une réplication |
|---|
| | 19 | <quote>maître/esclave</quote> avec un noeud |
|---|
| | 20 | <quote>maître</quote> et un noeud <quote>esclave</quote>, le plus simple |
|---|
| | 21 | est de nommer le noeud <quote>maître</quote> noeud 1 et le |
|---|
| | 22 | noeud <quote>esclave</quote> noeud 2.</para> |
|---|
| | 23 | |
|---|
| | 24 | <para> Malheureusement, lorsque le nombre de noeud augmente, la correspondance |
|---|
| | 25 | entre les identifiants et les noeuds devient moins évidente, en particulier |
|---|
| | 26 | si vous avez un cluster dont l'origine est déplacée d'un noeud à l'autre de temps en temps. |
|---|
| | 27 | </para></listitem> |
|---|
| | 28 | |
|---|
| | 29 | <listitem><para> De la même façon, s'il n'y a qu'un seul ensemble de réplication, |
|---|
| | 30 | il est facile de le nommer <quote>ensemble 1,</quote> mais s'il y a |
|---|
| | 31 | de multiples ensemble, la numérotation des ensembles sera moins intuitive. |
|---|
| | 32 | </para></listitem> |
|---|
| | 33 | |
|---|
| | 34 | <listitem><para> On observe que |
|---|
| | 35 | <application>Slonik</application> ne fournit pas la notion d'itération |
|---|
| | 36 | Il est courant de vouloir créer un ensemble d'entrée <xref |
|---|
| | 37 | linkend="stmtstorepath"/> similaires, car la pluspart du temps, |
|---|
| | 38 | les hÎtes accÚdent à un serveur via le même nom d'hÎte ou la même |
|---|
| | 39 | adresse IP.</para></listitem> |
|---|
| | 40 | |
|---|
| | 41 | <listitem><para> Les utilisateurs a tout insérer à l'intérieur de blocs |
|---|
| | 42 | <command>TRY</command>, ce qui n'est pas aussi utile qu'on pourrait le penser |
|---|
| | 43 | </para></listitem> |
|---|
| 48 | | <para> These have assortedly pointed to requests for such enhancements |
|---|
| 49 | | as: |
|---|
| 50 | | |
|---|
| 51 | | <itemizedlist> |
|---|
| 52 | | <listitem><para> Named nodes, named sets</para> |
|---|
| 53 | | |
|---|
| 54 | | <para> This is supported in &slony1; 1.1 by the <xref |
|---|
| 55 | | linkend="stmtdefine"/> and <xref linkend="stmtinclude"/> statements. |
|---|
| 56 | | </para> |
|---|
| 57 | | |
|---|
| 58 | | <para> The use of <xref linkend="stmtinclude"/> to allow creating |
|---|
| 59 | | <quote>preamble files</quote> has proven an invaluable tool to reduce |
|---|
| 60 | | errors. The preamble file is set up <emphasis>once</emphasis>, |
|---|
| 61 | | verified <emphasis>once</emphasis>, and then that verified script may |
|---|
| 62 | | be used with confidence for each slonik script. |
|---|
| | 47 | <para> Certaines évolutions ont résolu une partie de ces problÚmes : |
|---|
| | 48 | |
|---|
| | 49 | <itemizedlist> |
|---|
| | 50 | <listitem><para> Noeuds nommés, ensemble nommés</para> |
|---|
| | 51 | |
|---|
| | 52 | <para> Ceci est supporté par les commandes <xref |
|---|
| | 53 | linkend="stmtdefine"/> and <xref linkend="stmtinclude"/> Ã partir |
|---|
| | 54 | de &slony1; 1.1. |
|---|
| | 55 | </para> |
|---|
| | 56 | |
|---|
| | 57 | <para> L'utilisation de <xref linkend="stmtinclude"/> pour créer |
|---|
| | 58 | des <quote>fichiers préambule</quote> est un méthode essentielle |
|---|
| | 59 | pour réduire les erreurs. Un fichier préambule est un défini |
|---|
| | 60 | <emphasis>une seule fois</emphasis> et vérifié <emphasis>une seule fois</emphasis>. |
|---|
| | 61 | Ces fichiers peuvent être utilisé en tout confiance par les autres scripts |
|---|
| | 62 | slonik. |
|---|
| 76 | | <para> There are several ways to work around these issues that have |
|---|
| 77 | | been seen <quote>in the wild</quote>:</para> |
|---|
| 78 | | |
|---|
| 79 | | <itemizedlist> |
|---|
| 80 | | |
|---|
| 81 | | <listitem><para> Embedding generation of slonik inside shell |
|---|
| 82 | | scripts</para> |
|---|
| 83 | | |
|---|
| 84 | | <para> The test bed found in the <filename>src/ducttape</filename> |
|---|
| 85 | | directory takes this approach.</para></listitem> |
|---|
| 86 | | |
|---|
| 87 | | <listitem><para> The <link linkend="altperl"> altperl tools </link> |
|---|
| 88 | | use Perl code to generate Slonik scripts.</para> |
|---|
| 89 | | |
|---|
| 90 | | <para> You define the cluster's configuration as a set of Perl |
|---|
| 91 | | objects; each script walks through the Perl objects as needed to |
|---|
| 92 | | generate a slonik script for that script's purpose. |
|---|
| | 76 | <para> Il existe plusieurs façons de régler ces problÚmes : |
|---|
| | 77 | </para> |
|---|
| | 78 | |
|---|
| | 79 | <itemizedlist> |
|---|
| | 80 | |
|---|
| | 81 | <listitem><para> Inclure la génération du script slonik dans un scripts shell</para> |
|---|
| | 82 | |
|---|
| | 83 | <para> Les tests trouvés dans le répertoire <filename>src/ducttape</filename> |
|---|
| | 84 | utilise cette approche.</para></listitem> |
|---|
| | 85 | |
|---|
| | 86 | <listitem><para> Les <link linkend="altperl"> outils altperl</link> |
|---|
| | 87 | utilise du code Perl pour générer les scripts Slonik.</para> |
|---|
| | 88 | |
|---|
| | 89 | <para> Vous définissez les configuration du cluster comme un ensemble |
|---|
| | 90 | d'objets Perl; chaque script altperl utilise les objets Perl pour produire |
|---|
| | 91 | le script slonik adéquate. |
|---|
| 98 | | <sect1 id="slonikshell"><title> Embedding Slonik in Shell Scripts </title> |
|---|
| 99 | | |
|---|
| 100 | | <indexterm><primary> embedding slonik in shell scripts </primary></indexterm> |
|---|
| 101 | | |
|---|
| 102 | | <para> As mentioned earlier, there are numerous &slony1; test scripts |
|---|
| 103 | | in <filename>src/ducttape</filename> that embed the generation of |
|---|
| 104 | | Slonik inside the shell script.</para> |
|---|
| 105 | | |
|---|
| 106 | | <para> They mostly <emphasis> don't </emphasis> do this in a terribly |
|---|
| 107 | | sophisticated way. Typically, they use the following sort of |
|---|
| 108 | | structure: |
|---|
| | 97 | <sect1 id="slonikshell"><title> Utiliser Slonik à partir d'un script Shell </title> |
|---|
| | 98 | |
|---|
| | 99 | <indexterm><primary> Utiliser slonik à l'intérieur de scripts Shell</primary></indexterm> |
|---|
| | 100 | |
|---|
| | 101 | <para> Comme on l'a vu précédemment, il existe de nombreux scripts de test pour &slony1; |
|---|
| | 102 | dans le répertoire <filename>src/ducttape</filename> qui intÚgre la génération |
|---|
| | 103 | de script Slonik à l'intérieur de code écrit en Shell.</para> |
|---|
| | 104 | |
|---|
| | 105 | <para> La pluspart de ces scripts ne sont <emphasis> pas </emphasis> terriblement |
|---|
| | 106 | sophistiqués. Typiquement, ils utilisent des structures comme celle-ci |
|---|
| | 107 | : |
|---|
| 224 | | <para> That is of somewhat dubious value if you only have 4 tables, |
|---|
| 225 | | but eliminating errors resulting from enumerating large lists of |
|---|
| 226 | | configuration by hand will make this pretty valuable for the larger |
|---|
| 227 | | examples you'll find in <quote>real life.</quote></para> |
|---|
| 228 | | |
|---|
| 229 | | <para> You can do even more sophisticated things than this if your |
|---|
| 230 | | scripting language supports things like: |
|---|
| 231 | | |
|---|
| 232 | | <itemizedlist> |
|---|
| 233 | | |
|---|
| 234 | | <listitem><para> <quote>Record</quote> data structures that allow |
|---|
| 235 | | assigning things in parallel</para></listitem> |
|---|
| 236 | | |
|---|
| 237 | | <listitem><para> Functions, procedures, or subroutines, allowing you |
|---|
| 238 | | to implement useful functionality once, and then refer to it multiple |
|---|
| 239 | | times within a script</para></listitem> |
|---|
| 240 | | |
|---|
| 241 | | <listitem><para> Some sort of <quote>module import</quote> system so |
|---|
| 242 | | that common functionality can be shared across many |
|---|
| 243 | | scripts</para></listitem> |
|---|
| | 223 | <para> Ce n'est peut-être pas nécessaire si vous n'avez que 4 tables |
|---|
| | 224 | mais cette méthode évite de recopier de longues listes de configuration |
|---|
| | 225 | à la main et préviendra les erreurs sur les grands ensembles que |
|---|
| | 226 | vous rencontrerez dans la <quote>vraie vie</quote>.</para> |
|---|
| | 227 | |
|---|
| | 228 | <para> Vous pouvez créer des scripts encore plus sophistiqués, si |
|---|
| | 229 | votre langage de script possÚde : |
|---|
| | 230 | |
|---|
| | 231 | <itemizedlist> |
|---|
| | 232 | |
|---|
| | 233 | <listitem><para> des structures de type <quote>Record</quote> qui |
|---|
| | 234 | permette d'assigner des objets en parallÚle.</para></listitem> |
|---|
| | 235 | |
|---|
| | 236 | <listitem><para> des fonctions, procédure ou des routines, qui |
|---|
| | 237 | permettent d'implanter des fonctionnalités une seule fois, |
|---|
| | 238 | puis de les appeler à divers endroit de votre script. |
|---|
| | 239 | </para></listitem> |
|---|
| | 240 | |
|---|
| | 241 | <listitem><para> Un mécanisme <quote>d'import de module</quote> afin |
|---|
| | 242 | partager de fonctionnalités commune entre plusieurs scripts. |
|---|
| | 243 | </para></listitem> |
|---|
| 249 | | url="http://www.zsh.org/"> zsh</ulink>, or <ulink |
|---|
| 250 | | url="http://www.kornshell.com/"> Korn shell</ulink> available, well, |
|---|
| 251 | | those are all shells with extensions supporting reasonably |
|---|
| 252 | | sophisticated data structures and module systems. On Linux, Bash is |
|---|
| 253 | | fairly ubiquitous; on commercial <trademark>UNIX</trademark>, Korn |
|---|
| 254 | | shell is fairly ubiquitous; on BSD, <quote>sophisticated</quote> |
|---|
| 255 | | shells are an option rather than a default.</para> |
|---|
| 256 | | |
|---|
| 257 | | <para> At that point, it makes sense to start looking at other |
|---|
| 258 | | scripting languages, of which Perl is the most ubiquitous, being |
|---|
| 259 | | widely available on Linux, <trademark>UNIX</trademark>, and BSD. |
|---|
| | 249 | url="http://www.zsh.org/"> zsh</ulink>, ou <ulink |
|---|
| | 250 | url="http://www.kornshell.com/"> Korn shell</ulink>, toutes |
|---|
| | 251 | ces shells possÚdent des extensions qui gÚrent correctement |
|---|
| | 252 | les structures de données sophistiquées et les modules. |
|---|
| | 253 | Sur linux, Bash est trÚs répandu; sur les systÚmes <trademark>UNIX</trademark> |
|---|
| | 254 | commerciaux, Korn est le standard, sur BSD, les shells <quote>sophistiqués</quote> |
|---|
| | 255 | sont en option.</para> |
|---|
| | 256 | |
|---|
| | 257 | <para> N'oubliez pas de regarder du coté des des autres |
|---|
| | 258 | langages de script, parmi lesquels Perl est le plus évident, |
|---|
| | 259 | puisque est largement répandu sur Linux, <trademark>UNIX</trademark>, |
|---|
| | 260 | et BSD. |
|---|
| 263 | | <sect1 id="noslonik"><title> Not Using Slonik - Bare Metal &slony1; |
|---|
| 264 | | Functions </title> |
|---|
| 265 | | |
|---|
| 266 | | <indexterm><primary> bare metal &slony1; functions </primary></indexterm> |
|---|
| 267 | | |
|---|
| 268 | | <para> There are cases where it may make sense to directly use the |
|---|
| 269 | | stored functions that implement the various pieces of &slony1;. |
|---|
| 270 | | Slonik doesn't do terribly much <quote>magic;</quote> it is common for |
|---|
| 271 | | Slonik commands to simply involve deciding on a node at which to apply |
|---|
| 272 | | a command, and then submit a SQL query consisting of a call to one of |
|---|
| 273 | | the &slony1; stored functions.</para> |
|---|
| 274 | | |
|---|
| 275 | | <para> The developers of &slony1; anticipate that interested parties |
|---|
| 276 | | may wish to develop graphical tools as an alternative to Slonik; it |
|---|
| 277 | | would be entirely appropriate in such cases to submit configuration |
|---|
| 278 | | requests directly via the stored functions. If you plan to do so, it |
|---|
| 279 | | is suggested that you examine how the stored procedures are used in |
|---|
| 280 | | <filename>slonik.c</filename>, as that represents the most correct use |
|---|
| 281 | | of the functions.</para> |
|---|
| 282 | | |
|---|
| 283 | | <para> When debugging problems in <quote>troubled</quote> &slony1; |
|---|
| 284 | | clusters, it has also occasionally proven useful to use the stored |
|---|
| 285 | | functions. This has been particularly useful for cases where <xref |
|---|
| 286 | | linkend="table.sl-listen"/> configuration has been broken, and events |
|---|
| 287 | | have not been propagating properly. The <quote>easiest</quote> fix |
|---|
| 288 | | was to:</para> |
|---|
| | 264 | <sect1 id="noslonik"><title> Ne pas utiliser Slonik - les fonctions &slony1; de bas niveau</title> |
|---|
| | 265 | |
|---|
| | 266 | <indexterm><primary> fonctions &slony1; de bas niveau </primary></indexterm> |
|---|
| | 267 | |
|---|
| | 268 | <para> Il est parfois nécessaire d'utiliser directement les procédures stockées |
|---|
| | 269 | qui compose les différentes parties de &slony1;. |
|---|
| | 270 | Slonik n'est pas <quote>magique;</quote> il est courant qu'une commande |
|---|
| | 271 | Slonik se contente de décider quel noeud va recevoir la commande |
|---|
| | 272 | et lui envoie une requête SQL qui contient une seule procédure stockée |
|---|
| | 273 | &slony1;.</para> |
|---|
| | 274 | |
|---|
| | 275 | <para> Les développeurs de &slony1; espÚrent que quelqu'un développera des |
|---|
| | 276 | outils graphiques qui constitueront une alternative à Slonik; Il serait |
|---|
| | 277 | alors utile d'envoyer les ordres de configuration directement via |
|---|
| | 278 | les procédures stockées. Si vous comptez vous lancer dans ce projet, |
|---|
| | 279 | il est conseillé d'examiner comment les procédures stockées sont |
|---|
| | 280 | utilisées dans le fichier <filename>slonik.c</filename>, |
|---|
| | 281 | puisqu'il s'agit de l'utilisation la plus correcte de ces fonctions.</para> |
|---|
| | 282 | |
|---|
| | 283 | <para> Lorsque que l'on corrige des problÚmes sur un cluster &slony1; <quote>endommagé</quote>, |
|---|
| | 284 | il est parfois utile d'utiliser les procédures stockées. C'est particuliÚrement |
|---|
| | 285 | efficace lorsque la configuration de la table <xref |
|---|
| | 286 | linkend="table.sl-listen"/> est corrompue et que les événements ne se |
|---|
| | 287 | propagent plus correctement. |
|---|
| | 288 | La méthode la <quote>plus simple</quote> pour réparer cela est la suivante : |
|---|
| | 289 | </para> |
|---|
| 297 | | <para> The result of this set of queries is to regenerate |
|---|
| 298 | | <emphasis>and propagate</emphasis> the listen paths. By running the main |
|---|
| 299 | | <function> _slonycluster.storelisten()</function> function, |
|---|
| 300 | | <command>STORE_LISTEN</command> events are raised to cause the listen paths to |
|---|
| 301 | | propagate to the other nodes in the cluster.</para> |
|---|
| 302 | | |
|---|
| 303 | | <para> If there was a <emphasis>local</emphasis> problem on one node, and you |
|---|
| 304 | | didn't want the updates to propagate (this would be an unusual |
|---|
| 305 | | situation; you almost certainly want to fix things |
|---|
| 306 | | <emphasis>everywhere</emphasis>), the queries would instead be:</para> |
|---|
| | 298 | <para> Le résultat de ces requêtes est la régénération et la |
|---|
| | 299 | <emphasis>propagation</emphasis> des voies d'écoute. En |
|---|
| | 300 | lançant à la main la fonction |
|---|
| | 301 | <function> _slonycluster.storelisten()</function>, |
|---|
| | 302 | on déclenche des évÚnements <command>STORE_LISTEN</command> qui provoque |
|---|
| | 303 | l'envoi des voies d'écoute sur les autres noeuds du cluster. |
|---|
| | 304 | </para> |
|---|
| | 305 | |
|---|
| | 306 | <para> En cas de problÚme <emphasis>local</emphasis> sur un noeud, si |
|---|
| | 307 | vous ne souhaitez pas propager les corrections ( ce qui est assez |
|---|
| | 308 | rare, on cherche en général à réparer <emphasis>l'ensemble</emphasis> du cluster ), |
|---|
| | 309 | la requête est la suivante : |
|---|
| | 310 | </para> |
|---|
| 315 | | <para> If you are planning to add &slony1; support to other tools |
|---|
| 316 | | (<emphasis>e.g.</emphasis> - adding replication support to something |
|---|
| 317 | | like <ulink url="http://www.pgadmin.org/"> <productname>pgAdmin |
|---|
| 318 | | III</productname> </ulink>), you need to be clear on where various |
|---|
| 319 | | functions need to be called. The normal <quote>protocol</quote> is |
|---|
| 320 | | thus: |
|---|
| 321 | | |
|---|
| 322 | | <itemizedlist> |
|---|
| 323 | | |
|---|
| 324 | | <listitem><para> The <quote>main</quote> function |
|---|
| 325 | | (<emphasis>e.g.</emphasis> - without the <command>_int</command> |
|---|
| 326 | | suffix) is called on a <quote>relevant</quote> node in the &slony1; |
|---|
| 327 | | cluster.</para> |
|---|
| 328 | | |
|---|
| 329 | | <para> In some cases, the function may be called on any node, and it |
|---|
| 330 | | can satisfactorily propagate to other nodes. That is true for <xref |
|---|
| 331 | | linkend="function.storelisten-integer-integer-integer"/>, for instance. |
|---|
| 332 | | In other cases, the function needs to be called on some particular |
|---|
| 333 | | node because that is the only place where data may be reasonably |
|---|
| 334 | | validated. For instance, <xref |
|---|
| 335 | | linkend="function.subscribeset-integer-integer-integer-boolean"/> must |
|---|
| 336 | | be called on the receivernode.</para></listitem> |
|---|
| 337 | | |
|---|
| 338 | | <listitem><para> If that <quote>main</quote> function succeeds, then |
|---|
| 339 | | the configuration change is performed on the local node, and an event |
|---|
| 340 | | is created using <xref linkend="function.createevent-name-text"/> to |
|---|
| 341 | | cause the configuration change to propagate to all of the other nodes |
|---|
| 342 | | in the &slony1; cluster.</para></listitem> |
|---|
| 343 | | |
|---|
| 344 | | <listitem><para> Thirdly, the <command>_int</command> version of the |
|---|
| 345 | | function must be run.</para> |
|---|
| 346 | | |
|---|
| 347 | | <para> In some cases, where functions are idempotent, the node where |
|---|
| 348 | | the <quote>main</quote> function runs can do this fairly early in |
|---|
| 349 | | processing.</para> |
|---|
| 350 | | |
|---|
| 351 | | <para> When the event propagates, the other nodes will run the |
|---|
| 352 | | <command>_int</command> version, we rather hope with good |
|---|
| 353 | | success. </para></listitem> |
|---|
| | 319 | <para> Si vous souhaitez ajouter le support de &slony1; dans d'autres |
|---|
| | 320 | outils (<emphasis>par exemple :</emphasis> ajouter la |
|---|
| | 321 | réplication dans <ulink url="http://www.pgadmin.org/"> <productname>pgAdmin |
|---|
| | 322 | III</productname> </ulink>), vous devez savoir clairement quelles |
|---|
| | 323 | fonctions il faut appeler. Le <quote>protocole</quote> normal est le suivant : |
|---|
| | 324 | |
|---|
| | 325 | <itemizedlist> |
|---|
| | 326 | |
|---|
| | 327 | <listitem><para> La fonction <quote>principale</quote> |
|---|
| | 328 | (<emphasis>par exemple </emphasis> celle sans le suffixe <command>_int</command>) |
|---|
| | 329 | est appelée sur un noeud <quote>adéquate</quote> du cluster &slony1;.</para> |
|---|
| | 330 | |
|---|
| | 331 | <para> Dans la pluspart des cas, la fonction peut être appelées sur |
|---|
| | 332 | n'importe quel noeud, et elle propage correctement les commandes |
|---|
| | 333 | aux autres noeuds. C'est vrai pour <xref |
|---|
| | 334 | linkend="function.storelisten-integer-integer-integer"/>, par exemple. |
|---|
| | 335 | |
|---|
| | 336 | Dans d'autres cas, la fonction doit être lancée depuis un noeud |
|---|
| | 337 | particulier car c'est le seul endroit où les données sont valides. |
|---|
| | 338 | Par exemple, <xref |
|---|
| | 339 | linkend="function.subscribeset-integer-integer-integer-boolean"/> doit |
|---|
| | 340 | être appelée sur le noeud récepteur.</para></listitem> |
|---|
| | 341 | |
|---|
| | 342 | <listitem><para> Si la fonction <quote>principale</quote> réussit, alors |
|---|
| | 343 | le changement de configuration est effectué sur le noeud local et |
|---|
| | 344 | un événement est créé avec <xref linkend="function.createevent-name-text"/> |
|---|
| | 345 | pour que le changement de configuration soit propagé à tout les autres |
|---|
| | 346 | noeuds du cluster &slony1;.</para></listitem> |
|---|
| | 347 | |
|---|
| | 348 | <listitem><para> TroisiÚmement, la version <command>_int</command> de la fonction |
|---|
| | 349 | doit être lancée.</para> |
|---|
| | 350 | |
|---|
| | 351 | <para> Dans certains cas, lorsque les fonctions sont idempotentes, le noeud |
|---|
| | 352 | sur lequel la fonction <quote>principale</quote> est exécutée peut |
|---|
| | 353 | traiter la version <command>_int</command> trÚs tÎt. |
|---|
| | 354 | </para> |
|---|
| | 355 | |
|---|
| | 356 | <para> En même temps que l'événement se propagera, les noeuds lanceront la version |
|---|
| | 357 | <command>_int</command>, en espérant que tout se passe bien. </para></listitem> |
|---|