File tree Expand file tree Collapse file tree 3 files changed +11
-3
lines changed
Expand file tree Collapse file tree 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):
135135 for file in upload_files :
136136 # do checkpoint to push changes from wal file to gpkg if there is no diff
137137 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 )
139139 file ["checksum" ] = generate_checksum (mp .fpath (file ["path" ]))
140140 file ['location' ] = mp .fpath_meta (file ['diff' ]['path' ]) if 'diff' in file else mp .fpath (file ['path' ])
141141
Original file line number Diff line number Diff line change @@ -289,7 +289,7 @@ def get_push_changes(self):
289289 changes = self .compare_file_sets (self .metadata ['files' ], self .inspect_files ())
290290 # do checkpoint to push changes from wal file to gpkg
291291 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 )
293293 if size and checksum :
294294 file ["size" ] = size
295295 file ["checksum" ] = checksum
Original file line number Diff line number Diff line change @@ -69,25 +69,33 @@ def int_version(version):
6969 return int (version .lstrip ('v' )) if re .match (r'v\d' , version ) else None
7070
7171
72- def do_sqlite_checkpoint (path ):
72+ def do_sqlite_checkpoint (path , log = None ):
7373 """
7474 Function to do checkpoint over the geopackage file which was not able to do diff file.
7575
7676 :param path: file's absolute path on disk
7777 :type path: str
78+ :param log: optional reference to a logger
79+ :type log: logging.Logger
7880 :returns: new size and checksum of file after checkpoint
7981 :rtype: int, str
8082 """
8183 new_size = None
8284 new_checksum = None
8385 if ".gpkg" in path and os .path .exists (f'{ path } -wal' ):
86+ if log :
87+ log .info ("checkpoint - going to add it in " + path )
8488 conn = sqlite3 .connect (path )
8589 cursor = conn .cursor ()
8690 cursor .execute ("PRAGMA wal_checkpoint=FULL" )
91+ if log :
92+ log .info ("checkpoint - return value: " + str (cursor .fetchone ()))
8793 cursor .execute ("VACUUM" )
8894 conn .commit ()
8995 conn .close ()
9096 new_size = os .path .getsize (path )
9197 new_checksum = generate_checksum (path )
98+ if log :
99+ log .info ("checkpoint - new size {} checksum {}" .format (new_size , new_checksum ))
92100
93101 return new_size , new_checksum
You can’t perform that action at this time.
0 commit comments