| 1748 | | Change the set a sequence belongs to. The current set and the new |
|---|
| 1749 | | set must originate on the same node and subscribed by the same |
|---|
| 1750 | | nodes. |
|---|
| 1751 | | |
|---|
| 1752 | | <caution><para> Due to the way subscribing to new sets works make |
|---|
| 1753 | | absolutely sure that the subscription of all nodes to the sets |
|---|
| 1754 | | is completely processed before moving sequences. Moving a sequence too |
|---|
| 1755 | | early to a new set causes the subscriber to try and add the sequence |
|---|
| 1756 | | already during the subscription process, which fails with a duplicate |
|---|
| 1757 | | key error and breaks replication.</para></caution> |
|---|
| | 1748 | Change l'ensemble de réplication dans lequel se trouve la séquence. |
|---|
| | 1749 | L'ensemble courant et le nouveau doivent avoir le même noeud d'origine |
|---|
| | 1750 | et les mêmes noeuds abonnés. |
|---|
| | 1751 | |
|---|
| | 1752 | <caution><para> La méthode d'abonnement à un nouvel ensemble est particuliÚre, |
|---|
| | 1753 | vous devez vous assurer que l'abonnement est complÚtement effectué |
|---|
| | 1754 | avant de déplacer les séquences. Déplacer un séquence top tÎt peut impliquer |
|---|
| | 1755 | une tentative d'ajout de la séquence pendant le processus d'abonnement, |
|---|
| | 1756 | ce qui échouera en emettant une erreur à cause d'une clef dupliquée et |
|---|
| | 1757 | provoquera l'arrêt de la réplication.</para></caution> |
|---|
| 1841 | | <note><para> A nifty trick is that you can run <command>STORE |
|---|
| 1842 | | TRIGGER</command> <emphasis>before the trigger is |
|---|
| 1843 | | installed;</emphasis> that will not cause any errors. You could |
|---|
| 1844 | | thus add &slony1;'s handling of the trigger |
|---|
| 1845 | | <emphasis>before</emphasis> it is installed. That allows you to |
|---|
| 1846 | | be certain that it becomes active on all nodes immediately upon |
|---|
| 1847 | | its installation via <xref linkend="stmtddlscript"/>; there is no |
|---|
| 1848 | | risk of events getting through in between the <command>EXECUTE |
|---|
| 1849 | | SCRIPT</command> and <command>STORE TRIGGER</command> |
|---|
| 1850 | | events. </para> |
|---|
| | 1843 | <note><para> Une astuce consiste à lancer <command>STORE |
|---|
| | 1844 | TRIGGER</command> <emphasis>avant que le trigger soit installé |
|---|
| | 1845 | ;</emphasis> ce qui ne provoquera pas d'errreurs. Vous pouvez |
|---|
| | 1846 | ainsi définir la gestion d'un trigger par &slony1; r |
|---|
| | 1847 | <emphasis>avant</emphasis> qu'il soit installé. Vous êtes alors |
|---|
| | 1848 | certain que le trigger est actif sur tous les noeuds immédiatement |
|---|
| | 1849 | aprÚs son installation via <xref linkend="stmtddlscript"/>; il n'y a |
|---|
| | 1850 | aucun risque de voir un événement passer entre les événements |
|---|
| | 1851 | <command>EXECUTE |
|---|
| | 1852 | SCRIPT</command> et <command>STORE TRIGGER</command>. </para> |
|---|
| 1964 | | <listitem><para> Initiates replication for a replication set </para> |
|---|
| 1965 | | <para> Causes a node (subscriber) to start replicating a set of |
|---|
| 1966 | | tables either from the origin or from another provider node, which |
|---|
| 1967 | | must itself already be be an active, forwarding subscriber.</para> |
|---|
| 1968 | | |
|---|
| 1969 | | <para> The application tables contained in the set must already |
|---|
| 1970 | | exist and should ideally be empty. The current version of |
|---|
| 1971 | | &slony1; will <emphasis>not</emphasis> |
|---|
| 1972 | | attempt to copy the schema of the set. The replication daemon will |
|---|
| 1973 | | start copying the current content of the set from the given |
|---|
| 1974 | | provider and then try to catch up with any update activity that |
|---|
| 1975 | | happened during that copy process. After successful subscription, |
|---|
| 1976 | | the tables are guarded on the subscriber, using triggers, against |
|---|
| 1977 | | accidental updates by the application. |
|---|
| 1978 | | </para> |
|---|
| 1979 | | |
|---|
| 1980 | | <para> If the tables on the subscriber are |
|---|
| 1981 | | <emphasis>not</emphasis> empty, then the <command>COPY |
|---|
| 1982 | | SET</command> event (which is part of the subscription process) |
|---|
| 1983 | | may wind up doing more work than should be strictly |
|---|
| 1984 | | necessary:</para> |
|---|
| | 1970 | <listitem><para> Initie la réplication pour un ensemble de réplication </para> |
|---|
| | 1971 | <para> Ceci déclenche la réplication sur un noeud (abonné) soit à partir |
|---|
| | 1972 | de l'origine soit à partir du fournisseur, qui doit être lui même un noeud |
|---|
| | 1973 | abonné actif et transmetteur ("forwarding subscriber").</para> |
|---|
| | 1974 | |
|---|
| | 1975 | <para> Les tables de l'application contenues dans l'ensemble de réplication |
|---|
| | 1976 | doivent déjà exister et idéalement elles sont vides. La version courante de |
|---|
| | 1977 | &slony1; ne tente <emphasis>pas</emphasis> de copier le schéma de l'ensemble |
|---|
| | 1978 | de réplication. Le démon de réplication démarre et commence à copier le contenu |
|---|
| | 1979 | de l'ensemble de réplication à partir du fournisseur spécifi, puis essaie |
|---|
| | 1980 | de rattraper son retard en rejouant les mises à jour qui se sont produites |
|---|
| | 1981 | lors du processus de copie. Un fois que l'abonnement a réussi, les tables |
|---|
| | 1982 | sont protégées avec des triggers contre les mises à jour en provenance de |
|---|
| | 1983 | l'application. |
|---|
| | 1984 | </para> |
|---|
| | 1985 | |
|---|
| | 1986 | <para> Si les tables sur l'abonné ne sont |
|---|
| | 1987 | <emphasis>pas</emphasis> vides, alors l'événement <command>COPY |
|---|
| | 1988 | SET</command> ( qui fait partie du processus d'abonnement) |
|---|
| | 1989 | devra effectuer quelques taches supplémentaires :</para> |
|---|
| 2004 | | <warning><para> This operation can take a (potentially distinctly) |
|---|
| 2005 | | non-zero period of time. If you have a great deal of data in a |
|---|
| 2006 | | particular set of tables, it may take hours or even (if <quote>a |
|---|
| 2007 | | great deal</quote> indicates <quote>tens or hundreds gigabytes of |
|---|
| 2008 | | data</quote>) possibly multiple days for this event to |
|---|
| 2009 | | complete.</para> |
|---|
| 2010 | | |
|---|
| 2011 | | <para> The <command>SUBSCRIBE SET</command> request will, |
|---|
| 2012 | | nonetheless, return fairly much immediately, even though the |
|---|
| 2013 | | work, being handled by the <command>COPY SET</command> event, is |
|---|
| 2014 | | still in progress. If you need to set up subscriptions for a set |
|---|
| 2015 | | of cascading nodes, you will need to wait for each subscriber to |
|---|
| 2016 | | complete subscribing before submitting requests for subscriptions |
|---|
| 2017 | | that use that node as a provider. If you don't, it won't be a |
|---|
| 2018 | | big deal: <command>slonik</command> will check the node, discover |
|---|
| 2019 | | that it is not yet an active provider for the set, and report |
|---|
| 2020 | | back:</para> |
|---|
| | 2010 | <warning><para> Le temps d'execution de cette opération n'est pas |
|---|
| | 2011 | négligeable. Si vous avez un grand volume de données dans un ensemble |
|---|
| | 2012 | particulier de tables, cela peut prendre plusieurs heures, voire plusieurs |
|---|
| | 2013 | jours pour que l'opération aboutisse ( ici <quote>"un grand volume</quote> |
|---|
| | 2014 | signifie <quote>des dizaines ou des centaines de gigabytes de |
|---|
| | 2015 | </quote>).</para> |
|---|
| | 2016 | |
|---|
| | 2017 | <para> Cependant, la requête <command>SUBSCRIBE SET</command> se terminera |
|---|
| | 2018 | presque immédiatement, même si les travaux, gérés par l'événement |
|---|
| | 2019 | <command>COPY SET</command>, sont encore en cours. Si vous devez configurer |
|---|
| | 2020 | les abonnements sur des noeuds en cascade, vous devez attendre que chaque |
|---|
| | 2021 | abonné ait terminé son abonnement avant de soumettre des requête d'abonnement |
|---|
| | 2022 | qui utilise ce noeud comme fournisseur. Si vous ne le faites pas, ce n'est pas |
|---|
| | 2023 | trÚs grave : <command>slonik</command> va vérifier le noeud, découvrir qu'il |
|---|
| | 2024 | n'est pas encore un fournisseur actif et reporter l'erreur suivante : |
|---|
| | 2025 | </para> |
|---|
| 2032 | | <listitem><para> Revising subscription information for already-subscribed nodes. </para> |
|---|
| 2033 | | |
|---|
| 2034 | | <para> If you need to revise subscription information for a |
|---|
| 2035 | | node, you <emphasis>also</emphasis> submit the new information |
|---|
| 2036 | | using this command, and the new configuration will be propagated |
|---|
| 2037 | | throughout the replication network. The normal reason to revise |
|---|
| 2038 | | this information is that you want a node to subscribe to a |
|---|
| 2039 | | <emphasis> different </emphasis> provider node, or for a node to |
|---|
| 2040 | | become a <quote>forwarding</quote> subscriber so it may later |
|---|
| 2041 | | become the provider for a later subscriber.</para> |
|---|
| | 2037 | <listitem><para> Modifier les informations d'abonnement pour les |
|---|
| | 2038 | noeuds qui sont déjà abonnés. </para> |
|---|
| | 2039 | |
|---|
| | 2040 | <para> Si vous devez modifier les informations d'abonnement pour un |
|---|
| | 2041 | noeud donné, vous devez <emphasis>également</emphasis> soumettre les |
|---|
| | 2042 | nouvelles informations avec cette commande, et la nouvelle configuration sera |
|---|
| | 2043 | propagée à travers le réseau de réplication. En général, on modifier |
|---|
| | 2044 | les informations d'abonnement lorsque l'on veut abonner un noeud à un fournisseur |
|---|
| | 2045 | <emphasis> différent </emphasis> ou transformer un noeud en <quote>transmetteur</quote> |
|---|
| | 2046 | afin qu'il puisse à son tour devenir le fournisseur d'un autre abonné. |
|---|
| | 2047 | </para> |
|---|
| 2084 | | <refsect1> <title> Forwarding Behaviour </title> |
|---|
| 2085 | | |
|---|
| 2086 | | <para> The <command>FORWARD=boolean</command> flag indicates |
|---|
| 2087 | | whether the subscriber will store log information in tables |
|---|
| 2088 | | &sllog1; and &sllog2;. Several implications fall from |
|---|
| 2089 | | this...</para> |
|---|
| 2090 | | |
|---|
| 2091 | | <para> By storing the data in these tables on the subscriber, |
|---|
| 2092 | | there is some additional processing burden. If you are certain |
|---|
| 2093 | | that you would never want to <xref linkend="stmtmoveset"/> or <xref |
|---|
| 2094 | | linkend="stmtfailover"/> to a particular subscriber, it is worth |
|---|
| 2095 | | considering turning off forwarding on that node. </para> |
|---|
| 2096 | | |
|---|
| 2097 | | <para> There is, however, a case where having forwarding turned |
|---|
| 2098 | | off opens up a perhaps-unexpected failure condition; a rule of |
|---|
| 2099 | | thumb should be that <emphasis>all nodes that connect directly to |
|---|
| 2100 | | the origin</emphasis> should have forwarding turned on. Supposing |
|---|
| 2101 | | one such <quote>direct subscriber</quote> has forwarding turned |
|---|
| 2102 | | off, it is possible for that node to be forcibly lost in a case of |
|---|
| 2103 | | failover. The problem comes if that node gets ahead of other |
|---|
| 2104 | | nodes.</para> |
|---|
| 2105 | | |
|---|
| 2106 | | <para> Let's suppose that the origin, node 1 is at SYNC number |
|---|
| 2107 | | 88901, a non-forwarding node, node 2 has processed up to SYNC |
|---|
| 2108 | | 88897, and other forwarding nodes, 3, 4, and 5, have only |
|---|
| 2109 | | processed data up to SYNC 88895. At that moment, the disk system |
|---|
| 2110 | | on the origin node catches fire. Node 2 has the |
|---|
| 2111 | | <emphasis>data</emphasis> up to SYNC 88897, but there is no |
|---|
| 2112 | | remaining node that contains, in &sllog1; or &sllog2;, the data |
|---|
| 2113 | | for SYNCs 88896 and 88897, so there is no way to bring nodes 3-5 |
|---|
| 2114 | | up to that point.</para> |
|---|
| 2115 | | |
|---|
| 2116 | | <para> At that point, there are only two choices: To drop node 2, |
|---|
| 2117 | | because there is no way to continue managing it, or to drop all |
|---|
| 2118 | | nodes <emphasis>but</emphasis> 2, because there is no way to bring |
|---|
| 2119 | | them up to SYNC 88897.</para> |
|---|
| 2120 | | |
|---|
| 2121 | | <para> That dilemma may be avoided by making sure that all nodes |
|---|
| 2122 | | directly subscribing to the origin have forwarding turned |
|---|
| 2123 | | on. </para> |
|---|
| 2124 | | |
|---|
| 2125 | | </refsect1> |
|---|
| 2126 | | <refsect1> <title> Dangerous/Unintuitive Behaviour </title> |
|---|
| | 2089 | <refsect1> <title> Transmission </title> |
|---|
| | 2090 | |
|---|
| | 2091 | <para> Le paramÚtre <command>FORWARD=boolean</command> indique si le |
|---|
| | 2092 | l'abonné doit conserver les informations dans les tables |
|---|
| | 2093 | &sllog1; and &sllog2;. Ceci implique plusieurs choses...</para> |
|---|
| | 2094 | |
|---|
| | 2095 | <para>Stocker les données dans ces tables sur l'abonné représente |
|---|
| | 2096 | une charge supplémentaire. Si vous êtes certain(e) que vous n'effectuerez |
|---|
| | 2097 | jamais les opérations <xref linkend="stmtmoveset"/> ou <xref |
|---|
| | 2098 | linkend="stmtfailover"/> sur un abonné particulier, il vaut mieux |
|---|
| | 2099 | désactiver la transmission sur ce noeud. </para> |
|---|
| | 2100 | |
|---|
| | 2101 | <para> Ceci étant, dans certains cas le fait de désactiver cette option |
|---|
| | 2102 | peut poser des problÚmes losque l'on se trouve dans une situation inattendue. |
|---|
| | 2103 | De maniÚre empirique, on considÚre qu'il préférable que <emphasis>tout |
|---|
| | 2104 | noeud connecté directement à l'origine</emphasis> soit |
|---|
| | 2105 | un <quote>noeud transmetteur </quote>. Il est possible que ce noeud |
|---|
| | 2106 | soit perdu lors d'une bascule d'urgence. Le problÚme survient lorsque |
|---|
| | 2107 | ce noeud est en avance sur les autres noeuds.</para> |
|---|
| | 2108 | |
|---|
| | 2109 | <para> Supposons que l'origine, le noeud 1, est au numéro de SYNC |
|---|
| | 2110 | 88901, un noeud non-transmetteur, le noeud 2 en est arrivé au numéro |
|---|
| | 2111 | 88897, tandis que les autres noeuds transmetteur, 3, 4, et 5, en sont |
|---|
| | 2112 | seulement au SYNC numéro 88895. A ce moment, le disque systÚme sur le |
|---|
| | 2113 | noeud origine prend feu. Le noeud 2 possÚde les <emphasis>données</emphasis> à jour |
|---|
| | 2114 | jusqu'Ã 88901, mais aucun noeud transmetteur ne dispose, dans les tables |
|---|
| | 2115 | &sllog1; ou &sllog2;, des données correspondant |
|---|
| | 2116 | aux événements SYNCs numérotés 88896 et 88897. Il n'y a donc |
|---|
| | 2117 | aucun moyen de ramener les noeuds 3-5 Ã ce niveau.</para> |
|---|
| | 2118 | |
|---|
| | 2119 | <para> Ã ce stade, vous avez deux choix : supprimer le noeud2, car il |
|---|
| | 2120 | n'existe aucun moyen de le maintenir, ou supprimer tous les noeuds |
|---|
| | 2121 | <emphasis>sauf</emphasis> le noeud 2, car il n'existe aucun moyen de les |
|---|
| | 2122 | amener jusqu'à l'événement SYNC 88897.</para> |
|---|
| | 2123 | |
|---|
| | 2124 | <para> Ce dilemme peut être évité en s'assurant que tous les noeuds directement |
|---|
| | 2125 | abonnés à l'origine sont des transmetteurs. </para> |
|---|
| | 2126 | |
|---|
| | 2127 | </refsect1> |
|---|
| | 2128 | <refsect1> <title> Comportement dangereux et non-intuitif </title> |
|---|
| 2130 | | <listitem><para> The fact that the request returns immediately |
|---|
| 2131 | | even though the subscription may take considerable time to |
|---|
| 2132 | | complete may be a bit surprising. </para> |
|---|
| 2133 | | |
|---|
| 2134 | | <para> Processing of the subscription involves |
|---|
| 2135 | | <emphasis>two</emphasis> events; the |
|---|
| 2136 | | <command>SUBSCRIBE_SET</command>, initiated from the provider |
|---|
| 2137 | | node, and an <command>ENABLE_SUBSCRIPTION</command>, which is |
|---|
| 2138 | | initiated on the subscriber node. This means that <xref |
|---|
| 2139 | | linkend="stmtwaitevent"/> cannot directly wait for completion of a |
|---|
| 2140 | | subscription. If you need to wait for completion of a |
|---|
| 2141 | | subscription, then what you need to do instead is to submit a |
|---|
| 2142 | | <xref linkend="stmtsync"/> request, and wait for |
|---|
| 2143 | | <emphasis>that</emphasis> event.</para> |
|---|
| | 2132 | <listitem><para> Le fait que la requête se termine immédiatement |
|---|
| | 2133 | même si l'abonnement prend un temps considérable est parfois surprenant. |
|---|
| | 2134 | </para> |
|---|
| | 2135 | |
|---|
| | 2136 | <para> Le traitement des abonnements implique |
|---|
| | 2137 | <emphasis>deux</emphasis> événements; l'opération |
|---|
| | 2138 | <command>SUBSCRIBE_SET</command>, initié sur le noeud fournisseur, |
|---|
| | 2139 | et une opération <command>ENABLE_SUBSCRIPTION</command>, qui est |
|---|
| | 2140 | initiée sur le noeud abonné. Cela signifie que <xref |
|---|
| | 2141 | linkend="stmtwaitevent"/> ne peut pas attendre la fin d'une souscription. |
|---|
| | 2142 | Si vous souhaitez attendre la fin d'un abonnement, alors vous devez soumettre une |
|---|
| | 2143 | requête <xref linkend="stmtsync"/> et attendre que <emphasis>cet</emphasis> événement |
|---|
| | 2144 | s'achÚve.</para> |
|---|
| 2146 | | <listitem><para> This command has <emphasis>two</emphasis> |
|---|
| 2147 | | purposes; setting up subscriptions (which should be unsurprising) |
|---|
| 2148 | | and <emphasis>revising subscriptions</emphasis>, which isn't so |
|---|
| 2149 | | obvious to intuition. </para> </listitem> |
|---|
| 2150 | | |
|---|
| 2151 | | <listitem><para> New subscriptions are set up by using |
|---|
| 2152 | | <command>DELETE</command> or <command>TRUNCATE</command> to |
|---|
| 2153 | | empty the table on a subscriber. If you created a new node by |
|---|
| 2154 | | copying data from an existing node, it might <quote>seem |
|---|
| 2155 | | intuitive</quote> that that data should be kept; that is not the |
|---|
| 2156 | | case - the former contents are discarded and the node is |
|---|
| 2157 | | populated <emphasis>from scratch</emphasis>.</para> </listitem> |
|---|
| | 2147 | <listitem><para> Cette commande a <emphasis>deux</emphasis> |
|---|
| | 2148 | objectifs : mettre en place des abonnements ( ce qui n'est trÚs surprenant ) |
|---|
| | 2149 | et <emphasis>modifier des abonnements</emphasis>, ce qui n'est pas forcément |
|---|
| | 2150 | intuitif. </para> </listitem> |
|---|
| | 2151 | |
|---|
| | 2152 | <listitem><para> Les nouveaux abonnements sont définis en utilisant |
|---|
| | 2153 | <command>DELETE</command> ou <command>TRUNCATE</command> pour vider |
|---|
| | 2154 | les tables sur l'abonné. Si vous avez créé un nouveau noeud en |
|---|
| | 2155 | recopiant les données à partir d'un noeud existant, il peut <quote>paraitre |
|---|
| | 2156 | évident</quote> que ces données seront conservées. Ce n'est pas le cas, |
|---|
| | 2157 | l'ancien contenu est détruit et le noeud est re-peupler <emphasis>à partir |
|---|
| | 2158 | de zéro</emphasis>.</para> </listitem> |
|---|
| 2164 | | <para> This operation does <emphasis>not</emphasis> require |
|---|
| 2165 | | acquiring any locks on the provider node.</para> |
|---|
| 2166 | | |
|---|
| 2167 | | <para> On the subscriber node, it will have the effect of locking |
|---|
| 2168 | | every table in the replication set. In version 1.2, exclusive |
|---|
| 2169 | | locks are acquired at the beginning of the process; in earlier |
|---|
| 2170 | | versions, locks were acquired implicitly as activity mandated it, |
|---|
| 2171 | | which left some risk of deadlock if other applications could |
|---|
| 2172 | | access the subscriber database at this time. |
|---|
| | 2165 | <para> Cette opération ne nécessite <emphasis>pas</emphasis> de verrous |
|---|
| | 2166 | sur le noeud fournisseur.</para> |
|---|
| | 2167 | |
|---|
| | 2168 | <para> Sur le noeud abonné, l'opération placera un verrou |
|---|
| | 2169 | sur toutes les table de l'ensemble de réplication. Dans la version |
|---|
| | 2170 | 1.2, les verrous exclusifs sont placés au début du processus; dans les |
|---|
| | 2171 | versions antérieurs, les verrous sont placés implicitement uniquement lorsque |
|---|
| | 2172 | qu'une activité le demande, ce qui laisse une possibilité d'inter-blocage |
|---|
| | 2173 | ("deadlock") si d'autres applications peuvent accéder à la base à ce moment là . |
|---|
| 2264 | | <para> Guards a replication set against client application updates |
|---|
| 2265 | | in preparation for a <xref linkend="stmtmoveset"/> command. |
|---|
| 2266 | | </para> |
|---|
| 2267 | | |
|---|
| 2268 | | <para> This command must be the first in a possible statement |
|---|
| 2269 | | group (<command>try</command>). The reason for this is that it |
|---|
| 2270 | | needs to commit the changes made to the tables (adding a special |
|---|
| 2271 | | trigger function) before it can wait for every concurrent |
|---|
| 2272 | | transaction to finish. At the same time it cannot hold an open |
|---|
| 2273 | | transaction to the same database itself since this would result in |
|---|
| 2274 | | blocking itself forever.</para> |
|---|
| 2275 | | |
|---|
| 2276 | | <para> Note that this is a &rlocking; operation, which means that |
|---|
| 2277 | | it can get stuck behind other database activity.</para> |
|---|
| 2278 | | |
|---|
| 2279 | | <para> The operation waits for transaction IDs to advance in order |
|---|
| 2280 | | that data is not missed on the new origin. Thus, if you have |
|---|
| 2281 | | long-running transactions running on the source node, this |
|---|
| 2282 | | operation will wait for those transactions to complete. |
|---|
| 2283 | | Unfortunately, if you have another database on the same postmaster |
|---|
| 2284 | | as the origin node, long running transactions on that database |
|---|
| 2285 | | will also be considered even though they are essentially |
|---|
| 2286 | | independent. |
|---|
| | 2264 | <para> Cette commande protÚge un ensemble de réplication des mises à |
|---|
| | 2265 | jour en provenance des applications clientes, en préparation d'une |
|---|
| | 2266 | commande <xref linkend="stmtmoveset"/>. |
|---|
| | 2267 | </para> |
|---|
| | 2268 | |
|---|
| | 2269 | <para> Cette commande doit être la premiÚre dans un groupe de commande <command>try</command>. |
|---|
| | 2270 | En effet, il faut <quote>committer</quote> les changements faits sur les tables |
|---|
| | 2271 | (ajout d'une fonction trigger speciale) avant d'attendre que toutes les |
|---|
| | 2272 | transactions concurrentes se termine. En même temps, il ne faut pas |
|---|
| | 2273 | non plus garder une transaction ouverte sur la base elle-même car cela |
|---|
| | 2274 | cela signifierait qu'elle se bloque elle-même. |
|---|
| | 2275 | </para> |
|---|
| | 2276 | |
|---|
| | 2277 | <para> Notons qu'il s'agit d'un opération &rlocking;, ce qui signifie qu'elle peut être |
|---|
| | 2278 | bloquer derriÚre d'autres activités de la base.</para> |
|---|
| | 2279 | |
|---|
| | 2280 | <para> L'opération attend que les identifiants de transaction avancent |
|---|
| | 2281 | afin qu'aucune donnée ne soient oubliées sur la nouvelle origine. Ainsi |
|---|
| | 2282 | si vous avez des transactions trÚs longues en cours sur le noeud source, |
|---|
| | 2283 | cette opération attendra que ces transactions aboutissent. |
|---|
| | 2284 | Malheureusement , si vous avez une autre base de données sur le même |
|---|
| | 2285 | postmaster du noeud origine, les transactions longues en cours |
|---|
| | 2286 | sur cette base seront aussi prises en compte même si elles sont par définition |
|---|
| | 2287 | indépendantes. |
|---|
| 2483 | | The <command>FAILOVER</command> command causes the backup node to take over all sets |
|---|
| 2484 | | that currently originate on the failed |
|---|
| 2485 | | node. <application>slonik</application> will contact all other |
|---|
| 2486 | | direct subscribers of the failed node to determine which node has |
|---|
| 2487 | | the highest sync status for each set. If another node has a |
|---|
| 2488 | | higher sync status than the backup node, the replication will |
|---|
| 2489 | | first be redirected so that the backup node replicates against |
|---|
| 2490 | | that other node, before assuming the origin role and allowing |
|---|
| 2491 | | update activity. |
|---|
| 2492 | | </para> |
|---|
| 2493 | | |
|---|
| 2494 | | <para> |
|---|
| 2495 | | After successful failover, all former direct subscribers of the |
|---|
| 2496 | | failed node become direct subscribers of the backup node. The |
|---|
| 2497 | | failed node is abandoned, and can and should be removed from the |
|---|
| 2498 | | configuration with <xref linkend="stmtdropnode"/>. |
|---|
| | 2485 | La commande <command>FAILOVER</command> transfert tous les ensembles dont |
|---|
| | 2486 | l'origine est en panne vers le noeud de secours. |
|---|
| | 2487 | <application>slonik</application> va contacter tous les autres noeuds directement |
|---|
| | 2488 | abonnés au noeud en panne pour déterminer quel noeud à le meilleur niveau de synchronisation |
|---|
| | 2489 | pour chacun des ensembles de réplication. Si un autre noeud a un niveau de synchronisation |
|---|
| | 2490 | plus élévé que le noeud de secours, la réplication sera d'abord redirigée pour que le noeud |
|---|
| | 2491 | de secours rattrape son retard sur l'autre noeud, puis qu'il assume le role d'origine |
|---|
| | 2492 | et reçoive les mises à jour. |
|---|
| | 2493 | </para> |
|---|
| | 2494 | |
|---|
| | 2495 | <para> |
|---|
| | 2496 | AprÚs une bascule d'urgence réussie, tous les anciens noeuds abonnés directement |
|---|
| | 2497 | au noeud en panne deviennent des abonnés direct du noeud de secours. |
|---|
| | 2498 | Le noeud en panne est abandonné, et doit être retiré de la configuration avec |
|---|
| | 2499 | <xref linkend="stmtdropnode"/>. |
|---|
| 2526 | | <para> Exclusive locks on each replicated table will be taken out |
|---|
| 2527 | | on both the new origin node as replication triggers are changed. |
|---|
| 2528 | | If the new origin was not completely up to date, and replication |
|---|
| 2529 | | data must be drawn from some other node that is more up to date, |
|---|
| 2530 | | the new origin will not become usable until those updates are |
|---|
| 2531 | | complete. </para> |
|---|
| 2532 | | </refsect1> |
|---|
| 2533 | | <refsect1><title> Dangerous/Unintuitive Behaviour </title> |
|---|
| 2534 | | <para> This command will abandon the status of the failed |
|---|
| 2535 | | node. There is no possibility to let the failed node join the |
|---|
| 2536 | | cluster again without rebuilding it from scratch as a slave. If |
|---|
| 2537 | | at all possible, you would likely prefer to use <xref |
|---|
| 2538 | | linkend="stmtmoveset"/> instead, as that does |
|---|
| 2539 | | <emphasis>not</emphasis> abandon the failed node. |
|---|
| | 2527 | <para> Des verrous exclusifs sont posés sur chaque table répliquée sur |
|---|
| | 2528 | le nouveau noeud origine, car les triggers de réplication sont changés. |
|---|
| | 2529 | Si la nouvelle origine n'est pas tout à fait à jour, et que des données |
|---|
| | 2530 | doivent être rapatriées depuis à partir d'un autre noeud qui est mieux synchronisé, |
|---|
| | 2531 | alors la nouvelle origine ne sera pas utilisable avant que ces mises à jour |
|---|
| | 2532 | soient terminées. |
|---|
| | 2533 | </para> |
|---|
| | 2534 | </refsect1> |
|---|
| | 2535 | <refsect1><title> Comportement dangerous et non-intuitif </title> |
|---|
| | 2536 | <para> Cette commande va abandonner le noeud en panne. |
|---|
| | 2537 | Il n'y a pas de possibilité de réintégrer le noeud en panne, |
|---|
| | 2538 | sans le reconstruire à partir de zéro en tant qu'esclave. |
|---|
| | 2539 | Si c'est possible, il est préférable d'utiliser la commande |
|---|
| | 2540 | <xref linkend="stmtmoveset"/> , car elle n'abandonne |
|---|
| | 2541 | <emphasis>pas</emphasis> le noeud en panne. |
|---|
| 2563 | | <para> Executes a script containing arbitrary SQL statements on |
|---|
| 2564 | | all nodes that are subscribed to a set at a common controlled |
|---|
| 2565 | | point within the replication transaction stream.</para> |
|---|
| 2566 | | |
|---|
| 2567 | | <para> The specified event origin must be the origin of the set. |
|---|
| 2568 | | The script file must not contain any <command>START</command> or |
|---|
| 2569 | | <command>COMMIT TRANSACTION</command> calls. (This changes |
|---|
| 2570 | | somewhat in &postgres; 8.0 once nested transactions, aka |
|---|
| 2571 | | savepoints, are supported) In addition, non-deterministic DML |
|---|
| 2572 | | statements (like updating a field with |
|---|
| 2573 | | <function>CURRENT_TIMESTAMP</function>) must be avoided, since the |
|---|
| 2574 | | data changes done by the script are explicitly not |
|---|
| 2575 | | replicated. </para> |
|---|
| | 2565 | <para> Cette commande éxecutes un script contenant de ordres SQL sur |
|---|
| | 2566 | tous les noeufs qui sont abonnés à un ensemble de réplication à un |
|---|
| | 2567 | point précis dans le flux des transactions.</para> |
|---|
| | 2568 | OA |
|---|
| | 2569 | <para> L'origine de l'événement doit être l'origine de l'ensemble |
|---|
| | 2570 | de réplication. Le fichier de script ne doit pas contenir d'ordres |
|---|
| | 2571 | <command>START</command> ou <command>COMMIT TRANSACTION</command>. |
|---|
| | 2572 | (Ceci change un peu avec &postgres; 8.0 puisque les transactions imbriquées, |
|---|
| | 2573 | appelée également <quote>points de sauvegarde</quote> (<quote> |
|---|
| | 2574 | savepoints</quote>, sont supportés. |
|---|
| | 2575 | De plus les ordres DML non déterministes (par exemple mettre a jour un |
|---|
| | 2576 | champs avec la valeur <function>CURRENT_TIMESTAMP</function>) doivent |
|---|
| | 2577 | être évitées, car les changements effectués par ce script ne sont pas |
|---|
| | 2578 | explicitement répliqués. </para> |
|---|