File tree 3 files changed +11
-3
lines changed
3 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -135,7 +135,7 @@ def push_project_async(mc, directory):
135
135
for file in upload_files :
136
136
# do checkpoint to push changes from wal file to gpkg if there is no diff
137
137
if "diff" not in file and mp .is_versioned_file (file ["path" ]):
138
- do_sqlite_checkpoint (mp .fpath (file ["path" ]))
138
+ do_sqlite_checkpoint (mp .fpath (file ["path" ]), mp . log )
139
139
file ["checksum" ] = generate_checksum (mp .fpath (file ["path" ]))
140
140
file ['location' ] = mp .fpath_meta (file ['diff' ]['path' ]) if 'diff' in file else mp .fpath (file ['path' ])
141
141
Original file line number Diff line number Diff line change @@ -289,7 +289,7 @@ def get_push_changes(self):
289
289
changes = self .compare_file_sets (self .metadata ['files' ], self .inspect_files ())
290
290
# do checkpoint to push changes from wal file to gpkg
291
291
for file in changes ['added' ] + changes ['updated' ]:
292
- size , checksum = do_sqlite_checkpoint (self .fpath (file ["path" ]))
292
+ size , checksum = do_sqlite_checkpoint (self .fpath (file ["path" ]), self . log )
293
293
if size and checksum :
294
294
file ["size" ] = size
295
295
file ["checksum" ] = checksum
Original file line number Diff line number Diff line change @@ -69,25 +69,33 @@ def int_version(version):
69
69
return int (version .lstrip ('v' )) if re .match (r'v\d' , version ) else None
70
70
71
71
72
- def do_sqlite_checkpoint (path ):
72
+ def do_sqlite_checkpoint (path , log = None ):
73
73
"""
74
74
Function to do checkpoint over the geopackage file which was not able to do diff file.
75
75
76
76
:param path: file's absolute path on disk
77
77
:type path: str
78
+ :param log: optional reference to a logger
79
+ :type log: logging.Logger
78
80
:returns: new size and checksum of file after checkpoint
79
81
:rtype: int, str
80
82
"""
81
83
new_size = None
82
84
new_checksum = None
83
85
if ".gpkg" in path and os .path .exists (f'{ path } -wal' ):
86
+ if log :
87
+ log .info ("checkpoint - going to add it in " + path )
84
88
conn = sqlite3 .connect (path )
85
89
cursor = conn .cursor ()
86
90
cursor .execute ("PRAGMA wal_checkpoint=FULL" )
91
+ if log :
92
+ log .info ("checkpoint - return value: " + str (cursor .fetchone ()))
87
93
cursor .execute ("VACUUM" )
88
94
conn .commit ()
89
95
conn .close ()
90
96
new_size = os .path .getsize (path )
91
97
new_checksum = generate_checksum (path )
98
+ if log :
99
+ log .info ("checkpoint - new size {} checksum {}" .format (new_size , new_checksum ))
92
100
93
101
return new_size , new_checksum
You can’t perform that action at this time.
0 commit comments