Page MenuHomePhabricator

Change the order of the `rev` clustering key in restrictions table
Closed, DeclinedPublic

Description

When we've made the restrictions table we've made a critical mistake - the order of the rev clustering key was set to asc, so now for requests without the revision if there're multiple entities in the table, the earliest revision would be selected while we actually need the latest.

Unfortunately, we already have a lot of data in the table, and altering the table to change the clustering key order is not supported. This means we need to proceed with a lot of manual steps:

  • Create a new restrictions table with the same schema and desc rev key order.
  • Switch to it in production to start writing to it.
  • Run a script to reload all the data from old restrictions table to the new one
  • Drop the old restriction table.

Obviously, we cannot switch to the restriction-based access control before this is resolved.

Event Timeline

The steps listen in the task description might not be enough because it will change the semantics of the GE query we're making for the requests with the specific revision. If the specific revision wasn't restricted, we need to fetch at least some restriction entity to check out the page_deleted static column. This could be easily fixed by storing the page_deleted property with a specific, magical rev=0 and using the LE query.

Also, the redirect detection code should check if the content revision (from the ETag) and the actual restriction revision from the restriction query match and apply the redirect logic only if they do.

GWicke triaged this task as Medium priority.Aug 8 2017, 9:49 PM
Pchelolo edited projects, added Services (done); removed Services (next).

It's been decided we will no longer pursue the restrictions table idea, so this is not needed any more.