On Wed, Apr 14, 2010 at 12:35, <phi...@apache.org> wrote: >... > +++ subversion/trunk/subversion/libsvn_subr/sqlite.c Wed Apr 14 16:35:11 2010 > @@ -975,23 +975,55 @@ svn_sqlite__hotcopy(const char *src_path > const char *dst_path, > apr_pool_t *scratch_pool) > { > - svn_sqlite__db_t *db; > - svn_sqlite__stmt_t *stmt; > + svn_sqlite__db_t *src_db; > > - /* The SELECT takes a shared lock in the source database which > - blocks writers and so ensures that the database won't change > - during the copy. > - > - We could use the SQLite backup interface (from 3.6.11 and still > - experimental) and the copy would be done in chunks with the lock > - released between chunks. */ > - SVN_ERR(svn_sqlite__open(&db, src_path, svn_sqlite__mode_readonly, > + SVN_ERR(svn_sqlite__open(&src_db, src_path, svn_sqlite__mode_readonly, > internal_statements, 0, NULL, > scratch_pool, scratch_pool)); > - SVN_ERR(svn_sqlite__get_statement(&stmt, db, > STMT_DUMMY_SELECT_FOR_BACKUP)); > - SVN_ERR(svn_sqlite__step_row(stmt)); > - SVN_ERR(svn_io_copy_file(src_path, dst_path, TRUE, scratch_pool)); > - SVN_ERR(svn_sqlite__close(db)); > + > +#if SQLITE_VERSION_AT_LEAST(3,6,11) > + { > + svn_sqlite__db_t *dst_db; > + sqlite3_backup *backup; > + int rc1, rc2; > + > + SVN_ERR(svn_sqlite__open(&dst_db, dst_path, svn_sqlite__mode_rwcreate, > + NULL, 0, NULL, scratch_pool, scratch_pool)); > + backup = sqlite3_backup_init(dst_db->db3, "main", src_db->db3, "main"); > + if (!backup) > + return SVN_NO_ERROR;
Shouldn't the databases be closed? If not, then why not? (ie. add a comment) >... Cheers, -g