daniel added a comment.

  In T138208#7612881 <https://phabricator.wikimedia.org/T138208#7612881>, 
@Ladsgroup wrote:
  
  > Thanks, that was the missing piece. My suggestion would be to set an 
environmental variable in calling mw scripts (if it's not set already). phpunit 
does a similar thing. And in LB code in mw when trying to get a connection, it 
should check the env variable and override groups. That would be the cleanest 
way if you ask me.
  >
  > We still have the problem of config reload, how long each stream job 
usually takes?
  
  An environment variable would work, but I think I prefer the idea of setting 
the group per script. Wikidata's DumpEntities does this, and it makes more 
sense to me semantically: defaulting to a specific server group is specific to 
the script's task, not to the environment it runs in.
  
  Having a way to tell getBlob to use a different db group, as I suggested 
earlier, would be nice, but it's rather brittle. We will have to remember to 
allow such a flag to be passed into all storage layer services. That doesn't 
seem great.
  
  There's a caveat wrt settings $wgDBDefaultGroup in finalSetup(): There is no 
guarantee that whatever service is going to read that variable hasn't already 
been instantiated. Specifically note that MWLBFactory will copy the value of 
DBDefaultGroup, and any modification of the global will have no effect after 
that.
  
  Mid-term, we will need a canonical way for maintenance scripts to set 
configuration that does not involve global variables. This has to happen after 
all configuration has been loaded, but before any services have been 
constructed. Wikidata's DumpEntities uses the MediaWikiServices hook to do 
that, but it would be nice to make this easier for maintenance scripts. Perhaps 
finalSetup should just always run in a MediaWikiServices hook? See T275334 
<https://phabricator.wikimedia.org/T275334> and T271574 
<https://phabricator.wikimedia.org/T271574> for related discussion.

TASK DETAIL
  https://phabricator.wikimedia.org/T138208

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: daniel
Cc: LSobanski, Ladsgroup, Marostegui, Addshore, Lydia_Pintscher, daniel, hoo, 
ArielGlenn, jcrespo, Zppix, 786, Suran38, Biggs657, Invadibot, Lalamarie69, 
maantietaja, Juan90264, Alter-paule, jannee_e, Beast1978, Un1tY, Akuckartz, 
Hook696, Kent7301, holger.knust, joker88john, CucyNoiD, Nandana, Gaboe420, 
Giuliamocci, Cpaulf30, Lahi, Gq86, Af420, Bsandipan, GoranSMilovanovic, Lunewa, 
QZanden, LawExplorer, Lewizho99, Maathavan, _jensen, rosalieper, Scott_WUaS, 
gnosygnu, Wikidata-bugs, aude, Mbch331
_______________________________________________
Wikidata-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to