Commit 65a4d56
committed
Feature: Add Connection::snapshot() for point-in-time database copy
This addresses feedback from tursodatabase/agentfs#119 suggesting that snapshot functionality should be implemented in turso.git using direct fily copying rather than SQL-based row by row copying.
Comment: https:://github.com/tursodatabase/agentfs/pull/119#issuecomment-3681336678
- extract core logic from Pager::checkpoint function to a new Pager::checkpoing_internal function and add a flag to keep_lock during the Finalize phase
- create wrapper functions Pager::checkpoint, Pager::checkpoint_with_lock and Pager::block_checkpoint_keep_lock
- add Connection::snapshot API that checkpoints while keeping the lock and copies the database file
The lock is held to avoid a race condition after finishing checkpointing and before copying the file when concurrent writers can write to db.
Signed-off-by: Prateek Singh Rathore <[email protected]>1 parent 9582043 commit 65a4d56
2 files changed
+98
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2017 | 2017 | | |
2018 | 2018 | | |
2019 | 2019 | | |
| 2020 | + | |
| 2021 | + | |
| 2022 | + | |
| 2023 | + | |
| 2024 | + | |
| 2025 | + | |
| 2026 | + | |
| 2027 | + | |
| 2028 | + | |
| 2029 | + | |
| 2030 | + | |
| 2031 | + | |
| 2032 | + | |
| 2033 | + | |
| 2034 | + | |
| 2035 | + | |
| 2036 | + | |
| 2037 | + | |
| 2038 | + | |
| 2039 | + | |
| 2040 | + | |
| 2041 | + | |
| 2042 | + | |
| 2043 | + | |
| 2044 | + | |
| 2045 | + | |
| 2046 | + | |
| 2047 | + | |
| 2048 | + | |
| 2049 | + | |
| 2050 | + | |
| 2051 | + | |
| 2052 | + | |
| 2053 | + | |
| 2054 | + | |
| 2055 | + | |
| 2056 | + | |
| 2057 | + | |
| 2058 | + | |
| 2059 | + | |
| 2060 | + | |
| 2061 | + | |
| 2062 | + | |
| 2063 | + | |
| 2064 | + | |
| 2065 | + | |
| 2066 | + | |
| 2067 | + | |
| 2068 | + | |
| 2069 | + | |
| 2070 | + | |
| 2071 | + | |
| 2072 | + | |
| 2073 | + | |
| 2074 | + | |
| 2075 | + | |
| 2076 | + | |
| 2077 | + | |
| 2078 | + | |
| 2079 | + | |
| 2080 | + | |
2020 | 2081 | | |
2021 | 2082 | | |
2022 | 2083 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2856 | 2856 | | |
2857 | 2857 | | |
2858 | 2858 | | |
| 2859 | + | |
| 2860 | + | |
| 2861 | + | |
| 2862 | + | |
| 2863 | + | |
| 2864 | + | |
| 2865 | + | |
| 2866 | + | |
| 2867 | + | |
| 2868 | + | |
| 2869 | + | |
| 2870 | + | |
| 2871 | + | |
| 2872 | + | |
| 2873 | + | |
| 2874 | + | |
| 2875 | + | |
| 2876 | + | |
| 2877 | + | |
| 2878 | + | |
| 2879 | + | |
| 2880 | + | |
2859 | 2881 | | |
2860 | 2882 | | |
2861 | 2883 | | |
2862 | 2884 | | |
2863 | 2885 | | |
2864 | 2886 | | |
2865 | | - | |
| 2887 | + | |
2866 | 2888 | | |
2867 | 2889 | | |
2868 | 2890 | | |
2869 | 2891 | | |
| 2892 | + | |
2870 | 2893 | | |
2871 | 2894 | | |
2872 | 2895 | | |
| |||
2994 | 3017 | | |
2995 | 3018 | | |
2996 | 3019 | | |
2997 | | - | |
2998 | | - | |
| 3020 | + | |
| 3021 | + | |
| 3022 | + | |
| 3023 | + | |
2999 | 3024 | | |
3000 | 3025 | | |
3001 | 3026 | | |
| |||
3092 | 3117 | | |
3093 | 3118 | | |
3094 | 3119 | | |
| 3120 | + | |
| 3121 | + | |
| 3122 | + | |
| 3123 | + | |
| 3124 | + | |
| 3125 | + | |
| 3126 | + | |
| 3127 | + | |
| 3128 | + | |
3095 | 3129 | | |
3096 | 3130 | | |
3097 | 3131 | | |
| |||
0 commit comments