X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Flibs%2Frdbms%2Floadbalancer%2FILoadBalancer.php;h=b21da72b499a5ea6ca3c40f4af5b6ad86de96e19;hb=358348d9bf90f0f1bacb64e5348936e7813108c3;hp=ba0b4a04e56bb98a9a386de7d85700d278f3d0b7;hpb=02e9220745bc38b79f3ebc86df9d3b351dfeb042;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/libs/rdbms/loadbalancer/ILoadBalancer.php b/includes/libs/rdbms/loadbalancer/ILoadBalancer.php index ba0b4a04e5..b21da72b49 100644 --- a/includes/libs/rdbms/loadbalancer/ILoadBalancer.php +++ b/includes/libs/rdbms/loadbalancer/ILoadBalancer.php @@ -86,8 +86,8 @@ interface ILoadBalancer { /** @var string Domain specifier when no specific database needs to be selected */ const DOMAIN_ANY = ''; - /** @var bool The generic query group (bool gives b/c with 1.33 method signatures) */ - const GROUP_GENERIC = false; + /** @var string The generic query group */ + const GROUP_GENERIC = ''; /** @var int DB handle should have DBO_TRX disabled and the caller will leave it as such */ const CONN_TRX_AUTOCOMMIT = 1; @@ -155,6 +155,18 @@ interface ILoadBalancer { */ public function redefineLocalDomain( $domain ); + /** + * Indicate whether the tables on this domain are only temporary tables for testing + * + * In "temporary tables mode", the ILoadBalancer::CONN_TRX_AUTOCOMMIT flag is ignored + * + * @param bool $value + * @param string $domain + * @return bool Whether "temporary tables mode" was active + * @since 1.34 + */ + public function setTempTablesOnlyMode( $value, $domain ); + /** * Get the server index of the reader connection for a given group * @@ -167,8 +179,7 @@ interface ILoadBalancer { * * @param string|bool $group Query group or false for the generic group * @param string|bool $domain DB domain ID or false for the local domain - * @throws DBError If no live handle can be obtained - * @return bool|int|string + * @return int|bool Returns false if no live handle can be obtained */ public function getReaderIndex( $group = false, $domain = false ); @@ -270,7 +281,7 @@ interface ILoadBalancer { * @see ILoadBalancer::getServerAttributes() * * @param int $i Server index (overrides $groups) or DB_MASTER/DB_REPLICA - * @param string[]|string $groups Query group(s) or [] to use the default group + * @param string[]|string $groups Query group(s) in preference order; [] for the default group * @param string|bool $domain DB domain ID or false for the local domain * @param int $flags Bitfield of CONN_* class constants * @@ -326,7 +337,7 @@ interface ILoadBalancer { * @see ILoadBalancer::getConnection() for parameter information * * @param int $i Server index or DB_MASTER/DB_REPLICA - * @param string[]|string $groups Query group(s) or [] to use the default group + * @param string[]|string $groups Query group(s) in preference order; [] for the default group * @param string|bool $domain DB domain ID or false for the local domain * @param int $flags Bitfield of CONN_* class constants (e.g. CONN_TRX_AUTOCOMMIT) * @return DBConnRef @@ -347,7 +358,7 @@ interface ILoadBalancer { * @see ILoadBalancer::getConnection() for parameter information * * @param int $i Server index or DB_MASTER/DB_REPLICA - * @param string[]|string $groups Query group(s) or [] to use the default group + * @param string[]|string $groups Query group(s) in preference order; [] for the default group * @param string|bool $domain DB domain ID or false for the local domain * @param int $flags Bitfield of CONN_* class constants (e.g. CONN_TRX_AUTOCOMMIT) * @return DBConnRef @@ -369,7 +380,7 @@ interface ILoadBalancer { * @see ILoadBalancer::getConnection() for parameter information * * @param int $i Server index or DB_MASTER/DB_REPLICA - * @param string[]|string $groups Query group(s) or [] to use the default group + * @param string[]|string $groups Query group(s) in preference order; [] for the default group * @param string|bool $domain DB domain ID or false for the local domain * @param int $flags Bitfield of CONN_* class constants (e.g. CONN_TRX_AUTOCOMMIT) * @return MaintainableDBConnRef @@ -455,11 +466,30 @@ interface ILoadBalancer { public function getServerAttributes( $i ); /** - * Get the current master position for chronology control purposes + * Get the current master replication position + * * @return DBMasterPos|bool Returns false if not applicable + * @throws DBError */ public function getMasterPos(); + /** + * Get the highest DB replication position for chronology control purposes + * + * If there is only a master server then this returns false. If replication is present + * and correctly configured, then this returns the highest replication position of any + * server with an open connection. That position can later be passed to waitFor() on a + * new load balancer instance to make sure that queries on the new connections see data + * at least as up-to-date as queries (prior to this method call) on the old connections. + * + * This can be useful for implementing session consistency, where the session + * will be resumed accross multiple HTTP requests or CLI script instances. + * + * @return DBMasterPos|bool Replication position or false if not applicable + * @since 1.34 + */ + public function getReplicaResumePos(); + /** * Disable this load balancer. All connections are closed, and any attempt to * open a new connection will result in a DBAccessError.