Merge "rdbms: Log warning if ChronologyProtector finds data under presumed clientID"
This commit is contained in:
commit
827b4c22a5
1 changed files with 27 additions and 0 deletions
|
|
@ -163,6 +163,26 @@ class ChronologyProtector implements LoggerAwareInterface {
|
||||||
/** @var float|null */
|
/** @var float|null */
|
||||||
private $wallClockOverride;
|
private $wallClockOverride;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether we are assuming a semi-deterministic clientId.
|
||||||
|
*
|
||||||
|
* This is set to true on the majority of requests where a clientId wasn't set
|
||||||
|
* in a cookie or query param, i.e. when there were no recent writes in this
|
||||||
|
* browsing session. This is a temporary flag to determine whether and why
|
||||||
|
* a client might receive a clientId but then not send it back to the server
|
||||||
|
* on subsequent requests (i.e. due to cross-domain browser restrictions that
|
||||||
|
* we may have not known about as part of Multi-DC prep in T91820, or due to
|
||||||
|
* bot frameworks that may be ignoring cookies).
|
||||||
|
*
|
||||||
|
* We then use this flag to log a warning in lazyStartup() if there were in
|
||||||
|
* fact stored positions found under the assumed clientId.
|
||||||
|
*
|
||||||
|
* See also: <https://phabricator.wikimedia.org/T314434>
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
private $hasImplicitClientId = false;
|
||||||
|
|
||||||
/** Seconds to store position write index cookies (safely less than POSITION_STORE_TTL) */
|
/** Seconds to store position write index cookies (safely less than POSITION_STORE_TTL) */
|
||||||
public const POSITION_COOKIE_TTL = 10;
|
public const POSITION_COOKIE_TTL = 10;
|
||||||
/** Seconds to store replication positions */
|
/** Seconds to store replication positions */
|
||||||
|
|
@ -195,6 +215,7 @@ class ChronologyProtector implements LoggerAwareInterface {
|
||||||
if ( isset( $client['clientId'] ) ) {
|
if ( isset( $client['clientId'] ) ) {
|
||||||
$this->clientId = $client['clientId'];
|
$this->clientId = $client['clientId'];
|
||||||
} else {
|
} else {
|
||||||
|
$this->hasImplicitClientId = true;
|
||||||
$this->clientId = ( $secret != '' )
|
$this->clientId = ( $secret != '' )
|
||||||
? hash_hmac( 'md5', $client['ip'] . "\n" . $client['agent'], $secret )
|
? hash_hmac( 'md5', $client['ip'] . "\n" . $client['agent'], $secret )
|
||||||
: md5( $client['ip'] . "\n" . $client['agent'] );
|
: md5( $client['ip'] . "\n" . $client['agent'] );
|
||||||
|
|
@ -462,6 +483,12 @@ class ChronologyProtector implements LoggerAwareInterface {
|
||||||
] + $this->clientLogInfo );
|
] + $this->clientLogInfo );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( $indexReached && $this->hasImplicitClientId ) {
|
||||||
|
$this->logger->warning( 'found position data under a presumed clientId (T314434)', [
|
||||||
|
'indexReached' => $indexReached
|
||||||
|
] + $this->clientLogInfo );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue