HomePhabricator
Diffusion Comm 12d76a161039

[native] Trace sqlite queries

Description

[native] Trace sqlite queries

Summary:
Linear task: https://linear.app/comm/issue/ENG-1603/track-every-sqlite-query-on-native

We want to keep track of every SQLite query that modifies the database so we can send it as a log to the backup service. That will allow us to recreate the database using backups.

I used sqlite3_trace_v2 for this (ref: https://www.sqlite.org/c3ref/trace_v2.html)

I temporarily added a log so the queries are printed out. I suppose we do not want to do that but I just wanted to add it to the initial state of this diff (also for testing purposes). I will replace it with something like // TODO: send logs to backup here

Test Plan: Launch the mobile app, enter a chat and start typing, you're going to see the logs starting with sql query detected: ...

Reviewers: tomek, ashoat

Reviewed By: tomek

Subscribers: ashoat, tomek, adrian, atul, abosh

Differential Revision: https://phab.comm.dev/D4826

Details

Provenance
karolAuthored on Aug 16 2022, 1:41 AM
Reviewer
tomek
Differential Revision
D4826: [native] Trace sqlite queries
Parents
rCOMM0449bea0557d: [Chore] Make shellcheck happy
Branches
Unknown
Tags
Unknown