Aaron Schulz has uploaded a new change for review.
https://gerrit.wikimedia.org/r/250182
Change subject: Make SqlBagOStuff respect WRITE_SYNC flag
......................................................................
Make SqlBagOStuff respect WRITE_SYNC flag
Change-Id: I75880c56b1eac63c9a0616ca10890904ce823a99
---
M includes/objectcache/SqlBagOStuff.php
1 file changed, 22 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/82/250182/1
diff --git a/includes/objectcache/SqlBagOStuff.php
b/includes/objectcache/SqlBagOStuff.php
index 1f384c7..64999d4 100644
--- a/includes/objectcache/SqlBagOStuff.php
+++ b/includes/objectcache/SqlBagOStuff.php
@@ -349,7 +349,12 @@
}
public function set( $key, $value, $exptime = 0, $flags = 0 ) {
- return $this->setMulti( array( $key => $value ), $exptime );
+ $ok = $this->setMulti( array( $key => $value ), $exptime );
+ if ( ( $flags & self::WRITE_SYNC ) == self::WRITE_SYNC ) {
+ $ok = $ok && $this->waitForSlaves();
+ }
+
+ return $ok;
}
protected function cas( $casToken, $key, $value, $exptime = 0 ) {
@@ -457,7 +462,12 @@
throw new Exception( "Got invalid callback." );
}
- return $this->mergeViaCas( $key, $callback, $exptime, $attempts
);
+ $ok = $this->mergeViaCas( $key, $callback, $exptime, $attempts
);
+ if ( ( $flags & self::WRITE_SYNC ) == self::WRITE_SYNC ) {
+ $ok = $ok && $this->waitForSlaves();
+ }
+
+ return $ok;
}
/**
@@ -729,4 +739,14 @@
}
}
}
+
+ protected function waitForSlaves() {
+ if ( $this->serverInfos == false ) {
+ // Main LB is used; wait for any slaves to catch up
+ return wfWaitForSlaves( null, false, false, 3 );
+ } else {
+ // Custom DB server list; probably doesn't use
replication
+ return true;
+ }
+ }
}
--
To view, visit https://gerrit.wikimedia.org/r/250182
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I75880c56b1eac63c9a0616ca10890904ce823a99
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits