Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Lib\Store\Sql\Terms\CleanTermsIfUnusedJob Class Reference

A job to cleanup the wbt_* terms table rows when they may not be needed any more. More...

+ Inheritance diagram for Wikibase\Lib\Store\Sql\Terms\CleanTermsIfUnusedJob:
+ Collaboration diagram for Wikibase\Lib\Store\Sql\Terms\CleanTermsIfUnusedJob:

Public Member Functions

 __construct (TermStoreCleaner $cleaner, $params)
 
 run ()
 Of the given term in lang IDs, delete those that are not used by any other items or properties.
 

Static Public Member Functions

static getJobSpecification (Title $unused, array $params)
 
static getJobSpecificationNoTitle (array $params)
 

Public Attributes

const JOB_NAME = 'CleanTermsIfUnused'
 
const TERM_IN_LANG_IDS = 'termInLangIds'
 

Private Attributes

 $termInLangIdsCleaner
 

Detailed Description

A job to cleanup the wbt_* terms table rows when they may not be needed any more.

This job currently executes in a single transaction.

Callers can choose to supply a single termInLang id to clean per job or multiple. Supplying multiple ids will naturally mean the Job and the transaction take longer and therefor locks will also be held for a longer period of time possibly causing lock contention. This started to show on wikidata.org in https://phabricator.wikimedia.org/T246898 and thus the default was switched for create a single job per termInLang id. For smaller Wikibase installs with a lower edit rate it might make sense to instead optimize for fewer jobs, where lock contention is less of an issue.

Todo
Execute the cleanup of each table in its own transaction to further reduce lock contention
See also
Item & Property Terms
Author
Addshore

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Lib\Store\Sql\Terms\CleanTermsIfUnusedJob::__construct ( TermStoreCleaner $cleaner,
$params )

Member Function Documentation

◆ getJobSpecification()

static Wikibase\Lib\Store\Sql\Terms\CleanTermsIfUnusedJob::getJobSpecification ( Title $unused,
array $params )
static
Parameters
Title$unusedBut required due to the code in Job::factory currently.
array$params
Returns
CleanTermsIfUnusedJob

◆ getJobSpecificationNoTitle()

static Wikibase\Lib\Store\Sql\Terms\CleanTermsIfUnusedJob::getJobSpecificationNoTitle ( array $params)
static

◆ run()

Wikibase\Lib\Store\Sql\Terms\CleanTermsIfUnusedJob::run ( )

Of the given term in lang IDs, delete those that are not used by any other items or properties.

Returns
bool

Member Data Documentation

◆ $termInLangIdsCleaner

Wikibase\Lib\Store\Sql\Terms\CleanTermsIfUnusedJob::$termInLangIdsCleaner
private

◆ JOB_NAME

const Wikibase\Lib\Store\Sql\Terms\CleanTermsIfUnusedJob::JOB_NAME = 'CleanTermsIfUnused'

◆ TERM_IN_LANG_IDS

const Wikibase\Lib\Store\Sql\Terms\CleanTermsIfUnusedJob::TERM_IN_LANG_IDS = 'termInLangIds'

The documentation for this class was generated from the following file: