$stat = $this->doGetFileStat( $params );
wfProfileOut( __METHOD__ . '-miss-' . $this->name );
if ( is_array( $stat ) ) { // file exists
- $stat['latest'] = $latest;
+ // Strongly consistent backends can automatically set "latest"
+ $stat['latest'] = isset( $stat['latest'] ) ? $stat['latest'] : $latest;
$this->cheapCache->set( $path, 'stat', $stat );
$this->setFileCache( $path, $stat ); // update persistent cache
if ( isset( $stat['sha1'] ) ) { // some backends store SHA-1 as metadata
continue; // this shouldn't happen
}
if ( is_array( $stat ) ) { // file exists
- $stat['latest'] = $latest;
+ // Strongly consistent backends can automatically set "latest"
+ $stat['latest'] = isset( $stat['latest'] ) ? $stat['latest'] : $latest;
$this->cheapCache->set( $path, 'stat', $stat );
$this->setFileCache( $path, $stat ); // update persistent cache
if ( isset( $stat['sha1'] ) ) { // some backends store SHA-1 as metadata
/** @var int UNIX timestamp */
protected $authErrorTimestamp = null;
+ /** @var bool Whether the server is an Ceph RGW */
+ protected $isRGW = false;
+
/**
* @see FileBackendStore::__construct()
* Additional $config params include:
'md5' => ctype_xdigit( $rhdrs['etag'] ) ? $rhdrs['etag'] : null,
'xattr' => array( 'metadata' => $metadata, 'headers' => $headers )
);
+ if ( $this->isRGW ) {
+ $stat['latest'] = true; // strong consistency
+ }
} elseif ( $rcode === 404 ) {
$stat = false;
} else {
return null;
}
}
+ // Ceph RGW does not use <account> in URLs (OpenStack Swift uses "/v1/<account>")
+ if ( substr( $this->authCreds['storage_url'], -3 ) === '/v1' ) {
+ $this->isRGW = true; // take advantage of strong consistency
+ }
}
return $this->authCreds;