Jump to content

Actor migration/sv: Difference between revisions

From mediawiki.org
Content deleted Content added
No edit summary
Tags: Mobile edit Mobile web edit Advanced mobile edit
FuzzyBot (talk | contribs)
Updating to match new version of source page
Line 1: Line 1:
<languages />
<languages />
{{tracked|T167246}}
{{tracked|T167246}}
Historically, MediaWiki has stored references to users (such as the author of a revision or an image) as an <code>[&lt;id>, &lt;name>]</code> pair, with <code>[0, &lt;IP address>]</code> for anonymous edits.
<span lang="en" dir="ltr" class="mw-content-ltr">Historically, MediaWiki has stored references to users (such as the author of a revision or an image) as an <code>[&lt;id>, &lt;name>]</code> pair, with <code>[0, &lt;IP address>]</code> for anonymous edits.</span>
This was a waste of storage space, caused performance issues on wikis with a huge number of revisions, and made it very hard to rename users or introduce new types of authors such as [[phab:T133452|T133452]].
<span lang="en" dir="ltr" class="mw-content-ltr">This was a waste of storage space, caused performance issues on wikis with a huge number of revisions, and made it very hard to rename users or introduce new types of authors such as [[phab:T133452|T133452]].</span>
MediaWiki 1.31 introduces the concept of ''actors'' (someone who makes an action, such as an edit or a log event; currently either a registered user or an anonymous one), and a migration process towards a new database schema, with fields like <code>revision.rev_user</code> and <code>revision.rev_user_text</code> replaced by fields like <code>revision.rev_actor</code>.
<span lang="en" dir="ltr" class="mw-content-ltr">MediaWiki 1.31 introduces the concept of ''actors'' (someone who makes an action, such as an edit or a log event; currently either a registered user or an anonymous one), and a migration process towards a new database schema, with fields like <code>revision.rev_user</code> and <code>revision.rev_user_text</code> replaced by fields like <code>revision.rev_actor</code>.</span>
Due to the huge size of the English Wikipedia revision table, which must be fully migrated before the changes can be cleaned up, the migration is being done gradually, over several MediaWiki releases.
<span lang="en" dir="ltr" class="mw-content-ltr">Due to the huge size of the English Wikipedia revision table, which must be fully migrated before the changes can be cleaned up, the migration is being done gradually, over several MediaWiki releases.</span>
It is expected to finish in MediaWiki 1.34.
<span lang="en" dir="ltr" class="mw-content-ltr">It is expected to finish in MediaWiki 1.34.</span>


The migration will create an {{ll|Manual:Actor table|actor}} table record for every distinct <code>*_user</code> / <code>*_user_text</code> pair, and replace those pairs with a reference to the actor row ID.
<span lang="en" dir="ltr" class="mw-content-ltr">The migration will create an {{ll|Manual:Actor table|actor}} table record for every distinct <code>*_user</code> / <code>*_user_text</code> pair, and replace those pairs with a reference to the actor row ID.</span>
The following columns are being migrated:
<span lang="en" dir="ltr" class="mw-content-ltr">The following columns are being migrated:</span>


{|class=wikitable
{|class=wikitable
Line 30: Line 30:
|}
|}


To avoid doing a costly ALTER TABLE on the extremely huge revision tables of large Wikipedia wikis, <code>rev_user</code> and <code>rev_user_text</code> are initially copied to the {{ll|Manual:revision_actor_temp table|revision_actor_temp}} table and from there back to <code>revision</code>.
<span lang="en" dir="ltr" class="mw-content-ltr">To avoid doing a costly ALTER TABLE on the extremely huge revision tables of large Wikipedia wikis, <code>rev_user</code> and <code>rev_user_text</code> are initially copied to the {{ll|Manual:revision_actor_temp table|revision_actor_temp}} table and from there back to <code>revision</code>.</span>
The revision_actor_temp table will be dropped afterwards.
<span lang="en" dir="ltr" class="mw-content-ltr">The revision_actor_temp table will be dropped afterwards.</span>


