Page MenuHomePhabricator

MediaWiki DomainEvents - Include LogEntry
Open, Needs TriagePublic

Description

T424350: Incremental MediaWiki History Phase I uses a combination of events and database snapshots to reconstruct the full MediaWiki History. The mediawiki_history dataset contains an event based view of state changes to pages, users and revisions.

If events contained the logging table's log_id associated with the event, (e.g. user rename, page move, page delete, etc.), we would have a stable identifier that could easily map between event data and MediaWiki's own record of state changes.

The parent task, T425996: Add log_id to mediawiki page_change and user_change events has more details.

Providing the LogEntry instance in relevant DomainEvents will make it possible to add the log_id field to the externally event data.

The difficulty of doing this will vary depending on which DomainEvent is being emitted.

https://www.mediawiki.org/wiki/Manual:Domain_events/Hierarchy#Include_LogEntry_objects_in_events

Event Timeline

Ottomata renamed this task from MediaWiki DomainEvents - Include LogEntry in DomainEvents to MediaWiki DomainEvents - Include LogEntry.
Ottomata updated the task description. (Show Details)

Integrating LogEntries with DomainEvents is something I have explored before, but it proved rather tricky to get right. I don't recall the details, but T389602 has some discussion.

BPirkle subscribed.

I'm unclear whether Data Engineering is planning to do this work, or is requesting MediaWiki Interfaces to do it. I see the task in Backlog on a DPE board, so I'm assuming the former and putting this in MWI's Radar column. If that's incorrect, please adjust.

but T389602 has some discussion.

Oh thank you for the reminder!

unclear whether Data Engineering is planning to do this work, or is requesting MediaWiki Interfaces to do it.

Hoping for a collaboration. DPE will drive prioritization through OKRs, so stay tuned!

unclear whether Data Engineering is planning to do this work, or is requesting MediaWiki Interfaces to do it.

Hoping for a collaboration. DPE will drive prioritization through OKRs, so stay tuned!

Thanks. Moving to our "Needs Further Discussion" column.

@Ottomata did you intent to move this one to Phase II?

@Ottomata would you like me to set up some discussions with the mw team so we can kick off collaboration?

@Ottomata did you intent to move this one to Phase II?!

Yes! And I did.

@Ottomata would you like me to set up some discussions with the mw team so we can kick off collaboration?

Yes please that would be great! cc @HCoplin-WMF

The big conceptual question is: is the log driven by events, or does logging emit events? I was originally trying to make it so the log is driven by events, like RecentChanges is. But log entries are often created as part of the primary transaction. So we we could do the opposite and emit LogEntry objects (or rather, a nice value object version of LogEntry) as part of certain events. Create a LoggedDomainEvent interface.

Aye! FWIW, the motivation is described in T425996: Add log_id to mediawiki page_change and user_change events and T425986: Add log_id to wmf.mediawiki_history.

They are looking for an 'event id' to use for the history of state changes. Revision are easy, since they are themselves a log of events: the revision id. But anything else needs a key.

log_id is the natural key for all page and user events in MediaWiki — every move, delete, restore, rename, block, and account-creation corresponds to exactly one row in the logging table identified by (wiki_db, log_id). [...]

event_log_id will be NULL for revision rows, which use revision_id as their identity column.

So we we could do the opposite and emit LogEntry objects (or rather, a nice value object version of LogEntry) as part of certain events

Yes please! :)

In https://phabricator.wikimedia.org/T427817#12120876 @halley asked

Is there an OKR this is associated with?

Anticipating the same question here about log_id + DomainEvents:

This work supports the accuracy of any data product (metric or product feature) that depends on Incremental MediaWiki history (including Attribution API Contributor Count ;) ).