Description
Patch by Vladimir Berezniker, available at http://www.contactor.se/~dast/svn/archive-2003-10/0669.shtml Log message: Implemented hot copy functionality for subversion. This functionality fixes two race conditions existing in hot-backup.py. Only the logs that have been successfully copied are deleted, therefore any logs modified while copy was in progress are retained. Also (svn_repos_hotcopy) takes out shared db lock, eliminating possibility of corruption, if running recovery in parallel to an automated backup. Updated hot-backup.py to wrap around the new hot copy functionality. * subversion/include/svn_error.h (SVN_ERR_POOL): Implemented macro to properly handle subversion errors in code that uses subpools. * subversion/include/svn_io.h * subversion/libsvn_subr/io.c (svn_io_file_create): Factored out function for file creation. (svn_io__file_clear_and_close): Moved from subversion/libsvn_repos/repos.c (clear_and_close). (svn_io_file_lock): Factored out function for file locking. (svn_io_dir_file_copy): Implemented function for copying a file between two directories. * subversion/include/svn_fs.h (svn_fs_hotcopy_berkeley): Added prototype for Berkeley hot copy function. * subversion/include/svn_repos.h (svn_repos_hotcopy): Added prototype for subversion repository hot copy function. * subversion/libsvn_fs/fs.c: (svn_fs__clean_logs): Implemented function that deletes only copied unused Berkeley DB logs. (svn_fs_hotcopy_berkeley): Implemented hot copy functionality in accordance with Berkeley DB documentation. * subversion/libsvn_repos/repos.h (SVN_REPOS__DB_LOGS_LOCKFILE): Added new definition for BDB logs files lock file. * subversion/libsvn_repos/repos.c (create_db_lock): Factored out function for creation of db lock file. (create_locks): Cleanup. Deleted redundant path parameter. (create_hooks): Cleanup. Deleted redundant path parameter. Updated code to use (svn_io_file_create). (hotcopy_ctx_t): New structure for use by (hotcopy_structure). (hotcopy_structure): Adapted, deleted, (copy_structure) for copying repository structure with exception of /db and /locks directories. (svn_repos_db_logs_lockfile): Implemented function to return path to db logs lock file. (create_db_logs_lock): Implemented function for creation of db logs lock file. (lock_db_logs_file): Function for locking db logs lock file. (svn_repos_hotcopy): Implemented function to make a hot copy of a repository. (get_repos): Cleanup. Updated code to use (svn_io_file_lock). (clear_and_close): Moved to subversion/libsvn_subr/io.c (svn_io__file_clear_and_close). (create_repos_structure): Cleanup. Updated code to use (svn_io_file_create). * subversion/svnadmin/main.c Added new flag "--clean-logs" to specify that unused copied logs are to be deleted after the hot copy is complete. (parse_local_repos_path): Factored out function for parsing and validating local repository path. (subcommand_hotcopy): Implemented new hotcopy subcommand. * tools/backup/hot-backup.py.in Updated hot backup script to utilize the new hot copy functionality.
http://www.contactor.se/~dast/svn/archive-2003-10/0669.shtml
Original issue reported by sander