MediaWiki
1.30.0
|
Functions | |
$dbw | begin (__METHOD__) |
$dbw | commit (__METHOD__) |
foreach ( $res as $row) | |
$dbw | insert () |
We use the convention $dbr for read and $dbw for write to help you keep track of whether the database object is a the world will explode Or to be a subsequent write query which succeeded on the master may fail when replicated to the slave due to a unique key collision Replication on the slave will stop and it may take hours to repair the database and get it back online Setting read_only in my cnf on the slave will avoid this but given the dire we prefer to have as many checks as possible We provide a but the wrapper functions like please read the documentation for except in special pages derived from QueryPage It s a common pitfall for new developers to submit code containing SQL queries which examine huge numbers of rows Remember that COUNT * | is (N), counting rows in atable is like counting beans in a bucket.------------------------------------------------------------------------ Replication------------------------------------------------------------------------The largest installation of MediaWiki, Wikimedia, uses a large set ofslave MySQL servers replicating writes made to a master MySQL server. Itis important to understand the issues associated with this setup if youwant to write code destined for Wikipedia.It 's often the case that the best algorithm to use for a given taskdepends on whether or not replication is in use. Due to our unabashedWikipedia-centrism, we often just use the replication-friendly version, but if you like, you can use wfGetLB() ->getServerCount() > 1 tocheck to see if replication is in use.===Lag===Lag primarily occurs when large write queries are sent to the master.Writes on the master are executed in parallel, but they are executed inserial when they are replicated to the slaves. The master writes thequery to the binlog when the transaction is committed. The slaves pollthe binlog and start executing the query as soon as it appears. They canservice reads while they are performing a write query, but will not readanything more from the binlog and thus will perform no more writes. Thismeans that if the write query runs for a long time, the slaves will lagbehind the master for the time it takes for the write query to complete.Lag can be exacerbated by high read load. MediaWiki 's load balancer willstop sending reads to a slave when it is lagged by more than 30 seconds.If the load ratios are set incorrectly, or if there is too much loadgenerally, this may lead to a slave permanently hovering around 30seconds lag.If all slaves are lagged by more than 30 seconds, MediaWiki will stopwriting to the database. All edits and other write operations will berefused, with an error returned to the user. This gives the slaves achance to catch up. Before we had this mechanism, the slaves wouldregularly lag by several minutes, making review of recent editsdifficult.In addition to this, MediaWiki attempts to ensure that the user seesevents occurring on the wiki in chronological order. A few seconds of lagcan be tolerated, as long as the user sees a consistent picture fromsubsequent requests. This is done by saving the master binlog positionin the session, and then at the start of each request, waiting for theslave to catch up to that position before doing any reads from it. Ifthis wait times out, reads are allowed anyway, but the request isconsidered to be in "lagged slave mode". Lagged slave mode can bechecked by calling wfGetLB() ->getLaggedSlaveMode(). The onlypractical consequence at present is a warning displayed in the pagefooter.===Lag avoidance===To avoid excessive lag, queries which write large numbers of rows shouldbe split up, generally to write one row at a time. Multi-row INSERT ...SELECT queries are the worst offenders should be avoided altogether.Instead do the select first and then the insert.===Working with lag===Despite our best efforts, it 's not practical to guarantee a low-lagenvironment. Lag will usually be less than one second, but mayoccasionally be up to 30 seconds. For scalability, it 's very importantto keep load on the master low, so simply sending all your queries tothe master is not the answer. So when you have a genuine need forup-to-date data, the following approach is advised:1) Do a quick query to the master for a sequence number or timestamp 2) Run the full query on the slave and check if it matches the data you gotfrom the master 3) If it doesn 't, run the full query on the masterTo avoid swamping the master every time the slaves lag, use of thisapproach should be kept to a minimum. In most cases you should just readfrom the slave and let the user deal with the delay.------------------------------------------------------------------------ Lock contention------------------------------------------------------------------------Due to the high write rate on Wikipedia(and some other wikis), MediaWiki developers need to be very careful to structure their writesto avoid long-lasting locks. By default, MediaWiki opens a transactionat the first query, and commits it before the output is sent. Locks willbe held from the time when the query is done until the commit. So youcan reduce lock time by doing as much processing as possible before youdo your write queries.Often this approach is not good enough, and it becomes necessary toenclose small groups of queries in their own transaction. Use thefollowing syntax:$dbw=wfGetDB(DB_MASTER |
We use the convention $dbr for read and $dbw for write to help you keep track of whether the database object is a the world will explode Or to be a subsequent write query which succeeded on the master may fail when replicated to the slave due to a unique key collision Replication on the slave will stop and it may take hours to repair the database and get it back online Setting read_only in my cnf on the slave will avoid this but given the dire we prefer to have as many checks as possible We provide a | query () function for raw SQL |
Use of locking | reads (e.g. the FOR UPDATE clause) is not advised. They are poorly implemented in InnoDB and will cause regular deadlock errors. It 's also surprisingly easy to cripple the wiki with lock contention. Instead of locking reads |
We use the convention $dbr for read and $dbw for write to help you keep track of whether the database object is a the world will explode Or to be a subsequent write query which succeeded on the master may fail when replicated to the slave due to a unique key collision Replication on the slave will stop and it may take hours to repair the database and get it back online Setting read_only in my cnf on the slave will avoid this but given the dire we prefer to have as many checks as possible We provide a but the wrapper functions like | select () and insert() are usually more convenient. They take care of things like table prefixes and escaping for you. If you really need to make your own SQL |
We use the convention $dbr for read and $dbw for write to help you keep track of whether the database object is a | slave (read-only) or a master(read/write). If you write to a slave |
We use the convention $dbr for read and $dbw for write to help you keep track of whether the database object is a the world will explode Or to be a subsequent write query which succeeded on the master may fail when replicated to the slave due to a unique key collision Replication on the slave will stop and it may take hours to repair the database and get it back online Setting read_only in my cnf on the slave will avoid this but given the dire we prefer to have as many checks as possible We provide a but the wrapper functions like please read the documentation for | tableName () and addQuotes(). You will need both of them. ------------------------------------------------------------------------ Basic query optimisation ------------------------------------------------------------------------ MediaWiki developers who need to write DB queries should have some understanding of databases and the performance issues associated with them. Patches containing unacceptably slow features will not be accepted. Unindexed queries are generally not welcome in MediaWiki |
Variables | |
$res = $dbr->select( ) | |
We use the convention $dbr for read and $dbw for write to help you keep track of whether the database object is a the world will explode Or to be a subsequent write query which succeeded on the master may fail when replicated to the slave due to a unique key collision Replication on the slave will stop and it may take hours to repair the database and get it back online Setting read_only in my cnf on the slave will avoid this but given the dire | consequences |
Some information about database access in MediaWiki By Tim January Database layout For information about the MediaWiki database such as a description of the tables and their | contents |
Some information about database access in MediaWiki By Tim January Database layout For information about the MediaWiki database | layout |
For a write use something | like |
We use the convention $dbr for read and $dbw for write to help you keep track of whether the database object is a the world will explode Or to be | precise |
Use of locking combine your existence checks into your write | queries |
For a write | query |
We use the convention $dbr for read and $dbw for write to help you keep track of whether the database object is a the world will explode Or to be a subsequent write query which succeeded on the master may fail when replicated to the slave due to a unique key collision Replication on the slave will stop and it may take hours to repair the database and get it back online Setting read_only in my cnf on the slave will avoid this | scenario |
Some information about database access in MediaWiki By Tim January Database layout For information about the MediaWiki database such as a description of the tables and their please | see |
Some information about database access in MediaWiki By Tim | Starling |
Some information about database access in MediaWiki By Tim January Database layout For information about the MediaWiki database such as a description of the tables and their please something like this usually | suffices |
$dbw begin | ( | __METHOD__ | ) |
Referenced by CleanupEmptyCategories::__construct(), and PopulateCategory::__construct().
$dbw commit | ( | __METHOD__ | ) |
Referenced by RemoveInvalidEmails::execute().
foreach | ( | $res as | ) |
Definition at line 22 of file database.txt.
$dbw insert | ( | ) |
We use the convention $dbr for read and $dbw for write to help you keep track of whether the database object is a the world will explode Or to be a subsequent write query which succeeded on the master may fail when replicated to the slave due to a unique key collision Replication on the slave will stop and it may take hours to repair the database and get it back online Setting read_only in my cnf on the slave will avoid this but given the dire we prefer to have as many checks as possible We provide a but the wrapper functions like please read the documentation for except in special pages derived from QueryPage It s a common pitfall for new developers to submit code containing SQL queries which examine huge numbers of rows Remember that COUNT* is | ( | N | ) | -> getServerCount() > 1 tocheck to see if replication is in use.===Lag===Lag primarily occurs when large write queries are sent to the master.Writes on the master are executed in parallel, but they are executed inserial when they are replicated to the slaves. The master writes thequery to the binlog when the transaction is committed. The slaves pollthe binlog and start executing the query as soon as it appears. They canservice reads while they are performing a write query, but will not readanything more from the binlog and thus will perform no more writes. Thismeans that if the write query runs for a long time, the slaves will lagbehind the master for the time it takes for the write query to complete.Lag can be exacerbated by high read load. MediaWiki 's load balancer willstop sending reads to a slave when it is lagged by more than 30 seconds.If the load ratios are set incorrectly, or if there is too much loadgenerally, this may lead to a slave permanently hovering around 30seconds lag.If all slaves are lagged by more than 30 seconds, MediaWiki will stopwriting to the database. All edits and other write operations will berefused, with an error returned to the user. This gives the slaves achance to catch up. Before we had this mechanism, the slaves wouldregularly lag by several minutes, making review of recent editsdifficult.In addition to this, MediaWiki attempts to ensure that the user seesevents occurring on the wiki in chronological order. A few seconds of lagcan be tolerated, as long as the user sees a consistent picture fromsubsequent requests. This is done by saving the master binlog positionin the session, and then at the start of each request, waiting for theslave to catch up to that position before doing any reads from it. Ifthis wait times out, reads are allowed anyway, but the request isconsidered to be in "lagged slave mode". Lagged slave mode can bechecked by calling wfGetLB() ->getLaggedSlaveMode(). The onlypractical consequence at present is a warning displayed in the pagefooter.===Lag avoidance===To avoid excessive lag, queries which write large numbers of rows shouldbe split up, generally to write one row at a time. Multi-row INSERT ...SELECT queries are the worst offenders should be avoided altogether.Instead do the select first and then the insert.===Working with lag===Despite our best efforts, it 's not practical to guarantee a low-lagenvironment. Lag will usually be less than one second, but mayoccasionally be up to 30 seconds. For scalability, it 's very importantto keep load on the master low, so simply sending all your queries tothe master is not the answer. So when you have a genuine need forup-to-date data, the following approach is advised:1) Do a quick query to the master for a sequence number or timestamp 2) Run the full query on the slave and check if it matches the data you gotfrom the master 3) If it doesn 't, run the full query on the masterTo avoid swamping the master every time the slaves lag, use of thisapproach should be kept to a minimum. In most cases you should just readfrom the slave and let the user deal with the delay.------------------------------------------------------------------------ Lock contention------------------------------------------------------------------------Due to the high write rate on Wikipedia(and some other wikis), MediaWiki developers need to be very careful to structure their writesto avoid long-lasting locks. By default, MediaWiki opens a transactionat the first query, and commits it before the output is sent. Locks willbe held from the time when the query is done until the commit. So youcan reduce lock time by doing as much processing as possible before youdo your write queries.Often this approach is not good enough, and it becomes necessary toenclose small groups of queries in their own transaction. Use thefollowing syntax:$dbw=wfGetDB(DB_MASTER |
Referenced by DumpBackup::__construct(), CleanupEmptyCategories::__construct(), PopulateCategory::__construct(), PopulateInterwiki::__construct(), PopulateIpChanges::__construct(), UpdateCollation::__construct(), BackupReader::__construct(), CleanupInvalidDbKeys::__construct(), TextPassDumper::__construct(), TextContent::copy(), RecompressTracked::doAllPages(), UpdateLogging::execute(), ModernTemplate::execute(), RedisLockManager::freeLocksOnServer(), RedisLockManager::getLocksOnServer(), PNGMetadataExtractor::getMetadata(), MediaWikiTitleCodec::getTitleInvalidRegex(), MWExceptionHandler::handleFatalError(), CheckLanguageCLI::help(), PoolCounterRedis::initAndPopPoolSlotList(), ParserOutput::isLinkInternal(), LinksUpdateTest::makeTitleAndParserOutput(), SpecialBlock::maybeAlterFormDefaults(), mccShowUsage(), Linker::normalizeSubpageLink(), DatabaseOracle::open(), HttpTest::provideURI(), JobQueueRedis::pushBlobs(), PoolCounterRedis::registerAcquisitionTime(), PoolCounterRedis::release(), UserOptions::showUsageAndExit(), SideBarTest::testExternalUrlsRequireADescription(), WikitextStructureTest::testTexts(), and UserOptions::warn().
We use the convention $dbr for read and $dbw for write to help you keep track of whether the database object is a the world will explode Or to be a subsequent write query which succeeded on the master may fail when replicated to the slave due to a unique key collision Replication on the slave will stop and it may take hours to repair the database and get it back online Setting read_only in my cnf on the slave will avoid this but given the dire we prefer to have as many checks as possible We provide a query | ( | ) |
Use of locking reads | ( | e.g. the FOR UPDATE | clause | ) |
Referenced by BackupReader::__construct().
We use the convention $dbr for read and $dbw for write to help you keep track of whether the database object is a the world will explode Or to be a subsequent write query which succeeded on the master may fail when replicated to the slave due to a unique key collision Replication on the slave will stop and it may take hours to repair the database and get it back online Setting read_only in my cnf on the slave will avoid this but given the dire we prefer to have as many checks as possible We provide a but the wrapper functions like select | ( | ) |
Referenced by XmlSelectTest::setUp(), showUsage(), XmlSelectTest::tearDown(), XmlSelectTest::testAddOption(), XmlSelectTest::testAddOptionWithDefault(), XmlSelectTest::testAddOptionWithFalse(), XmlSelectTest::testAddOptionWithValueZero(), XmlSelectTest::testConstructParameters(), XmlSelectTest::testConstructWithoutParameters(), XmlSelectTest::testGetAttributes(), XmlSelectTest::testSetDefault(), and XmlSelectTest::testSetDefaultAfterAddingOptions().
We use the convention $dbr for read and $dbw for write to help you keep track of whether the database object is a slave | ( | read- | only | ) |
We use the convention $dbr for read and $dbw for write to help you keep track of whether the database object is a the world will explode Or to be a subsequent write query which succeeded on the master may fail when replicated to the slave due to a unique key collision Replication on the slave will stop and it may take hours to repair the database and get it back online Setting read_only in my cnf on the slave will avoid this but given the dire we prefer to have as many checks as possible We provide a but the wrapper functions like please read the documentation for tableName | ( | ) |
Referenced by SqlBagOStuff::__construct(), DatabaseOracle::delete(), DatabaseOracle::dropTable(), DatabaseOracle::getSequenceData(), SqlBagOStuff::getTableNameByShard(), DatabaseOracle::indexExists(), DatabaseOracle::insertOneRow(), DatabaseOracle::nativeInsertSelect(), Wikimedia\Rdbms\DatabasePostgres::realTableName(), Wikimedia\Rdbms\DatabaseMssql::realTableName(), DatabaseTestHelper::tableExists(), DatabaseOracle::tableExists(), Wikimedia\Rdbms\DatabaseSqlite::tableName(), Wikimedia\Rdbms\DatabasePostgres::tableName(), DatabaseOracle::tableNameInternal(), and DatabaseOracle::update().
see documentation in includes Linker php for Linker::makeImageLink or false for current & $res = $dbr->select( ) |
Definition at line 21 of file database.txt.
Referenced by RedisConnRef::__call(), UploadChunkVerificationException::__construct(), OutputPage::addCategoryLinks(), OutputPage::addCategoryLinksToLBAndGetResult(), LinksUpdateTest::addDBDataOnce(), Benchmarker::addResult(), LinkBatch::addResultToCache(), DatabaseSqliteTest::assertResultIs(), MediaWikiTestCase::assertSelect(), MediaWiki\Auth\AuthManagerAuthPlugin::authenticate(), LinksDeletionUpdate::batchDeleteByPK(), ExternalStoreDB::batchFetchBlobs(), ExternalStoreDB::batchFetchFromURLs(), MediaWiki\Auth\AuthManager::beginAccountLink(), Wikimedia\Rdbms\Database::bufferResults(), MssqlInstaller::canCreateAccounts(), MysqlInstaller::canCreateAccounts(), MssqlInstaller::catalogExists(), PostgresUpdater::changeField(), PostgresUpdater::changeFieldPurgeTable(), CheckStorage::check(), XmlTypeCheck::checkDTDIsSafe(), CheckStorage::checkExternalConcatBlobs(), FindOrphanedFiles::checkFiles(), Wikimedia\Rdbms\DatabaseSqlite::checkForEnabledSearch(), NamespaceConflictChecker::checkLinkTable(), User::checkPassword(), PasswordPolicyChecks::checkPopularPasswordBlacklist(), CleanupInvalidDbKeys::cleanupTable(), CgzCopyTransaction::commit(), CompressOld::compressOldPages(), Wikimedia\Rdbms\DatabasePostgres::constraintExists(), MediaWiki\Auth\AuthManager::continueAccountCreation(), MediaWiki\Auth\AuthManager::continueAccountLink(), MediaWiki\Auth\AuthManager::continueAuthentication(), ConvertUserOptions::convertOptionBatch(), WatchedItemStore::countVisitingWatchersMultiple(), WatchedItemStore::countWatchersMultiple(), Wikimedia\Rdbms\DatabasePostgres::currentSequenceValue(), MssqlInstaller::databaseExists(), Wikimedia\Rdbms\DatabaseMssql::dataSeek(), DatabaseOracle::dataSeek(), Wikimedia\Rdbms\DatabasePostgres::dataSeek(), Wikimedia\Rdbms\DatabaseMysqlBase::dataSeek(), Wikimedia\Rdbms\DatabaseSqlite::dataSeek(), Block::defaultRetroactiveAutoblock(), PrefixSearch::defaultSearchBackend(), MemcachedClient::delete(), PostgresUpdater::describeIndex(), PostgresUpdater::describeTable(), FileBackendStore::directoryExists(), WikiExporter::do_list_authors(), JobQueueRedis::doAck(), RecompressTracked::doAllOrphans(), RecompressTracked::doAllPages(), Wikimedia\Rdbms\Database::doAtomicSection(), ActiveUsersPager::doBatchLookups(), JobQueueDB::doBatchPushInternal(), CategoryViewer::doCategoryQuery(), LocalFileDeleteBatch::doDBInserts(), PopulatePPSortKey::doDBUpdates(), PopulateBacklinkNamespace::doDBUpdates(), PopulateFilearchiveSha1::doDBUpdates(), PopulateParentId::doDBUpdates(), FixExtLinksProtocolRelative::doDBUpdates(), PopulateLogUsertext::doDBUpdates(), PopulateLogSearch::doDBUpdates(), PopulateImageSha1::doDBUpdates(), DeleteOldRevisions::doDelete(), SpecialNuke::doDelete(), WikiPage::doDeleteArticleReal(), MysqlUpdater::doExtendCommentLengths(), QueryPage::doFeed(), DBFileJournal::doGetChangeEntries(), PostgreSqlLockManager::doGetLocksOnServer(), JobQueueRedis::doGetSiblingQueueSizes(), JobQueueDB::doGetSiblingQueueSizes(), JobQueueDB::doGetSiblingQueuesWithJobs(), MysqlUpdater::doLangLinksLengthUpdate(), PopulateRevisionLength::doLenUpdates(), SpecialRecentChangesLinked::doMainQuery(), RecompressTracked::doOrphanList(), RecompressTracked::doPage(), UserCache::doQuery(), GenderCache::doQuery(), LinkBatch::doQuery(), Wikimedia\Rdbms\DatabasePostgres::doQuery(), DatabaseTestHelper::doQuery(), Wikimedia\Rdbms\DatabaseSqlite::doQuery(), ReassignEdits::doReassignEdits(), RefreshLinks::doRefreshLinks(), PopulateRevisionSha1::doSha1LegacyUpdates(), PopulateRevisionSha1::doSha1Updates(), FileBackendStore::doStreamFile(), MysqlUpdater::doTemplatelinksUpdate(), UpdateSearchIndex::doUpdateSearchIndex(), RecountCategories::doWork(), Wikimedia\Rdbms\DatabaseSqlite::duplicateTableStructure(), Wikimedia\Rdbms\DatabasePostgres::estimateRowCount(), Wikimedia\Rdbms\DatabaseMssql::estimateRowCount(), Wikimedia\Rdbms\DatabaseMysqlBase::estimateRowCount(), Wikimedia\Rdbms\Database::estimateRowCount(), CleanupArchiveUserText::execute(), StorageTypeStats::execute(), ApiProtect::execute(), ApiSpamBlacklist::execute(), ApiTokens::execute(), ApiCheckToken::execute(), FindMissingFiles::execute(), ApiWatch::execute(), ApiQueryMyStashedFiles::execute(), ApiQueryTokens::execute(), ApiQueryTitleBlacklist::execute(), ApiUnblock::execute(), ApiQueryBlocks::execute(), ApiQueryExternalLinks::execute(), CheckImages::execute(), ClearInterwikiCache::execute(), ApiQueryLangLinks::execute(), ApiQueryCategoryInfo::execute(), ApiQueryDeletedrevs::execute(), ApiQueryIWLinks::execute(), ApiParamInfo::execute(), FixUserRegistration::execute(), ApiQueryFilearchive::execute(), CleanupBlocks::execute(), MigrateUserGroup::execute(), ApiBlock::execute(), DeleteArchivedFiles::execute(), DeleteDefaultMessages::execute(), NukePage::execute(), RemoveUnusedAccounts::execute(), UpdateRestrictions::execute(), CheckUsernames::execute(), PurgeModuleDeps::execute(), MigrateFileRepoLayout::execute(), RefreshFileHeaders::execute(), ApiQueryContributions::execute(), CleanupSpam::execute(), UploadStashCleanup::execute(), ConvertUserOptions::execute(), DeleteOrphanedRevisions::execute(), FixDoubleRedirects::execute(), RenameDbPrefix::execute(), FixT22757::execute(), WrapOldPasswords::execute(), CleanupRemovedModules::execute(), FixTimestamps::execute(), ApiQueryLogEvents::execute(), OrphanStats::execute(), ApiQueryAllUsers::execute(), ApiQueryContributors::execute(), BatchedQueryRunner::execute(), ApiLinkAccount::execute(), ApiAMCreateAccount::execute(), UpdateDoubleWidthSearch::execute(), PurgeChangedPages::execute(), ApiClientLogin::execute(), NukeNS::execute(), RebuildFileCache::execute(), ConvertLinks::execute(), UpdateCollation::execute(), ApiLogin::execute(), RefreshImageMetadata::execute(), ApiQueryUsers::execute(), GetConfiguration::execute(), QueryPage::execute(), LinkBatch::executeInto(), QueryPage::executeLBFromResultWrapper(), FileBackendStore::executeOpHandlesInternal(), Exif::exifGPStoNumber(), IndexPager::extractResultInfo(), Wikimedia\Rdbms\MssqlResultWrapper::fetchObject(), Wikimedia\Rdbms\DatabaseMssql::fetchObject(), DatabaseOracle::fetchObject(), Wikimedia\Rdbms\DatabaseMysqlBase::fetchObject(), Wikimedia\Rdbms\DatabasePostgres::fetchObject(), Wikimedia\Rdbms\DatabaseSqlite::fetchObject(), Wikimedia\Rdbms\MssqlResultWrapper::fetchRow(), Wikimedia\Rdbms\DatabaseMssql::fetchRow(), DatabaseOracle::fetchRow(), Wikimedia\Rdbms\DatabasePostgres::fetchRow(), Wikimedia\Rdbms\DatabaseMysqlBase::fetchRow(), Wikimedia\Rdbms\DatabaseSqlite::fetchRow(), ResourceLoaderWikiModule::fetchTitleInfo(), Wikimedia\Rdbms\DatabaseMssql::fieldExists(), Wikimedia\Rdbms\DatabaseMysqlBase::fieldInfo(), Wikimedia\Rdbms\DatabaseSqlite::fieldInfo(), Wikimedia\Rdbms\DatabaseMssql::fieldInfo(), DatabaseOracle::fieldInfoMulti(), Wikimedia\Rdbms\DatabaseMssql::fieldName(), Wikimedia\Rdbms\DatabasePostgres::fieldName(), Wikimedia\Rdbms\DatabaseMysqlBase::fieldName(), Wikimedia\Rdbms\DatabaseSqlite::fieldName(), Wikimedia\Rdbms\DatabaseMysqlBase::fieldType(), Wikimedia\Rdbms\DatabasePostgres::fieldType(), HTMLMultiSelectField::filterDataForSubmit(), HTMLCheckMatrix::filterDataForSubmit(), LocalRepo::findBySha1(), LocalRepo::findBySha1s(), LocalRepo::findFiles(), LocalRepo::findFilesByPrefix(), TrackBlobs::findOrphanBlobs(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider::finishAccountCreation(), RecompressTracked::finishIncompleteMoves(), DoubleRedirectJob::fixRedirects(), DatabaseTestHelper::forceNextResult(), ApiAuthManagerHelper::formatAuthenticationResponse(), ApiParse::formatCategoryLinks(), ApiParamInfo::formatHelpMessages(), ApiAuthManagerHelper::formatMessage(), DoubleRedirectsPage::formatResult(), GetConfiguration::formatVarDump(), RedisLockManager::freeLocksOnServer(), Wikimedia\Rdbms\DatabaseMssql::freeResult(), Wikimedia\Rdbms\DatabaseMysqlBase::freeResult(), DatabaseOracle::freeResult(), Wikimedia\Rdbms\DatabasePostgres::freeResult(), Wikimedia\Rdbms\DatabaseSqlite::freeResult(), Wikimedia\Rdbms\PostgresField::fromText(), BatchRowUpdateTest::genSelectResult(), JobQueue::getAbandonedCount(), JobQueue::getAcquiredCount(), MediaWiki\Interwiki\InterwikiLookupAdapter::getAllPrefixes(), MediaWiki\Interwiki\ClassicInterwikiLookup::getAllPrefixesDB(), JobQueueAggregator::getAllReadyWikiQueues(), Title::getAuthorsBetween(), ContentHandler::getAutoDeleteReason(), FileBackendDBRepoWrapper::getBackendPaths(), Title::getBrokenLinksFrom(), Wikimedia\Rdbms\Database::getCacheSetOptions(), BacklinkCache::getCascadeProtectedLinks(), Title::getCascadeProtectionSources(), WikiPage::getCategories(), CategoriesRdfTest::getCategoryLinksIterator(), DatabaseSqliteTest::getColumns(), SiteConfiguration::getConfig(), WikiPage::getContributors(), Wikimedia\Rdbms\DatabasePostgres::getCurrentSchema(), AllMessagesTablePager::getCustomisedStatuses(), JobQueue::getDelayedCount(), ForeignDBFile::getDescriptionText(), File::getDescriptionText(), ApiQueryInfo::getDisplayTitle(), MysqlInstaller::getEngines(), LinksUpdate::getExistingCategories(), LinksUpdate::getExistingExternals(), LinksUpdate::getExistingImages(), LinksUpdate::getExistingInterlangs(), LinksUpdate::getExistingInterwikis(), LinksUpdate::getExistingLinks(), LinksUpdate::getExistingProperties(), LinksUpdate::getExistingTemplates(), WikiFilePage::getForeignCategories(), User::getFormerGroups(), SpecialBotPasswords::getFormFields(), LocalFileDeleteBatch::getHashes(), Wikimedia\Rdbms\DatabaseMysqlBase::getHeartbeatData(), WikiPage::getHiddenCategories(), LocalFile::getHistory(), DatabaseSqliteTest::getIndexes(), Wikimedia\Rdbms\DatabaseMysqlBase::getLagFromSlaveStatus(), Title::getLinksFrom(), SimpleCaptcha::getLinksFromTracker(), Title::getLinksTo(), RedisLockManager::getLocksOnServer(), Wikimedia\Rdbms\DatabaseMysqlBase::getMasterPos(), Wikimedia\Rdbms\DatabaseMysqlBase::getMasterServerInfo(), UserGroupMembership::getMembershipsForUser(), SpecialRandomInCategory::getMinAndMaxForCat(), SqlBagOStuff::getMulti(), BagOStuff::getMulti(), Wikimedia\Rdbms\DatabaseMysqlBase::getMysqlStatus(), WatchedItemStore::getNotificationTimestampsBatch(), SpecialExport::getPagesFromCategory(), SpecialExport::getPagesFromNamespace(), Title::getParentCategories(), Revision::getParentLengths(), ApiQueryInfo::getProtectionInfo(), Title::getRedirectsHere(), ApiPageSet::getRedirectTargets(), Wikimedia\Rdbms\DatabaseMysqlBase::getReplicaPos(), FixT22757::getRevTextMap(), MWGrants::getRightsByGrant(), Linker::getRollbackEditCount(), Wikimedia\Rdbms\DatabasePostgres::getSchemas(), JpegHandler::getScriptParams(), Wikimedia\Rdbms\DatabasePostgres::getSearchPath(), JobQueue::getSize(), WANCacheReapUpdate::getTitleChangeEvents(), Title::getTitleProtectionInternal(), BlockListPager::getTotalAutoblocks(), ApiQueryInfo::getTSIDs(), PasswordReset::getUsersByEmail(), WatchedItemQueryService::getWatchedItemsForUser(), WatchedItemStore::getWatchedItemsForUser(), WatchedItemQueryService::getWatchedItemsWithRecentChangeInfo(), Wikimedia\Rdbms\LoadMonitorMySQL::getWeightScale(), Wikimedia\Rdbms\DatabasePostgres::hasConstraint(), Wikimedia\Rdbms\Database::ignoreErrors(), ImagePage::imageLinks(), LoginForm::incLoginThrottle(), Wikimedia\Rdbms\DatabasePostgres::indexAttributes(), DatabaseOracle::indexExists(), Wikimedia\Rdbms\DatabasePostgres::indexInfo(), Wikimedia\Rdbms\DatabaseSqlite::indexInfo(), Wikimedia\Rdbms\DatabaseMssql::indexInfo(), Wikimedia\Rdbms\DatabaseMysqlBase::indexInfo(), Wikimedia\Rdbms\DatabasePostgres::indexUnique(), ApiPageSet::initFromPageIds(), ApiPageSet::initFromQueryResult(), ApiPageSet::initFromRevIDs(), ApiPageSet::initFromTitles(), Wikimedia\Rdbms\DatabaseMssql::insert(), Wikimedia\Rdbms\DatabasePostgres::insert(), DatabaseOracle::insertId(), Wikimedia\Rdbms\DatabasePostgres::insertId(), Wikimedia\Rdbms\Database::insertSelect(), SqliteMaintenance::integrityCheck(), JobQueue::isEmpty(), PostgresInstaller::isRoleMember(), BitmapMetadataHandler::Jpeg(), UploadStash::listFiles(), Wikimedia\Rdbms\DatabaseMysqlBase::listViews(), MigrateComments::loadCommentIDs(), MessageCache::loadFromDB(), User::loadOptions(), DBSiteStore::loadSites(), Wikimedia\Rdbms\DatabasePostgres::lock(), MssqlInstaller::loginExists(), LocalIdLookup::lookupCentralIds(), LocalIdLookup::lookupUserNames(), RedisConnRef::luaEval(), Linker::makeImageLink(), BitmapHandler::makeParamString(), JpegHandler::makeParamString(), BenchWikimediaBaseConvert::makeRandomNumber(), Wikimedia\Rdbms\DatabaseMysqlBase::masterPosWait(), MagicWordArray::matchAndRemove(), ExternalStoreDB::mergeBatchResult(), MigrateComments::migrate(), MigrateComments::migrateToTemp(), MovePage::move(), moveToExternal(), Wikimedia\Rdbms\DatabaseMysql::mysqlDataSeek(), Wikimedia\Rdbms\DatabaseMysqli::mysqlDataSeek(), Wikimedia\Rdbms\DatabaseMysql::mysqlFetchArray(), Wikimedia\Rdbms\DatabaseMysqli::mysqlFetchArray(), Wikimedia\Rdbms\DatabaseMysql::mysqlFetchField(), Wikimedia\Rdbms\DatabaseMysqli::mysqlFetchField(), Wikimedia\Rdbms\DatabaseMysql::mysqlFetchObject(), Wikimedia\Rdbms\DatabaseMysqli::mysqlFetchObject(), Wikimedia\Rdbms\DatabaseMysql::mysqlFieldName(), Wikimedia\Rdbms\DatabaseMysqli::mysqlFieldName(), Wikimedia\Rdbms\DatabaseMysql::mysqlFieldType(), Wikimedia\Rdbms\DatabaseMysqli::mysqlFieldType(), Wikimedia\Rdbms\DatabaseMysql::mysqlFreeResult(), Wikimedia\Rdbms\DatabaseMysqli::mysqlFreeResult(), Wikimedia\Rdbms\DatabaseMysql::mysqlNumFields(), Wikimedia\Rdbms\DatabaseMysqli::mysqlNumFields(), Wikimedia\Rdbms\DatabaseMysql::mysqlNumRows(), Wikimedia\Rdbms\DatabaseMysqli::mysqlNumRows(), Wikimedia\Rdbms\DatabasePostgres::nativeInsertSelect(), Block::newFromID(), UserArray::newFromIDs(), Title::newFromIDs(), UserArray::newFromNames(), UserArray::newFromResult(), TitleArray::newFromResult(), TitleArray::newFromResult_internal(), UserArray::newFromResult_internal(), Block::newLoad(), BatchRowIterator::next(), FileOp::normalizeIfValidStoragePath(), LockManager::normalizePathsByType(), EditPage::noSuchSectionPage(), Wikimedia\Rdbms\DatabaseMssql::numFields(), DatabaseOracle::numFields(), Wikimedia\Rdbms\DatabasePostgres::numFields(), Wikimedia\Rdbms\DatabaseMysqlBase::numFields(), Wikimedia\Rdbms\DatabaseSqlite::numFields(), Wikimedia\Rdbms\DatabaseMssql::numRows(), DatabaseOracle::numRows(), Wikimedia\Rdbms\DatabasePostgres::numRows(), Wikimedia\Rdbms\DatabaseMysqlBase::numRows(), Wikimedia\Rdbms\DatabaseSqlite::numRows(), InterwikiHooks::onInterwikiLoadPrefix(), SpecialUnlockdb::onSubmit(), SkinTemplate::outputPage(), ImageQueryPage::outputResults(), MediaStatisticsPage::outputResults(), SpecialGadgetUsage::outputResults(), QueryPage::outputResults(), PurgeChangedPages::pageableSortedRows(), MessageCache::parse(), XmlTypeCheck::parseDTD(), JpegHandler::parseParamString(), BacklinkCache::partition(), BacklinkCache::partitionResult(), Wikimedia\Rdbms\DatabaseMssql::populateColumnCaches(), RebuildTextIndex::populateSearchIndex(), WANObjectCache::prefixCacheKeys(), PageQueryPage::preprocessResults(), WantedQueryPage::preprocessResults(), WantedCategoriesPage::preprocessResults(), UnwatchedpagesPage::preprocessResults(), MostlinkedCategoriesPage::preprocessResults(), AncientPagesPage::preprocessResults(), MostcategoriesPage::preprocessResults(), MostinterwikisPage::preprocessResults(), ListDuplicatedFilesPage::preprocessResults(), UnusedCategoriesPage::preprocessResults(), ListredirectsPage::preprocessResults(), MostlinkedPage::preprocessResults(), MostlinkedTemplatesPage::preprocessResults(), ShortPagesPage::preprocessResults(), BrokenRedirectsPage::preprocessResults(), DoubleRedirectsPage::preprocessResults(), LinkSearchPage::preprocessResults(), MIMEsearchPage::preprocessResults(), MediaStatisticsPage::preprocessResults(), MysqlInstaller::preUpgrade(), Block::prevents(), JobQueueAggregator::purge(), UserGroupMembership::purgeExpired(), RecentChangesUpdateJob::purgeExpiredRows(), PurgeChangedFiles::purgeFromArchiveTable(), PurgeChangedFiles::purgeFromLogType(), PurgeList::purgeNamespace(), Maintenance::purgeRedundantText(), Wikimedia\Rdbms\Database::query(), SpecialPagesWithProp::queryExistingProps(), BacklinkCache::queryLinks(), ResourceLoaderImage::rasterize(), ShortPagesPage::reallyDoQuery(), QueryPage::reallyDoQuery(), RebuildRecentchanges::rebuildRecentChangesTablePass1(), RebuildRecentchanges::rebuildRecentChangesTablePass2(), RebuildRecentchanges::rebuildRecentChangesTablePass3(), RebuildRecentchanges::rebuildRecentChangesTablePass4(), RebuildRecentchanges::rebuildRecentChangesTablePass5(), QueryPage::recache(), LocalFile::recordUpload2(), JobQueueDB::recycleAndDeleteStaleJobs(), RefreshLinks::refreshCategory(), Wikimedia\Rdbms\DatabasePostgres::relationExists(), RenameuserSQL::rename(), MagicWord::replace(), LinkHolderArray::replaceInternal(), DbTestPreviewer::report(), ApiPageSet::resolvePendingRedirects(), resolveStubs(), ApiQueryDeletedRevisions::run(), ApiQueryAllRevisions::run(), ApiQueryAllDeletedRevisions::run(), CategoryMembershipChangeJob::run(), ApiQueryProtectedTitles::run(), ApiQueryLangBacklinks::run(), ApiQueryImages::run(), ApiQueryIWBacklinks::run(), ApiQueryExtLinksUsage::run(), ApiQueryCategories::run(), ApiQueryAllCategories::run(), ApiQueryQueryPage::run(), ApiQueryCategoryMembers::run(), ApiQueryAllPages::run(), ApiQueryLinks::run(), ApiQueryAllImages::run(), ApiQueryRevisions::run(), ApiQueryBacklinksprop::run(), ApiQueryAllLinks::run(), ApiQueryRecentChanges::run(), MemcachedClient::run_command(), ApiQueryBacklinks::runFirstQuery(), TitlePermissionTest::runGroupPermissions(), ApiQueryRandom::runQuery(), ApiQueryBacklinks::runSecondQuery(), TableCleanup::runTable(), User::saveOptions(), CategoryFinder::scanNextLayer(), MssqlInstaller::schemaExists(), EraseArchivedFile::scrubAllVersions(), UserNamePrefixSearch::search(), ApiOpenSearch::search(), SearchPostgres::searchQuery(), Wikimedia\Rdbms\MssqlResultWrapper::seek(), ApiQueryBase::select(), Wikimedia\Rdbms\Database::selectField(), Wikimedia\Rdbms\Database::selectFieldValues(), RandomPage::selectRandomPageFromDB(), SpecialRandomInCategory::selectRandomPageFromDB(), Wikimedia\Rdbms\Database::selectRow(), Wikimedia\Rdbms\Database::selectRowCount(), Wikimedia\Rdbms\DatabaseMysqlBase::serverIsReadOnly(), Wikimedia\Rdbms\DatabasePostgres::serverIsReadOnly(), BagOStuff::setMulti(), SpecialAllPages::showChunk(), SpecialInterwiki::showList(), SpecialPrefixindex::showPrefixChunk(), DatabaseOracle::sourceStream(), Wikimedia\Rdbms\Database::sourceStream(), MwSql::sqlDoQuery(), MwSql::sqlPrintResult(), Installer::subscribeToMediaWikiAnnounce(), MagicWord::substituteCallback(), DatabaseOracle::tableExists(), Wikimedia\Rdbms\DatabaseMssql::tableExists(), Wikimedia\Rdbms\Database::tableExists(), ChangeTags::tagUsageStatistics(), MediaWiki\Auth\AbstractPreAuthenticationProviderTest::testAbstractPreAuthenticationProvider(), MediaWiki\Auth\AbstractPrimaryAuthenticationProviderTest::testAbstractPrimaryAuthenticationProvider(), MediaWiki\Auth\AbstractSecondaryAuthenticationProviderTest::testAbstractSecondaryAuthenticationProvider(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest::testAccountCreationEmail(), MediaWiki\Auth\ConfirmLinkSecondaryAuthenticationProviderTest::testBeginLinkAttempt(), JpegMetadataExtractorTest::testBinaryCommentStripped(), DatabaseSqliteTest::testCaseInsensitiveLike(), RevisionStorageTest::testConstructFromRow(), MediaWiki\Auth\AuthenticationResponseTest::testConstructors(), MediaWiki\Auth\ConfirmLinkSecondaryAuthenticationProviderTest::testContinueLinkAttempt(), ExifBitmapTest::testConvertMetadataLatest(), ExifBitmapTest::testConvertMetadataSoftware(), ExifBitmapTest::testConvertMetadataSoftwareNormal(), ExifBitmapTest::testConvertMetadataToOld(), BlockTest::testCrappyCrossWikiBlocks(), MediaWiki\Auth\AuthManagerTest::testCreateFromLogin(), DatabaseSqliteTest::testDeleteJoin(), WikiPageTest::testDoDeleteArticle(), WikiPageTest::testDoDeleteUpdates(), WikiPageTest::testDoEditContent(), MediaWiki\Logger\Monolog\AvroFormatterTest::testDoesSomethingWhenSchemaAvailable(), LanguageTrTest::testDottedAndDotlessI(), JpegMetadataExtractorTest::testExifByteOrder(), FileBackendTest::testExtensionFromPath(), RevisionStorageTest::testFetchRevision(), CommentStoreTest::testGetCommentErrors(), SvgTest::testGetIndependentMetaArray(), JpegTest::testGetIndependentMetaArray(), WatchedItemQueryServiceUnitTest::testGetWatchedItemsWithRecentChangeInfo_extension(), ExifBitmapTest::testGoodMetadata(), RevisionStorageTest::testInsertOn(), JpegTest::testInvalidFile(), PNGHandlerTest::testInvalidFile(), GIFHandlerTest::testInvalidFile(), TiffTest::testInvalidFile(), JpegMetadataExtractorTest::testIPTCHashComparisionBadHash(), JpegMetadataExtractorTest::testIPTCHashComparisionGoodHash(), JpegMetadataExtractorTest::testIPTCHashComparisionNoHash(), IPTCTest::testIPTCParseForcedUTFButInvalid(), IPTCTest::testIPTCParseMulti(), IPTCTest::testIPTCParseNoCharset88591(), IPTCTest::testIPTCParseNoCharset88591b(), IPTCTest::testIPTCParseNoCharsetUTF8(), IPTCTest::testIPTCParseUTF8(), ExifBitmapTest::testIsBrokenFile(), ExifBitmapTest::testIsInvalid(), JpegMetadataExtractorTest::testIso88591Comment(), ExifBitmapTest::testIsOldBroken(), ExifBitmapTest::testIsOldGood(), JpegTest::testJpegMetadataExtraction(), MediaWiki\Session\SessionProviderTest::testMergeMetadata(), JpegMetadataExtractorTest::testMultipleComment(), RevisionStorageTest::testNewFromArchiveRow(), RevisionStorageTest::testNewFromRow(), FileBackendTest::testNormalizeStoragePath(), DatabaseSqliteTest::testNumFields(), ExifBitmapTest::testPagedTiffHandledGracefully(), FileBackendTest::testParentStoragePath(), ApiParseTest::testParseById(), ApiParseTest::testParseByName(), ApiParseTest::testParseByOldId(), ApiParseTest::testParseRevDel(), SearchEngineTest::testPhraseSearch(), SearchEngineTest::testPhraseSearchHighlight(), JpegMetadataExtractorTest::testPSIRExtraction(), TitlePermissionTest::testQuickPermissions(), IPTCTest::testRecognizeUtf8(), MediaWiki\Logger\Monolog\AvroFormatterTest::testSchemaNotAvailableReturnValue(), FileBackendTest::testSplitStoragePath(), LanguageTest::testSprintfDateNoZone(), DatabaseIntegrationTest::testStoredFunctions(), BitmapMetadataHandlerTest::testTiffByteOrder(), TiffTest::testTiffMetadataExtraction(), MediaWiki\Auth\ResetPasswordSecondaryAuthenticationProviderTest::testTryReset(), PageArchiveTest::testUndeleteRevisions(), DatabaseIntegrationTest::testUnknownTableCorruptsResults(), JpegMetadataExtractorTest::testUtf8Comment(), SearchEngineTest::testWildcardSearch(), JpegMetadataExtractorTest::testXMPExtraction(), JpegMetadataExtractorTest::testXMPExtractionAltAppId(), Wikimedia\Rdbms\DatabasePostgres::textFieldSize(), Wikimedia\Rdbms\DatabaseMssql::textFieldSize(), Wikimedia\Rdbms\Database::textFieldSize(), ParameterizedPassword::toString(), MemcachedClient::touch(), TrackBlobs::trackOrphanText(), TrackBlobs::trackRevisions(), Wikimedia\Rdbms\DatabasePostgres::triggerExists(), HTMLForm::trySubmit(), Preferences::tryUISubmit(), RecentChangesUpdateJob::updateActiveUsers(), MysqlInstaller::userDefinitelyExists(), MssqlInstaller::userExists(), Revision::userWasLastToEdit(), XMPValidate::validateDate(), UploadFromChunks::verifyChunk(), PoolCounterRedis::waitForSlotOrNotif(), and ApiWatch::watchTitle().
We use the convention $dbr for read and $dbw for write to help you keep track of whether the database object is a the world will explode Or to be a subsequent write query which succeeded on the master may fail when replicated to the slave due to a unique key collision Replication on the slave will stop and it may take hours to repair the database and get it back online Setting read_only in my cnf on the slave will avoid this but given the dire consequences |
Definition at line 34 of file database.txt.
Definition at line 2 of file database.txt.
Referenced by ComposerInstalled::__construct(), ComposerLock::__construct(), ComposerJson::__construct(), MediaWiki\Tidy\BalanceElement::__construct(), WebInstallerOutput::addHTML(), WebInstallerOutput::addHTMLNoFlush(), WebInstallerOutput::flush(), ComposerLock::getInstalledDependencies(), ComposerInstalled::getInstalledDependencies(), and ComposerJson::getRequiredDependencies().
Some information about database access in MediaWiki By Tim January Database layout For information about the MediaWiki database layout |
Definition at line 2 of file database.txt.
Definition at line 26 of file database.txt.
Referenced by CleanupInvalidDbKeys::cleanupTable().
We use the convention $dbr for read and $dbw for write to help you keep track of whether the database object is a the world will explode Or to be precise |
Definition at line 34 of file database.txt.
Use of locking combine your existence checks into your write queries |
Definition at line 165 of file database.txt.
For a write query |
Definition at line 26 of file database.txt.
Referenced by CleanupInvalidDbKeys::__construct(), CategoryViewer::__construct(), RecompressTracked::doAllPages(), DatabaseOracle::insertId(), ParserOutput::isLinkInternal(), DatabaseTestHelper::query(), and DatabaseOracle::queryIgnore().
We use the convention $dbr for read and $dbw for write to help you keep track of whether the database object is a the world will explode Or to be a subsequent write query which succeeded on the master may fail when replicated to the slave due to a unique key collision Replication on the slave will stop and it may take hours to repair the database and get it back online Setting read_only in my cnf on the slave will avoid this scenario |
Definition at line 34 of file database.txt.
Some information about database access in MediaWiki By Tim January Database layout For information about the MediaWiki database such as a description of the tables and their please see |
Definition at line 2 of file database.txt.
Referenced by DumpBackup::__construct(), PHPVersionCheck::checkVendorExistence(), MWExceptionHandler::handleFatalError(), DifferenceEngine::showDiffPage(), WikitextStructureTest::testDefaultSort(), and WikitextStructureTest::testHeadings().
Definition at line 2 of file database.txt.