/**
* The place to put new revisions, false to put them in the local text table.
* Part of a URL, e.g. DB://cluster1
+ *
+ * Can be an array instead of a single string, to enable data distribution. Keys
+ * must be consecutive integers, starting at zero. Example:
+ *
+ * $wgDefaultExternalStore = array( 'DB://cluster1', 'DB://cluster2' );
+ *
*/
$wgDefaultExternalStore = false;
# Write to external storage if required
if ( $wgDefaultExternalStore ) {
+ if ( is_array( $wgDefaultExternalStore ) ) {
+ // Distribute storage across multiple clusters
+ $store = $wgDefaultExternalStore[mt_rand(0, count( $wgDefaultExternalStore ) - 1)];
+ } else {
+ $store = $wgDefaultExternalStore;
+ }
require_once('ExternalStore.php');
// Store and get the URL
- $data = ExternalStore::insert( $wgDefaultExternalStore, $data );
+ $data = ExternalStore::insert( $store, $data );
if ( !$data ) {
# This should only happen in the case of a configuration error, where the external store is not valid
- wfDebugDieBacktrace( "Unable to store text to external storage $wgDefaultExternalStore" );
+ wfDebugDieBacktrace( "Unable to store text to external storage $store" );
}
if ( $flags ) {
$flags .= ',';