If you are a wiki owner, you probably don't need to do anything, the migration will happen automatically when you run <code>update.php</code>.
<span lang="en" dir="ltr" class="mw-content-ltr">If you are a wiki owner, you probably don't need to do anything, the migration will happen automatically when you run <code>update.php</code>.</span>
If you want to control when the migration happens, see {{ll|Manual:$wgActorTableSchemaMigrationStage|$wgActorTableSchemaMigrationStage}} and the {{ll|Manual:MigrateActors.php|migrateActors.php}} maintenance script.
<span lang="en" dir="ltr" class="mw-content-ltr">If you want to control when the migration happens, see {{ll|Manual:$wgActorTableSchemaMigrationStage|$wgActorTableSchemaMigrationStage}} and the {{ll|Manual:MigrateActors.php|migrateActors.php}} maintenance script.</span>


If you are an extension developer, and your extension does direct DB access to some of the affected fields, you'll need to update your queries (and ideally use the <code>getQueryInfo()</code> methods, such as <code>Revision::getQueryInfo()</code>, instead of manually constructing your query).
<span lang="en" dir="ltr" class="mw-content-ltr">If you are an extension developer, and your extension does direct DB access to some of the affected fields, you'll need to update your queries (and ideally use the <code>getQueryInfo()</code> methods, such as <code>Revision::getQueryInfo()</code>, instead of manually constructing your query).</span>
During the migration period, you can also use the <code>ActorMigration</code> class to get schema/field information that respects any <code>$wgActorTableSchemaMigrationStage</code> settings.
<span lang="en" dir="ltr" class="mw-content-ltr">During the migration period, you can also use the <code>ActorMigration</code> class to get schema/field information that respects any <code>$wgActorTableSchemaMigrationStage</code> settings.</span>


If you are a tool developer using {{ll|Toolforge}}, there might be performance implications, even if you don't use any of the affected fields directly.
<span lang="en" dir="ltr" class="mw-content-ltr">If you are a tool developer using {{ll|Toolforge}}, there might be performance implications, even if you don't use any of the affected fields directly.</span>
Se [[wikitech:News/Actor storage changes on the Wiki Replicas|wikitech:News/Actor storage changes on the Wiki Replicas]] (på engelska) för ytterligare information.
Se [[wikitech:News/Actor storage changes on the Wiki Replicas|wikitech:News/Actor storage changes on the Wiki Replicas]] (på engelska) för ytterligare information.



Revision as of 22:06, 10 October 2020

Historically, MediaWiki has stored references to users (such as the author of a revision or an image) as an [<id>, <name>] pair, with [0, <IP address>] for anonymous edits. This was a waste of storage space, caused performance issues on wikis with a huge number of revisions, and made it very hard to rename users or introduce new types of authors such as T133452. MediaWiki 1.31 introduces the concept of actors (someone who makes an action, such as an edit or a log event; currently either a registered user or an anonymous one), and a migration process towards a new database schema, with fields like revision.rev_user and revision.rev_user_text replaced by fields like revision.rev_actor. Due to the huge size of the English Wikipedia revision table, which must be fully migrated before the changes can be cleaned up, the migration is being done gradually, over several MediaWiki releases. It is expected to finish in MediaWiki 1.34.

The migration will create an actor table record for every distinct *_user / *_user_text pair, and replace those pairs with a reference to the actor row ID. The following columns are being migrated:

Tabell Gamla kolumner Ny kolumn
revision rev_user, rev_user_text rev_actor
archive ar_user, ar_user_text ar_actor
ipblocks ipb_by, ipb_by_text ipb_by_actor
image img_user, img_user_text img_actor
oldimage oi_user, oi_user_text oi_actor
filearchive fa_user, fa_user_text fa_actor
recentchanges rc_user, rc_user_text rc_actor
logging log_user, log_user_text log_actor

To avoid doing a costly ALTER TABLE on the extremely huge revision tables of large Wikipedia wikis, rev_user and rev_user_text are initially copied to the revision_actor_temp table and from there back to revision. The revision_actor_temp table will be dropped afterwards.

If you are a wiki owner, you probably don't need to do anything, the migration will happen automatically when you run update.php. If you want to control when the migration happens, see $wgActorTableSchemaMigrationStage and the migrateActors.php maintenance script.

If you are an extension developer, and your extension does direct DB access to some of the affected fields, you'll need to update your queries (and ideally use the getQueryInfo() methods, such as Revision::getQueryInfo(), instead of manually constructing your query). During the migration period, you can also use the ActorMigration class to get schema/field information that respects any $wgActorTableSchemaMigrationStage settings.

If you are a tool developer using Toolforge , there might be performance implications, even if you don't use any of the affected fields directly. Se wikitech:News/Actor storage changes on the Wiki Replicas (på engelska) för ytterligare information.