Geen cache-versie.

Caching uitgeschakeld. Standaardinstelling voor deze pagina:ingeschakeld (code DEF204)
Als het scherm te langzaam is, kunt u de gebruikersmodus uitschakelen om de cacheversie te bekijken.

Rechercher dans le manuel MySQL

12.18 Functions Used with Global Transaction Identifiers (GTIDs)

The functions described in this section are used with GTID-based replication. It is important to keep in mind that all of these functions take string representations of GTID sets as arguments. As such, the GTID sets must always be quoted when used with them. See GTID Sets for more information.

The union of two GTID sets is simply their representations as strings, joined together with an interposed comma. In other words, you can define a very simple function for obtaining the union of two GTID sets, similar to that created here:

  1. CREATE FUNCTION GTID_UNION(g1 TEXT, g2 TEXT)
  2.     RETURN CONCAT(g1,',',g2);

For more information about GTIDs and how these GTID functions are used in practice, see Section 17.1.3, “Replication with Global Transaction Identifiers”.

Table 12.23 GTID Functions

Name Description
GTID_SUBSET() Return true if all GTIDs in subset are also in set; otherwise false.
GTID_SUBTRACT() Return all GTIDs in set that are not in subset.
WAIT_FOR_EXECUTED_GTID_SET() Wait until the given GTIDs have executed on the slave.
WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS() (deprecated 8.0.18) Deprecated. Use WAIT_FOR_EXECUTED_GTID_SET().

  • GTID_SUBSET(set1,set2)

    Given two sets of global transaction identifiers set1 and set2, returns true if all GTIDs in set1 are also in set2. Returns false otherwise.

    The GTID sets used with this function are represented as strings, as shown in the following examples:

    1. mysql> SELECT GTID_SUBSET('3E11FA47-71CA-11E1-9E33-C80AA9429562:23',
    2.     ->     '3E11FA47-71CA-11E1-9E33-C80AA9429562:21-57')\G
    3. *************************** 1. row ***************************
    4. GTID_SUBSET('3E11FA47-71CA-11E1-9E33-C80AA9429562:23',
    5.     '3E11FA47-71CA-11E1-9E33-C80AA9429562:21-57'): 1
    6. 1 row in set (0.00 sec)
    7.  
    8. mysql> SELECT GTID_SUBSET('3E11FA47-71CA-11E1-9E33-C80AA9429562:23-25',
    9.     ->     '3E11FA47-71CA-11E1-9E33-C80AA9429562:21-57')\G
    10. *************************** 1. row ***************************
    11. GTID_SUBSET('3E11FA47-71CA-11E1-9E33-C80AA9429562:23-25',
    12.     '3E11FA47-71CA-11E1-9E33-C80AA9429562:21-57'): 1
    13. 1 row in set (0.00 sec)
    14.  
    15. mysql> SELECT GTID_SUBSET('3E11FA47-71CA-11E1-9E33-C80AA9429562:20-25',
    16.     ->     '3E11FA47-71CA-11E1-9E33-C80AA9429562:21-57')\G
    17. *************************** 1. row ***************************
    18. GTID_SUBSET('3E11FA47-71CA-11E1-9E33-C80AA9429562:20-25',
    19.     '3E11FA47-71CA-11E1-9E33-C80AA9429562:21-57'): 0
    20. 1 row in set (0.00 sec)
  • GTID_SUBTRACT(set1,set2)

    Given two sets of global transaction identifiers set1 and set2, returns only those GTIDs from set1 that are not in set2.

    All GTID sets used with this function are represented as strings and must be quoted, as shown in these examples:

    1. mysql> SELECT GTID_SUBTRACT('3E11FA47-71CA-11E1-9E33-C80AA9429562:21-57',
    2.     ->     '3E11FA47-71CA-11E1-9E33-C80AA9429562:21')\G
    3. *************************** 1. row ***************************
    4. GTID_SUBTRACT('3E11FA47-71CA-11E1-9E33-C80AA9429562:21-57',
    5.     '3E11FA47-71CA-11E1-9E33-C80AA9429562:21'): 3e11fa47-71ca-11e1-9e33-c80aa9429562:22-57
    6. 1 row in set (0.00 sec)
    7.  
    8. mysql> SELECT GTID_SUBTRACT('3E11FA47-71CA-11E1-9E33-C80AA9429562:21-57',
    9.     ->     '3E11FA47-71CA-11E1-9E33-C80AA9429562:20-25')\G
    10. *************************** 1. row ***************************
    11. GTID_SUBTRACT('3E11FA47-71CA-11E1-9E33-C80AA9429562:21-57',
    12.     '3E11FA47-71CA-11E1-9E33-C80AA9429562:20-25'): 3e11fa47-71ca-11e1-9e33-c80aa9429562:26-57
    13. 1 row in set (0.00 sec)
    14.  
    15. mysql> SELECT GTID_SUBTRACT('3E11FA47-71CA-11E1-9E33-C80AA9429562:21-57',
    16.     ->     '3E11FA47-71CA-11E1-9E33-C80AA9429562:23-24')\G
    17. *************************** 1. row ***************************
    18. GTID_SUBTRACT('3E11FA47-71CA-11E1-9E33-C80AA9429562:21-57',
    19.     '3E11FA47-71CA-11E1-9E33-C80AA9429562:23-24'): 3e11fa47-71ca-11e1-9e33-c80aa9429562:21-22:25-57
    20. 1 row in set (0.01 sec)
  • WAIT_FOR_EXECUTED_GTID_SET(gtid_set[, timeout])

    Wait until the server has applied all of the transactions whose global transaction identifiers are contained in gtid_set; that is, until the condition GTID_SUBSET(gtid_subset, @@GLOBAL.gtid_executed) holds. See Section 17.1.3.1, “GTID Format and Storage” for a definition of GTID sets.

    If a timeout is specified, and timeout seconds elapse before all of the transactions in the GTID set have been applied, the function stops waiting. timeout is optional, and the default timeout is 0 seconds, in which case the function always waits until all of the transactions in the GTID set have been applied.

    WAIT_FOR_EXECUTED_GTID_SET() monitors all the GTIDs that are applied on the server, including transactions that arrive from all replication channels and user clients. It does not take into account whether replication channels have been started or stopped.

    For more information, see Section 17.1.3, “Replication with Global Transaction Identifiers”.

    GTID sets used with this function are represented as strings and so must be quoted as shown in the following example:

    1. mysql> SELECT WAIT_FOR_EXECUTED_GTID_SET('3E11FA47-71CA-11E1-9E33-C80AA9429562:1-5');
    2.         -> 0

    For a syntax description for GTID sets, see Section 17.1.3.1, “GTID Format and Storage”.

    For WAIT_FOR_EXECUTED_GTID_SET(), the return value is the state of the query, where 0 represents success, and 1 represents timeout. Any other failures generate an error.

    gtid_mode cannot be changed to OFF while any client is using this function to wait for GTIDs to be applied.

  • WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS(gtid_set[, timeout][,channel])

    WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS() is deprecated. Use WAIT_FOR_EXECUTED_GTID_SET() instead, which works regardless of the replication channel or user client through which the specified transactions arrive on the server.


Zoek in de MySQL-handleiding

Nederlandse vertaling

U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.

Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.

Bij voorbaat dank.

Document heeft de 26/06/2006 gemaakt, de laatste keer de 26/10/2018 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/mysql-rf-gtid-functions.html

De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.

Referenties

  1. Bekijk - html-document Taal van het document:en Manuel MySQL : https://dev.mysql.com/

Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.

Inhoudsopgave Haut