Page MenuHomePhabricator

Introduce Calendar "UTC Epoch" columns for query windowing
ClosedPublic

Authored by epriestley on Oct 3 2016, 3:43 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Apr 17, 2:42 PM
Unknown Object (File)
Mar 15 2024, 4:23 AM
Unknown Object (File)
Feb 26 2024, 10:14 AM
Unknown Object (File)
Feb 10 2024, 9:22 AM
Unknown Object (File)
Feb 6 2024, 4:21 AM
Unknown Object (File)
Feb 3 2024, 12:17 PM
Unknown Object (File)
Jan 24 2024, 11:41 AM
Unknown Object (File)
Jan 24 2024, 11:41 AM
Subscribers
None

Details

Summary

Ref T10747. Currently, Calendar events are mostly epoch-based and cheat a little bit for all-day events.

This already felt a little flimsy, and can't reasonably accommodate the full range of .ics events, which include "floating" events (e.g., occurs at 3PM regardless of timezone, like "Tea Time").

As a secondary issue, we identify instances of a recurring event by instance number (1, 2, 3, etc.). This can't accommodate the full range of .ics events, which include arbitrary additional "RDATE" events (e.g., recurrs every week, and also on these specific extra days).

However, we do need to store some epoch information so we can do query windowing: when the user looks at "October 2016", we want to select the smallest number of events that we can from the database initially, before refining them down to generate instances. We can't reasonably query the actual dates no matter how we store them because this depends on computing things like UNTIL, COUNT, initial dates, whether events are recurring or not, timezones, etc.

Instead, when we save an event compute the earliest second it occurs on in UTC and the latest second it occurs on in UTC. We can then query for a small superset of possible events in "October 2016" for any viewer pretty easily.

Also, start laying the groundwork for using fewer epochs in the rest of the code, and for reducing the role of sequence indexes (I plan to keep some sequences indexes around, probably, since they're nice in the UI, but not all child events will have indexes since there's no index for an RDATE event).

This doesn't migrate existing events yet or actually read these new columns -- that will come later once the new code is a little more solid.

Test Plan
  • Ran bin/storage upgrade.
  • Created a new event.
  • Saved an existing event.
  • Viewed database, saw sensible-looking "UTC Epoch" values.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

epriestley retitled this revision from to Introduce Calendar "UTC Epoch" columns for query windowing.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: chad.
chad edited edge metadata.
This revision is now accepted and ready to land.Oct 3 2016, 4:52 PM
This revision was automatically updated to reflect the committed changes.