Commit Graph

179 Commits

Author SHA1 Message Date
Matthew Chen
73594067a0 Reduce GRDB read pool size in NSE. 2021-10-26 15:06:38 -07:00
Michelle Linington
e1241eef76 Fix database path KVO 2021-10-04 09:53:37 -03:00
Michelle Linington
e8d7e7b930 Additional logging 2021-10-04 09:53:37 -03:00
Michelle Linington
6f4d3ea56a Remove debug log messages and lint 2021-10-04 09:53:37 -03:00
Michelle Linington
8446ab4069 Minor changes to folder selection and restoration cleanup 2021-10-04 09:53:36 -03:00
Michelle Linington
417c135fc9 Lint 2021-10-04 09:53:36 -03:00
Michelle Linington
85bdc19dea Better handling of KVO unregistration 2021-10-04 09:53:36 -03:00
Michelle Linington
738a4aae44 Remove ability to open database in other directory modes
This is unsafe in a cross-process world
2021-10-04 09:53:36 -03:00
Michelle Linington
ccf9383533 Improvements to database swap flow
Added a bunch of comments clarifying the database swap requirements.
Also, removed the baseDir parameter from GRDBDatabaseStorageAdapter.
2021-10-04 09:53:36 -03:00
Michelle Linington
fdc983519a Dynaically update database location at runtime
Fixes an issue where users were no longer receiving messages after
restoration. During restoration, the restoring device copies the
transferred database files to a special "hotswap" directory since we
don't want to overwrite our currently in-use database. Once finished, it
re-opens the database pointing to our hotswap directory. It would then
move the hotswap database to its primary location on the next app
launch.

The problem here is our extensions don't know how to read the hotswap
directory. Even if we added that capability, it's going to be tricky to
coordinate which database they read and when as the main app shuffles
files around.

This fix adjusts our restoration flow. Instead of having a special
"primary" and "hotswap" directory that we need to fix up on the next
launch, we instead record a UserDefaults entry that points to our
current database directory.

Once transfer has completed, the main app only needs to update the
current database directory in UserDefaults. No post-launch swapping
needs to occur.

Extensions will listen for updates to this database location by
registering KVO on NSUserDefaults.

This change also adjusts the restoration flow to break it up into
discrete stages. The motivation here is we need to make sure that a
partial restoration doesn't put the extensions in an inconsistent state.
2021-10-04 09:53:35 -03:00
Matthew Chen
e70302ac8f Refine NSE completion blocking, message processing. 2021-09-27 19:04:46 -03:00
Matthew Chen
7356ee90dc Deduplication message decryption to avoid spurious errors when NSE and main app message processing race. 2021-09-22 12:05:28 -07:00
Michelle Linington
51f3a58a61 Message send log recording and resend responses 2021-07-21 22:58:51 -07:00
Matthew Chen
2a0ebc0afe Merge branch 'release/5.16.0' 2021-07-09 15:49:59 -03:00
Matthew Chen
27459a0e2b Respond to CR. 2021-07-09 15:47:10 -03:00
Matthew Chen
587f80969a Fix deadlock crash in DatabaseChangeObserver. 2021-07-09 13:32:19 -03:00
Matthew Chen
89a5dea49b Use file coordinator to protect database creation. 2021-07-08 17:40:45 -03:00
Matthew Chen
d230c45c4c Refine isCheckpointing flag. 2021-07-08 17:35:31 -03:00
Matthew Chen
4f17b816c9 Rework database checkpointing. 2021-07-08 17:35:31 -03:00
Matthew Chen
64309341c6 Rework database checkpointing. 2021-07-08 17:35:31 -03:00
Matthew Chen
a444862311 Rework database checkpointing. 2021-07-08 17:35:31 -03:00
Matthew Chen
6f232977ea Rework database checkpointing. 2021-07-08 17:35:31 -03:00
Matthew Chen
a30400af64 Rework database checkpointing. 2021-07-08 17:35:31 -03:00
Matthew Chen
78fd304b74 Respond to CR. 2021-07-02 22:15:07 -03:00
Matthew Chen
f2b76e60f9 Refine names. 2021-07-02 22:08:53 -03:00
Matthew Chen
103d0d0942 Remove uiRead(). 2021-07-02 22:04:58 -03:00
Matthew Chen
c403dee9c2 Remove uiRead(). 2021-07-02 22:04:58 -03:00
Matthew Chen
f06b72bc2a Remove uiRead(). 2021-07-02 22:04:58 -03:00
Matthew Chen
f65d6e8e2d Remove uiRead(). 2021-07-02 22:04:58 -03:00
Matthew Chen
d6a03a4770 Remove uiRead(). 2021-07-02 22:04:58 -03:00
Matthew Chen
d2f75a81a8 Remove uiRead(). 2021-07-02 22:04:58 -03:00
Matthew Chen
d4d96d698f Remove uiRead(). 2021-07-02 22:04:58 -03:00
Matthew Chen
a314ad2432 Remove uiRead(). 2021-07-02 22:04:58 -03:00
Matthew Chen
03acf2ffdd Remove uiRead(). 2021-07-02 22:04:58 -03:00
Matthew Chen
03cc35819e Remove uiRead(). 2021-07-02 22:04:58 -03:00
Nora Trapp
e439bb619e Move isArchived, isMarkedUnread, and mutedUntilDate off of TSThread 2021-05-13 12:54:33 -07:00
Nora Trapp
bf660c85ce Add TSGroupMember table to allow performant querying of group membership 2021-04-08 13:44:00 -07:00
Matthew Chen
a00d14ddc4 Payments: Models 2021-04-06 13:57:06 -03:00
Nora Trapp
0ef7fc24e6 Revert database recovery attempts, just flag when we detect corruption and prevent app launch. 2021-04-01 12:50:41 -07:00
Nora Trapp
722675525d Change device transfer hotswap to avoid database corruption. 2021-04-01 12:50:41 -07:00
Nora Trapp
db5532b590 protect database recovery from orphan data cleaner 2021-04-01 12:50:41 -07:00
Nora Trapp
0fee67ae60 Attempt to recover database if corruption was detected 2021-04-01 12:50:41 -07:00
Matthew Chen
86b8eb08b8 Remove YapDatabase.
Apply asset from design.

