MediaWiki
1.23.2
|
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. If you must use them |
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 |
Use of locking define a new flag for $wgAntiLockFlags which allows them to be turned | off |
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 define a new flag for $wgAntiLockFlags which allows them to be turned because we ll almost certainly need to do so on the Wikimedia cluster Instead of locking combine your existence checks into your write | queries |
For a write | query |
Use of locking define a new flag for $wgAntiLockFlags which allows them to be turned because we ll almost certainly need to do so on the Wikimedia cluster 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 | 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__ | ) |
$dbw commit | ( | __METHOD__ | ) |
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 PopulateCategory::__construct(), BackupReader::__construct(), UpdateCollation::__construct(), Exif::__construct(), TextContent::copy(), RecompressTracked::doAllPages(), UsercreateTemplate::execute(), UpdateLogging::execute(), ModernTemplate::execute(), RedisLockManager::freeLocksOnServer(), RedisLockManager::getLocksOnServer(), PNGMetadataExtractor::getMetadata(), Title::getTitleInvalidRegex(), CheckLanguageCLI::help(), PoolCounterRedis::initAndPopPoolSlotList(), ApiFormatBase::initPrinter(), ParserOutput::isLinkInternal(), LinksUpdateTest::makeTitleAndParserOutput(), SpecialBlock::maybeAlterFormDefaults(), mccShowUsage(), Linker::normalizeSubpageLink(), DatabaseOracle::open(), Preprocessor_Hash::preprocessToObj(), LanguageTrTest::provideDottedAndDotlessI(), SanitizerTest::provideTagAttributesToDecode(), HttpTest::provideURI(), UtfNormal::quickIsNFCVerify(), JobQueueRedis::recyclePruneAndUndelayJobs(), PoolCounterRedis::registerAcquisitionTime(), PoolCounterRedis::release(), Sanitizer::setupAttributeWhitelist(), showHelp(), Article::showMissingArticle(), SpecialSearch::showResults(), showUsage(), UserOptions::showUsageAndExit(), SideBarTest::testExternalUrlsRequireADescription(), 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 | ) |
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 SiteSQLStore::loadSites(), 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(), ORMTable::__construct(), DatabaseOracle::delete(), DatabaseOracle::dropTable(), ORMTable::getName(), DatabaseOracle::getSequenceData(), SqlBagOStuff::getTableNameByShard(), DatabaseOracle::indexExists(), DatabaseOracle::insertOneRow(), DatabaseOracle::insertSelect(), DatabaseMssql::realTableName(), DatabaseOracle::tableExists(), DatabaseSqlite::tableName(), DatabaseOracle::tableNameInternal(), and DatabaseOracle::update().
$res = $dbr->select( ) |
Definition at line 21 of file database.txt.
Referenced by RedisConnRef::__call(), OutputPage::addCategoryLinks(), ApiParamInfo::addModulesInfo(), LinkBatch::addResultToCache(), DatabaseSqliteTest::assertResultIs(), MediaWikiTestCase::assertSelect(), ExternalStoreDB::batchFetchBlobs(), ExternalStoreDB::batchFetchFromURLs(), MssqlInstaller::canCreateAccounts(), MysqlInstaller::canCreateAccounts(), MssqlInstaller::catalogExists(), PostgresUpdater::changeField(), PostgresUpdater::changeFieldPurgeTable(), CheckStorage::check(), CheckStorage::checkExternalConcatBlobs(), DatabaseSqlite::checkForEnabledSearch(), CgzCopyTransaction::commit(), CompressOld::compressOldPages(), ConvertUserOptions::convertOptionBatch(), ORMTable::count(), Title::countRevisionsBetween(), DatabasePostgres::currentSequenceValue(), MssqlInstaller::databaseExists(), DatabaseMssql::dataSeek(), DatabaseMysqlBase::dataSeek(), DatabaseSqlite::dataSeek(), DatabaseOracle::dataSeek(), DatabasePostgres::dataSeek(), Block::defaultRetroactiveAutoblock(), PrefixSearch::defaultSearchBackend(), MWMemcached::delete(), JobQueue::delete(), PostgresUpdater::describeIndex(), PostgresUpdater::describeTable(), FixSlaveDesync::desyncFixPage(), FileBackendStore::directoryExists(), WikiExporter::do_list_authors(), JobQueueRedis::doAck(), RecompressTracked::doAllOrphans(), RecompressTracked::doAllPages(), ActiveUsersPager::doBatchLookups(), JobQueueDB::doBatchPushInternal(), WikiPage::doCascadeProtectionUpdates(), CategoryViewer::doCategoryQuery(), PopulateFilearchiveSha1::doDBUpdates(), FixExtLinksProtocolRelative::doDBUpdates(), PopulateParentId::doDBUpdates(), PopulateLogUsertext::doDBUpdates(), PopulateLogSearch::doDBUpdates(), PopulateImageSha1::doDBUpdates(), DeleteArchivedFilesImplementation::doDelete(), DeleteOldRevisions::doDelete(), WatchedItem::doDuplicateEntries(), 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(), DatabaseSqlite::doQuery(), SpecialActiveUsers::doQueryCacheUpdate(), ReassignEdits::doReassignEdits(), RefreshLinks::doRefreshLinks(), PopulateRevisionSha1::doSha1LegacyUpdates(), PopulateRevisionSha1::doSha1Updates(), MysqlUpdater::doTemplatelinksUpdate(), LinksDeletionUpdate::doUpdate(), UpdateSearchIndex::doUpdateSearchIndex(), DatabaseSqlite::duplicateTableStructure(), DatabaseMysqlBase::estimateRowCount(), DatabaseMssql::estimateRowCount(), DatabaseBase::estimateRowCount(), StorageTypeStats::execute(), ApiProtect::execute(), ApiTokens::execute(), ApiWatch::execute(), ApiSetNotificationTimestamp::execute(), ApiQueryLangLinks::execute(), CheckImages::execute(), ClearInterwikiCache::execute(), FixUserRegistration::execute(), ApiQueryExternalLinks::execute(), ApiQueryDeletedrevs::execute(), ApiUnblock::execute(), ApiQueryIWLinks::execute(), ApiQueryCategoryInfo::execute(), ApiQueryPageProps::execute(), DeleteDefaultMessages::execute(), MigrateUserGroup::execute(), ApiQueryFilearchive::execute(), ApiParamInfo::execute(), ApiBlock::execute(), CleanupSpam::execute(), ConvertUserOptions::execute(), DeleteOrphanedRevisions::execute(), NukePage::execute(), MwSql::execute(), RemoveUnusedAccounts::execute(), SpecialPagesWithProp::execute(), ApiQueryBlocks::execute(), CheckUsernames::execute(), DeleteImageCache::execute(), UpdateRestrictions::execute(), ApiQueryLogEvents::execute(), OrphanStats::execute(), ApiQueryContributions::execute(), UploadStashCleanup::execute(), FixDoubleRedirects::execute(), RefreshFileHeaders::execute(), RenameDbPrefix::execute(), FixBug20757::execute(), FixTimestamps::execute(), ApiQueryTags::execute(), UpdateDoubleWidthSearch::execute(), ApiQueryAllUsers::execute(), DeleteArchivedRevisions::execute(), ApiQueryContributors::execute(), PurgeChangedPages::execute(), RebuildFileCache::execute(), ConvertLinks::execute(), NukeNS::execute(), RefreshImageMetadata::execute(), UpdateCollation::execute(), ApiQueryUsers::execute(), ApiQueryRevisions::execute(), GetConfiguration::execute(), QueryPage::execute(), LocalFileDeleteBatch::execute(), LinkBatch::executeInto(), FileBackendStore::executeOpHandlesInternal(), Exif::exifGPStoNumber(), IndexPager::extractResultInfo(), QueryPage::fetchFromCache(), DatabaseMysqlBase::fetchObject(), DatabaseMssql::fetchObject(), DatabaseSqlite::fetchObject(), DatabaseOracle::fetchObject(), DatabasePostgres::fetchObject(), MssqlResultWrapper::fetchObject(), DatabaseMysqlBase::fetchRow(), DatabaseMssql::fetchRow(), DatabaseSqlite::fetchRow(), DatabaseOracle::fetchRow(), MssqlResultWrapper::fetchRow(), DatabaseMssql::fieldExists(), DatabaseMysqlBase::fieldInfo(), DatabaseSqlite::fieldInfo(), DatabaseMssql::fieldInfo(), DatabaseOracle::fieldInfoMulti(), DatabaseMssql::fieldName(), DatabaseMysqlBase::fieldName(), DatabaseSqlite::fieldName(), DatabaseMysqlBase::fieldType(), HTMLMultiSelectField::filterDataForSubmit(), HTMLCheckMatrix::filterDataForSubmit(), LocalRepo::findBySha1(), LocalRepo::findBySha1s(), LocalRepo::findFiles(), LocalRepo::findFilesByPrefix(), TrackBlobs::findOrphanBlobs(), FixSlaveDesync::findPageLatestCorruption(), RecompressTracked::finishIncompleteMoves(), DoubleRedirectJob::fixRedirects(), ApiParse::formatCategoryLinks(), DoubleRedirectsPage::formatResult(), GetConfiguration::formatVarDump(), RedisLockManager::freeLocksOnServer(), DatabaseMysqlBase::freeResult(), DatabaseMssql::freeResult(), DatabaseSqlite::freeResult(), DatabaseOracle::freeResult(), PostgresField::fromText(), JobQueue::getAbandonedCount(), JobQueue::getAcquiredCount(), Interwiki::getAllPrefixesDB(), JobQueueAggregator::getAllReadyWikiQueues(), Title::getAuthorsBetween(), ContentHandler::getAutoDeleteReason(), Title::getBrokenLinksFrom(), Title::getCascadeProtectionSources(), WikiPage::getCategories(), DatabaseSqliteTest::getColumns(), SiteConfiguration::getConfig(), WikiPage::getContributors(), AllmessagesTablePager::getCustomisedStatuses(), JobQueue::getDelayedCount(), File::getDescriptionText(), ApiQueryInfo::getDisplayTitle(), MysqlInstaller::getEngines(), LinksUpdate::getExistingCategories(), LinksUpdate::getExistingExternals(), LinksUpdate::getExistingImages(), LinksUpdate::getExistingInterlangs(), LinksUpdate::getExistingInterwikis(), LinksUpdate::getExistingLinks(), LinksUpdate::getExistingProperties(), LinksUpdate::getExistingTemplates(), WikiFilePage::getForeignCategories(), Benchmarker::getFormattedResults(), User::getFormerGroups(), MessageBlobStore::getFromDB(), UserRightsProxy::getGroups(), LocalFileDeleteBatch::getHashes(), WikiPage::getHiddenCategories(), LocalFile::getHistory(), DatabaseSqliteTest::getIndexes(), DatabaseMysqlBase::getLagFromProcesslist(), DatabaseMysqlBase::getLagFromSlaveStatus(), WikiPage::getLastNAuthors(), Title::getLinksFrom(), Title::getLinksTo(), RedisLockManager::getLocksOnServer(), DatabaseMysqlBase::getMasterPos(), SpecialRandomInCategory::getMinAndMaxForCat(), SpecialStatistics::getMostViewedPages(), SqlBagOStuff::getMulti(), BagOStuff::getMulti(), DatabaseMysqlBase::getMysqlStatus(), SpecialExport::getPagesFromCategory(), SpecialExport::getPagesFromNamespace(), Title::getParentCategories(), Revision::getParentLengths(), ApiQueryInfo::getProtectionInfo(), Title::getRedirectsHere(), ApiPageSet::getRedirectTargets(), FixBug20757::getRevTextMap(), Linker::getRollbackEditCount(), JobQueue::getSize(), DatabaseMysqlBase::getSlavePos(), ResourceLoaderWikiModule::getTitleMtimes(), Title::getTitleProtection(), ApiQueryInfo::getTSIDs(), MessageBlobStore::getUpdatesForMessage(), ApiQueryInfo::getWatchedInfo(), ApiQueryInfo::getWatcherInfo(), SpecialEditWatchlist::getWatchlist(), SpecialEditWatchlist::getWatchlistInfo(), ImagePage::imageLinks(), DatabaseOracle::indexExists(), DatabaseSqlite::indexInfo(), DatabaseMysqlBase::indexInfo(), DatabaseMssql::indexInfo(), DatabasePostgres::indexUnique(), ApiPageSet::initFromPageIds(), ApiPageSet::initFromQueryResult(), ApiPageSet::initFromRevIDs(), ApiPageSet::initFromTitles(), DatabaseMssql::insert(), DatabasePostgres::insertId(), SqliteMaintenance::integrityCheck(), SqlDataUpdate::invalidatePages(), JobQueue::isEmpty(), PostgresInstaller::isRoleMember(), BitmapMetadataHandler::Jpeg(), ChangeTags::listDefinedTags(), PageArchive::listFiles(), UploadStash::listFiles(), PageArchive::listRevisions(), Revision::loadFromConds(), MessageCache::loadFromDB(), User::loadGroups(), User::loadOptions(), Title::loadRestrictions(), Title::loadRestrictionsFromResultWrapper(), MssqlInstaller::loginExists(), RedisConnRef::luaEval(), Linker::makeImageLink(), bench_wfBaseConvert::makeRandomNumber(), DatabaseMysqlBase::masterPosWait(), ExternalStoreDB::mergeBatchResult(), moveToExternal(), DatabaseMysql::mysqlDataSeek(), DatabaseMysqli::mysqlDataSeek(), DatabaseMysql::mysqlFetchArray(), DatabaseMysqli::mysqlFetchArray(), DatabaseMysql::mysqlFetchField(), DatabaseMysqli::mysqlFetchField(), DatabaseMysql::mysqlFetchObject(), DatabaseMysqli::mysqlFetchObject(), DatabaseMysql::mysqlFieldName(), DatabaseMysqli::mysqlFieldName(), DatabaseMysql::mysqlFieldType(), DatabaseMysqli::mysqlFieldType(), DatabaseMysql::mysqlFreeResult(), DatabaseMysqli::mysqlFreeResult(), DatabaseMysql::mysqlNumFields(), DatabaseMysqli::mysqlNumFields(), DatabaseMysql::mysqlNumRows(), DatabaseMysqli::mysqlNumRows(), Block::newFromID(), UserArray::newFromIDs(), Title::newFromIDs(), SquidUpdate::newFromLinksTo(), UserArray::newFromResult(), TitleArray::newFromResult(), TitleArray::newFromResult_internal(), UserArray::newFromResult_internal(), Block::newLoad(), DatabaseOracle::nextSequenceValue(), FileOp::normalizeIfValidStoragePath(), LockManager::normalizePathsByType(), EmailNotification::notifyOnPageChange(), DatabaseMssql::numFields(), DatabaseMysqlBase::numFields(), DatabaseSqlite::numFields(), DatabaseOracle::numFields(), DatabaseMssql::numRows(), DatabaseMysqlBase::numRows(), DatabaseSqlite::numRows(), DatabaseOracle::numRows(), SpecialUnlockdb::onSubmit(), SpecialPasswordReset::onSubmit(), SkinTemplate::outputPage(), ImageQueryPage::outputResults(), QueryPage::outputResults(), PurgeChangedPages::pageableSortedRows(), MessageCache::parse(), BacklinkCache::partition(), BacklinkCache::partitionResult(), DatabaseMssql::populateColumnCaches(), RebuildTextIndex::populateSearchIndex(), ResourceLoader::preloadModuleInfo(), PageQueryPage::preprocessResults(), WantedCategoriesPage::preprocessResults(), MostlinkedCategoriesPage::preprocessResults(), ShortPagesPage::preprocessResults(), MostcategoriesPage::preprocessResults(), ListDuplicatedFilesPage::preprocessResults(), MostinterwikisPage::preprocessResults(), ListredirectsPage::preprocessResults(), MostlinkedPage::preprocessResults(), MostlinkedTemplatesPage::preprocessResults(), WantedQueryPage::preprocessResults(), MysqlInstaller::preUpgrade(), JobQueueAggregator::purge(), PurgeChangedFiles::purgeFromArchiveTable(), PurgeChangedFiles::purgeFromLogType(), PurgeList::purgeNamespace(), PurgeRedundantText(), Maintenance::purgeRedundantText(), BacklinkCache::queryLinks(), QueryPage::reallyDoQuery(), RebuildRecentchanges::rebuildRecentChangesTablePass2(), RebuildRecentchanges::rebuildRecentChangesTablePass4(), QueryPage::recache(), JobQueueDB::recycleAndDeleteStaleJobs(), JobQueueRedis::recyclePruneAndUndelayJobs(), lessc::reduce(), PoolCounterRedis::release(), MagicWord::replace(), LinkHolderArray::replaceInternal(), DbTestPreviewer::report(), ApiPageSet::resolvePendingRedirects(), resolveStubs(), ApiQueryProtectedTitles::run(), ApiQueryLangBacklinks::run(), ApiQueryIWBacklinks::run(), ApiQueryRedirects::run(), ApiQueryImages::run(), ApiQueryWatchlistRaw::run(), ApiQueryExtLinksUsage::run(), ApiQueryCategories::run(), ApiQueryAllCategories::run(), ApiQueryCategoryMembers::run(), ApiQueryWatchlist::run(), ApiQueryQueryPage::run(), ApiQueryAllPages::run(), ApiQueryLinks::run(), ApiQueryAllImages::run(), ApiQueryAllLinks::run(), ApiQueryRecentChanges::run(), ApiQueryBacklinks::run(), MWMemcached::run_command(), TitlePermissionTest::runGroupPermissions(), ApiQueryRandom::runQuery(), TableCleanup::runTable(), User::saveOptions(), Categoryfinder::scan_next_layer(), MssqlInstaller::schemaExists(), DatabasePostgres::schemaExists(), EraseArchivedFile::scrubAllVersions(), SearchPostgres::searchQuery(), MssqlResultWrapper::seek(), ORMTable::select(), ApiQueryBase::select(), DatabaseBase::selectField(), RandomPage::selectRandomPageFromDB(), SpecialRandomInCategory::selectRandomPageFromDB(), DatabaseBase::selectRow(), SpecialAllpages::showChunk(), SpecialPrefixindex::showPrefixChunk(), SpecialAllpages::showToplevel(), DatabaseOracle::sourceStream(), DatabaseBase::sourceStream(), MwSql::sqlPrintResult(), StreamFile::stream(), FileBackendStore::streamFile(), Installer::subscribeToMediaWikiAnnounce(), MagicWord::substituteCallback(), DatabaseMssql::tableExists(), DatabaseOracle::tableExists(), DatabaseBase::tableExists(), ChangeTags::tagUsageStatistics(), JpegMetadataExtractorTest::testBinaryCommentStripped(), DatabaseSqliteTest::testCaseInsensitiveLike(), RevisionStorageTest::testConstructFromRow(), ExifBitmapTest::testConvertMetadataLatest(), ExifBitmapTest::testConvertMetadataSoftware(), ExifBitmapTest::testConvertMetadataSoftwareNormal(), ExifBitmapTest::testConvertMetadataToOld(), BlockTest::testCrappyCrossWikiBlocks(), DatabaseSqliteTest::testDeleteJoin(), WikiPageTest::testDoDeleteArticle(), WikiPageTest::testDoDeleteUpdates(), WikiPageTest::testDoEdit(), WikiPageTest::testDoEditContent(), LanguageTrTest::testDottedAndDotlessI(), JpegMetadataExtractorTest::testExifByteOrder(), FileBackendTest::testExtensionFromPath(), RevisionStorageTest::testFetchRevision(), SvgTest::testGetIndependentMetaArray(), JpegTest::testGetIndependentMetaArray(), ExifBitmapTest::testGoodMetadata(), TiffTest::testInvalidFile(), PNGHandlerTest::testInvalidFile(), GIFHandlerTest::testInvalidFile(), JpegTest::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(), JpegMetadataExtractorTest::testMultipleComment(), RevisionStorageTest::testNewFromArchiveRow(), RevisionStorageTest::testNewFromRow(), FileBackendTest::testNormalizeStoragePath(), ExifBitmapTest::testPagedTiffHandledGracefully(), FileBackendTest::testParentStoragePath(), JpegMetadataExtractorTest::testPSIRExtraction(), TitlePermissionTest::testQuickPermissions(), IPTCTest::testRecognizeUtf8(), FileBackendTest::testSplitStoragePath(), LanguageTest::testSprintfDateNoZone(), DatabaseTest::testStoredFunctions(), BitmapMetadataHandlerTest::testTiffByteOrder(), TiffTest::testTiffMetadataExtraction(), DatabaseTest::testUnknownTableCorruptsResults(), JpegMetadataExtractorTest::testUtf8Comment(), JpegMetadataExtractorTest::testXMPExtraction(), JpegMetadataExtractorTest::testXMPExtractionAltAppId(), DatabaseMssql::textFieldSize(), DatabaseBase::textFieldSize(), TrackBlobs::trackOrphanText(), TrackBlobs::trackRevisions(), HTMLForm::trySubmit(), Preferences::tryUISubmit(), 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.
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 |
Definition at line 2 of file database.txt.
Referenced by WebInstallerOutput::addHTML(), WebInstallerOutput::addHTMLNoFlush(), and WebInstallerOutput::flush().
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.
For a write use something like |
Definition at line 26 of file database.txt.
Referenced by NewFilesPager::__construct(), NewFilesPager::getQueryInfo(), and SanitizerTest::provideTagAttributesToDecode().
Use of locking define a new flag for $wgAntiLockFlags which allows them to be turned off |
Definition at line 164 of file database.txt.
Referenced by CheckLanguageCLI::help(), JobQueueRedis::popAndAcquireBlob(), and JobQueueRedis::popAndDeleteBlob().
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 define a new flag for $wgAntiLockFlags which allows them to be turned because we ll almost certainly need to do so on the Wikimedia cluster Instead of locking combine your existence checks into your write queries |
Definition at line 164 of file database.txt.
For a write query |
Definition at line 26 of file database.txt.
Referenced by CategoryViewer::__construct(), RecompressTracked::doAllPages(), ParserOutput::isLinkInternal(), DatabaseOracle::nextSequenceValue(), DatabaseTestHelper::query(), and DatabaseOracle::queryIgnore().
Use of locking define a new flag for $wgAntiLockFlags which allows them to be turned because we ll almost certainly need to do so on the Wikimedia cluster Instead of locking reads |
Definition at line 164 of file database.txt.
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 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 ApiFormatBase::initPrinter(), Linker::linkAttribs(), SanitizerTest::provideTagAttributesToDecode(), UtfNormal::quickIsNFCVerify(), and DifferenceEngine::showDiffPage().
Definition at line 2 of file database.txt.