Page MenuHomePhabricator

Data Lake - sqoop of commons link tables needs to adapt to move to dedicated MariaDB cluster
Closed, ResolvedPublic

Description

See parent task. We need to be sure that sqooping of various commonswiki link tables will keep working.

Deadline: End of August 2026.

Details

Event Timeline

Ahoelzl triaged this task as High priority.

@Ladsgroup @Zabe, we use dblists to discover the sections that a particular wiki db is on. From what I can tell, the wgVirtualDomainsMapping config is not reflected there. We'll need a way to identify which section should be queried for the commonswiki link tables.

How can we discover the virtual-links settings outside of MediaWiki PHP land?

Also, from what I can tell, the work to migrate commonswiki is still ongoing. We should have focused on this task sooner, but it will be easier for us to do so now if we don't have to urgently roll it out.

Can you give us an updated deadline or timeline?

@Ladsgroup @Zabe, we use dblists to discover the sections that a particular wiki db is on. From what I can tell, the wgVirtualDomainsMapping config is not reflected there. We'll need a way to identify which section should be queried for the commonswiki link tables.

How can we discover the virtual-links settings outside of MediaWiki PHP land?

The only thing that is going to have a different links table is commons. We are not planning to move anything else any time soon.

Also, from what I can tell, the work to migrate commonswiki is still ongoing. We should have focused on this task sooner, but it will be easier for us to do so now if we don't have to urgently roll it out.

Can you give us an updated deadline or timeline?

We have a deadline from the DBAs to get it done ASAP given that the current state is breaking their automation. So We are aiming for next week. That being said, we can keep the tables on certain hosts (we are planning to keep them in wikireplicas for a while anyway) to avoid breaking your sqoops, the data won't be updated but most of the rows don't get changed anyway.

The only thing that is going to have a different links table is commons. We are not planning to move anything else any time soon.

Okay, but how can we determine which section to query from dblists?

The only thing that is going to have a different links table is commons. We are not planning to move anything else any time soon.

Okay, but how can we determine which section to query from dblists?

I don't understand the question I think. dblists are just set of wikis. what to query is a cluster that can be s3, s4, or x3, x4, etc. and they are different things. There is a complex relationship between dblists and db clusters or virtual domains.

We query from all wikis. Rather than duplicating and hardcoding the cluster that a wiki is on, dblists are parsed to map from a dbname to a section , and then the hostname and port to query is resolved via a SRV DNS query.

The code (and dblists) currently has no way to automatically discover which cluster to query by table, only by dbname. If the virtual domains for tables are not listed in dblists, we have no way to discover this.

I might have a hardcoded workaround, but I'm a bit out of my area of expertise... patch incoming.

Change #1335154 had a related patch set uploaded (by Ottomata; author: Ottomata):

[analytics/refinery@master] sqoop-mediawiki-tables - add a DB_MAPPING_TABLE_OVERRIDES

https://gerrit.wikimedia.org/r/1335154

I think that's an out-dated way of looking at it. The current state is this: You can use the dblists to find main home of a wiki's database so you know for commonswiki, you'll get s4 and from there you can find the host:port via DNS records but that's the main wiki's db. More and more tables are going to be moved out to a database of same name but in external clusters (x1, x3, x4, maybe more in the future). So a more roboust solution could be to go through all external sections and all of wikis you have on all.dblist and if the table is in the list of tables you sqoop, sqoop it. Think of the extra databases more like "extension of the wiki's db" for a wiki rather than a dedicated wiki or a dedicated database to sqoop.

One part of the problem is that the sqoop script doesn't seem to check whether a table or a database exists, it just requires the list of tables and dbs and sqoops all of that which breaks when we drop tables that aren't needed on closed wikis for example. If you can make it more tolerant of absence of databases or tables, you can just run this on all.dblist in x1, x3, and x4 unconditionally. I don't know how hard it would be to implement it though.

If this is about sqoops, they happen monthly. Even if we break everything next week, you'll have until end of September to fix it. Am I missing something obvious?

FWIW, there are surely MANY better ways to do sqoop stuff. We hope to fix them T437079: [Tech evaluation] How we import the MediaWiki databases into the S3 data lake ... one day :)

If this is about sqoops, they happen monthly. Even if we break everything next week, you'll have until end of September to fix it. Am I missing something obvious?

Yes, correct, thank you. Dan will pick this back up when he comes back from vaca.

Picking this up now. At the moment somewhat torn between the kind of hacky way Andrew started (those are clusters you're mapping to there, not dbs, I have to add another layer) and the more robust approach Amir is suggesting. Will ponder.

Right now we're doing this to find a db:

  • Find the shard in dblists (for commons, this is s4)
  • DNS lookup: '_s4-analytics._tcp.eqiad.wmnet', 'SRV'
  • get back dbstore1007.eqiad.wmnet, 3314
  • for analytics replicas, use that
  • for redacted replica (flag --clouddb), use an-redacteddb1001.eqiad.wmnet, 3314

So in an ideal world, I could swap s4 with x4 above for just these tables, and everything else would work:

  • DNS would return dbstore1007.eqiad.wmnet, 3324
  • And I find the links tables on commonswiki, host an-redacteddb1001, port 3324

I'm checking with folks if this is the case, or basically adapting whatever the reality is to this. And then we should be good to go, patch Monday after I get more info.

k, I tested my patch in a semi-production environment and found everything to be working well:

https://gerrit.wikimedia.org/r/c/analytics/refinery/+/1335154

Will ask for reviews and look to merge. Deployment should be a standard refinery deploy

Change #1335154 merged by Milimetric:

[analytics/refinery@master] sqoop-mediawiki-tables - add a shard override

https://gerrit.wikimedia.org/r/1335154

FYI: with this deployed I updated the analytics-mysql docs on wikitech: https://wikitech.wikimedia.org/wiki/Data_Platform/Systems/MediaWiki_replicas#MySQL_wrapper (you can just pass --help to see the minor change)