Fix rebase breakage.
2021-03-25 11:41:16 -03:00
Matthew Chen
d0cbf8cfd0 Rework dependency access. 2021-03-25 09:24:27 -03:00
Jordan Rose
15a4a1a9cd MediaGallery: delete old Finder API, including its Yap implementation 2021-03-04 10:30:54 -08:00
Jordan Rose
26037ff8f4 Database: Remove @escaping from all synchronous transaction callbacks 2021-03-04 10:30:54 -08:00
Matthew Chen
d82b6f8250 Create a new GRDB storage adapter after grdb schema migrations. 2021-01-27 09:45:12 -03:00
Matthew Chen
f7ec15b808 Refine query filtering. 2020-12-23 18:14:32 -03:00
Matthew Chen
111338b59d Rewrite conversation view. 2020-12-10 12:44:13 -03:00
Matthew Chen
13e7456d22 Fix some of the performance tests. 2020-10-16 10:15:16 -03:00
Michelle Linington
7494eed9cc PR Feedback, update schema_dump to support sqlclient updates 2020-08-20 13:07:23 -07:00
Michelle Linington
c0dee48b37 IOS-784: Improvements to sqlclient script
This change makes the debug the sqlcipher database with command line
much easier. Leverages simctl to make simulator discovery and
introspection super straightforward
2020-08-20 13:07:23 -07:00
Nora Trapp
427f42874d Track who was mentioned in a given message in a queryable way 2020-08-04 14:09:06 -07:00
Matthew Chen
a261fcda06 Fix database issues around device transfer. 2020-07-03 16:07:30 -03:00
Matthew Chen
3cedd3ccdf Overhaul database observation. 2020-06-18 09:28:49 -03:00
Matthew Chen
577b0acf20 Merge remote-tracking branch 'private/release/3.10.6' into release/3.11.0 2020-06-11 15:33:09 -03:00
Matthew Chen
62de796e54 Deduplicate thread touches by deferring them until the transaction is finalized. 2020-06-11 13:18:49 -03:00
Matthew Chen
77531974d3 Deduplicate thread touches by deferring them until the transaction is finalized. 2020-06-11 13:18:49 -03:00
Matthew Chen
24cc82d125 Rework ReadModelCache to honor uiRead update cycle. 2020-06-08 17:37:05 -03:00
Matthew Chen
9e6e53723a Merge branch 'release/3.10.3' into release/3.11.0 2020-06-07 12:15:29 -03:00
Matthew Chen
67a773e6fe Use display link to push database snapshot updates. 2020-06-07 12:05:21 -03:00
Matthew Chen
d788c74a0c Rework ReadModelCache to honor uiRead update cycle. 2020-06-07 11:22:32 -03:00
Matthew Chen
d2bd295767 Respond to CR. 2020-06-07 11:20:54 -03:00
Matthew Chen
75842cdc2e Improve db logging. 2020-06-07 11:20:54 -03:00
Matthew Chen
6dd230c640 Move checkpoints to a dedicated DatabaseQueue. 2020-06-05 16:32:58 -03:00
Matthew Chen
a96d16bf7b Move checkpoints to a dedicated DatabaseQueue. 2020-06-05 16:32:58 -03:00
Matthew Chen
b7eb6284a8 Move checkpoints to a dedicated DatabaseQueue. 2020-06-05 11:41:44 -03:00
Matthew Chen
b1d1d12cca Move checkpoints to a dedicated DatabaseQueue. 2020-06-05 11:41:44 -03:00
Nora Trapp
59c0f9d091 Device Transfer Service 2020-05-18 20:48:08 -07:00
Nora Trapp
f0d7a9cb9c Add early message handling for delivery receipts, reactions, and delete for everyone 2020-04-16 19:44:45 -07:00
Matthew Chen
0b7cc8cc00 Tune crash reporting around GRDB initialization failures. 2020-04-02 14:46:18 -03:00
Michael Kirk
2bed5d0cc3 persist pending read receipts 2020-02-16 13:13:12 -07:00
Matthew Chen
892ce5c135 Rework message processing to handle groups v2. 2020-01-17 17:34:37 -03:00
Matthew Chen
4ce61eb741 Respond to CR. 2020-01-16 18:04:57 -03:00
Matthew Chen
41f314ba1f Respond to CR. 2020-01-16 17:44:56 -03:00
Michael Kirk
11575926b1 remove unused ContactQuery 2020-01-15 14:28:04 -07:00
Matthew Chen
7758bc619b Log GRDB SQL syntax errors in DEBUG builds. 2019-12-04 10:44:20 -03:00
Nora Trapp
87ecf90bee Merge branch 'release/3.0.0' 2019-11-20 16:46:39 -08:00
Michael Kirk
52b38f8769 redundantly clean up gallery items when clearing all content 2019-11-19 11:01:31 -07:00
Nora Trapp
14c8f4175e Add Reaction Model 2019-11-14 13:22:47 -08:00
Matthew Chen
e46eefe50e Remove readReturningResult(). 2019-11-14 10:39:33 -03:00
Nora Trapp
fbdafc6bd5 Store KBS keys in the database instead of the keychain 2019-11-13 10:48:36 -03:00
Matthew Chen
c080ee78f6 Try restart checkpoints. 2019-11-06 21:33:53 -03:00
Matthew Chen
c39844b93e Respond to CR. 2019-10-28 15:24:06 -03:00
Matthew Chen
18a1135058 Clean up before PR. 2019-10-28 15:16:44 -03:00
Matthew Chen
e390d8a5fa Truncate checkpoint on app launch. 2019-10-28 15:16:44 -03:00
Matthew Chen
351ac3ce49 Truncate checkpoint on app launch. 2019-10-28 15:16:43 -03:00
Matthew Chen
b2dd31eb9c Merge remote-tracking branch 'private/release/2.45.0' 2019-10-24 15:42:39 -03:00
Matthew Chen
2d8c183afd Use IMMEDIATE write transactions. 2019-10-24 13:58:53 -03:00
Michael Kirk
a1ebb6cf76 log sql with regular logger, but only in dev-qa 2019-10-21 14:10:44 -06:00
Michael Kirk
de39cdd983 redact data blobs in sql logger 2019-10-21 14:10:44 -06:00
Nora Trapp
fef0a2ffbf Revert "Merge branch 'nt/ipad-split-view'"
This reverts commit 3c9a3f8f21, reversing
changes made to 9a2645497e.
2019-10-21 12:35:02 -07:00
Matthew Chen
cf8e7d862e Respond to CR. 2019-10-17 10:25:13 -03:00
Matthew Chen
9a3cbc573b Refine storage modes. 2019-10-16 16:28:28 -03:00
Michael Kirk
3092bdf540 intern initial schema 2019-10-11 10:47:44 -07:00
Matthew Chen
5c5deae922 Respond to CR. 2019-10-11 09:31:35 -03:00
Matthew Chen
91dab4e9cd Respond to CR. 2019-10-11 09:31:35 -03:00
Matthew Chen
06e310d391 Rework thread mapping updates. 2019-10-11 09:31:35 -03:00
Matthew Chen
c3ab297ecc Refine indices. 2019-10-09 16:09:34 -03:00
Matthew Chen
48887fca46 Fix "unread" and "unseen" queries in GRDB. 2019-10-09 16:09:34 -03:00