You are browsing a read-only backup copy of Wikitech. The live site can be found at wikitech.wikimedia.org
The Analytics Data Lake (ADL) refers to the collection, processing, and publishing of data from Wikimedia projects. At first, the Data Lake focuses on collecting historical data about editing, including revisions, pages, users, and making it available in an analytics-friendly way for everyone, publicly. As the Data Lake matures, we will add any and all data that can be safely made public. The infrastructure will support public releases of datasets, out of the box.
Consolidating Editing Data
Millions of people edit our projects. Information about the knowledge they generate and improve is trapped in hundreds of separate mysql databases and large XML dump files. We will create analytics-friendly schemas and transform this separated data to fit those schemas. HDFS is the best storage solutions for this, so that's what we'll use. We will make the schemas and the data extraction using an append-only style, so actions like deleting pages and supressing usertext can be first class citizens. This will allow us to create redacted streams of data that can be published safely.
It will of course be important to keep this data up to date. To accomplish this we will connect to real-time systems like Event Bus to get the latest data. From time to time, we'll compare to make sure we have no replication gaps.
When storing to HDFS, we will create well documented, unified tables on top of this data. This will be useful for any batch or really long running queries.
Druid and any other Online Analytics Processing (OLAP) systems we use will serve this data to internal and maybe external users as well. This data serving layer allows us to run complicated queries that would otherwise consume massive resources in a relational database. If we're able to properly redact and re-load this data on a regular basis, we will be able to open this layer to the public.
Analytics Query Service / Dumps
We will continue and push slices of this data out to the world through our query service (AQS) which currently hosts our Pageview and Unique Devices data. We will also make the most useful forms of this data available in static file dumps. These dumps will contain strictly metadata and shouldn't be confused with the "right to fork"-oriented richer dumps. Those may be easier to generate using this system as well, see below.
Pleasant Side Effects
One potential use of this technology will be to help replace the aging Dumps process. Incremental dumps, more accurately redacted dumps, reliable re-runnable dumps should all be much easier to achieve with the Data Lake, and the data streams that feed into it, than they are with the current set of dumps scripts and manual intervention.
Various experiences on gathering and computing on full edit data history has shown that it's a bad idea to rebuild a full edit data set on regular basis in opposition to incrementally update it.
In order to get there, two core systems are needed:
- Historical data extraction system: It extracts historical data from either the mediawiki databases and/or the XML dumps and convert and refine it to the schema used (see below for schema description).
- Incremental data update system: It handles events flowing through a streaming system and updates an already existing data set by transforming and refining the events into the needed schema.
Once those two systems are built and tested, a date needs to decided upon which the data set will be built, from historical system before D, and from incremental system after D. We also plan to maintain the historical system even if its use is less regular than the incremental one, to ensure new data could be extracted historically in the future.
The plan is to use Hadoop to both store data and compute the various ETL / refinement steps (cheap, reliable and already in place).
- Mediawiki Database schema --
- Intermediate schema -- Fed transforming and enhancing raw Media wiki data. It contains
User_changetables [Still WIP]. Rows contain entity state at a moment in time, the next state change time, and event oriented information, such as who did the change, and what type of change it is.
- Event Bus schemas -- An update to this schema is being discussed and will be merged as a v1 when mediawiki code gets updated to populate those new event types.
Query data in Hadoop
- Fully denormalized schema containing event oriented rows with null values in fields not related to the current event. In hive syntax:
CREATE TABLE edits_denorm( -- Generic event information -- Populated for every event event_entity STRING, event_type STRING, event_timestamp TIMESTAMP, event_comment STRING, event_user_id BIGINT, event_user_text STRING, event_user_creation_timestamp TIMESTAMP, event_user_blocks ARRAY<STRING>, event_user_groups ARRAY<STRING>, event_wiki STRING, -- Page change information -- Populated for page and revision events page_id BIGINT, page_title STRING, page_namespace BIGINT, page_redirect STRING, page_restrictions ARRAY<STRING>, page_creation_timestamp TIMESTAMP, page_visibility ARRAY<STRING>, -- User change information -- Populated on user events only user_id BIGINT, user_text STRING, user_creation_timestamp TIMESTAMP, user_blocks ARRAY<STRING>, user_groups ARRAY<STRING>, -- Revision change revision information -- Populated on revision events only rev_id BIGINT, rev_parent_id BIGINT, rev_minor BOOLEAN, rev_text_bytes BIGINT, rev_text_bytes_diff BIGINT, rev_text_sha1 STRING, rev_model STRING, rev_format STRING );
Query data in Druid
- Same denormalized schema as in hadoop enhanced with precomputed immutable flags if Druid Query-Time lookups can handle them.
- Schema update -- task T134502
- Mediawiki update to handle schema update -- task T137287
- New event schema to come after this set of patches
Historical data sourcing
- Hive schema creation and test using simplewiki and a set of test queries on dump generated data -- task T134793
- ETL for transforming MediaWiki database data to Hive schema for simplewiki -- task T134790
- Scalability tests to come after pipeline is built
Details not to Forget
- At page rename, there sometimes is a new page created which has the renamed page original title and redirects to the renamed page. We have left those on the side for the moment.
- There are user rename log lines that can't be linked back to an actual user. It could be because of deletions, but we're not sure. We should investigate a bit.