Page MenuHomePhabricator

[native] Reintroduce `createUpdateDBOpsForThreadStoreThreadInfos` for new `RawThreadInfo` encoding
ClosedPublic

Authored by atul on Feb 15 2024, 12:21 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Nov 12, 10:29 PM
Unknown Object (File)
Wed, Nov 6, 3:24 PM
Unknown Object (File)
Oct 15 2024, 2:18 PM
Unknown Object (File)
Oct 15 2024, 2:18 PM
Unknown Object (File)
Oct 15 2024, 2:18 PM
Unknown Object (File)
Oct 15 2024, 2:18 PM
Unknown Object (File)
Oct 15 2024, 2:18 PM
Unknown Object (File)
Sep 16 2024, 10:05 AM
Subscribers

Details

Summary

Discussed in D11057, but we want to "freeze" the previous implementation of createUpdateDBOpsForThreadStoreThreadInfos in place to support old migrations while re-introducing a new version that only handles MinimallyEncoded -> MinimallyEncoded migrations. We will only have MinimallyEncoded -> MinimallyEncoded migrations in the future, so IMO it doesn't make sense to clutter up createUpdateDBOpsForThreadStoreThreadInfos to be able to handle

  • LegacyRawThreadInfos => LegacyRawThreadInfos
  • LegacyRawThreadInfos => MinimallyEncodedRawThreadInfos
  • MinimallyEncodedRawThreadInfos => MinimallyEncodedRawThreadInfos

It also lets us avoid having to go back and test some of the old migrations when we tweak createUpdateDBOpsForThreadStoreThreadInfos.


Depends on D11057

Test Plan

This gets consumed for the first time in the upcoming specialRoles migration where it will be tested implicitly.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

atul published this revision for review.Feb 15 2024, 12:26 PM
atul added inline comments.
native/redux/client-db-utils.js
34–36 ↗(On Diff #37273)

Similar to deprecated* version of the function:

e3633a.png (228×1 px, 44 KB)

except we call convertClientDBThreadInfoToRawThreadInfo instead of deprecatedConvertClientDBThreadInfoToRawThreadInfo which means we will get back "MinimallyEncoded" RawThreadInfos... which are what we want to run the migration on and repopulate SQLite with.

38–39 ↗(On Diff #37273)

I know we generally prefer the ES6 map/filter/reduce/etc functions, but in this case using lodash/keyBy was far more concise than what we had before:

708e5c.png (610×1 px, 109 KB)

41–50 ↗(On Diff #37273)

Nothing has changed with these except some naming.

52–59 ↗(On Diff #37273)

All that's changed here is that I pulled out construction of replaceThreadOperations vs what we had before:

f25f0b.png (606×2 px, 112 KB)

tomek added inline comments.
native/redux/client-db-utils.js
38–39 ↗(On Diff #37273)

Not sure if other devs agree, but for me it is more convenient to have a code block in a comment instead of a screenshot. The screenshot isn't readable unless you open it, which breaks the review flow and makes it a lot harder to compare the versions.

This revision is now accepted and ready to land.Feb 16 2024, 2:24 AM
native/redux/client-db-utils.js
38–39 ↗(On Diff #37273)

That's fair, will make sure to paste snippets in code blocks in the future.

This revision was landed with ongoing or failed builds.Feb 20 2024, 12:15 PM
This revision was automatically updated to reflect the committed changes.