Begin migrating key formats for cache key lookups or writes (p.1)


Begin migrating key formats for cache key lookups or writes (p.1)

NOTE: This will increase traffic by ~50% to kask because of multiple session or token writes to support both old and new key formats so that we can slowly transition to the usage of global cache backed by BagOStuff. This will happen in about 2 mins for tokens and about 24hrs for sessions (for each wiki group as the change rides the train). We will cleanup this afterwards once we're sure all production wikis are using the new code.

This patch introduces CentralAuthSessionManager::makeGlobalKey() for
retreiving the data from the session/token store and a step to phase
out memcKey() to use either makeTokenKey() or makeSessionKey() as the
new mechanisms. Old key format: "$wgCentralAuthDatabase:$keygroup:$components..."
and new key format: "global:$keygroup:$database:$components...".

BagOStuff::makeGlobalKey() already has in-built escaping of the %25
character and the ":" delimiter, use it directly instead which will
fix the exception thrown per the ticket.

Migration plan

  • Write data for both old and new key format to session and token store.
  • Old code should still read cache using the old key format.
  • Cache gets warmed up with data using new key format.
  • After a complete train ride to all wikis, migrate code that uses new key format to read from already warmed caches.
  • Delete code that used old key format from CentralAuth.

Bug: T347223
Change-Id: I77b9f596a9049c349ffa72490ddced88886354cf