Alien-SVN
view release on metacpan or search on metacpan
src/subversion/subversion/libsvn_fs_base/fs.c view on Meta::CPAN
if ((read_err = svn_io_file_read(s, buf, &bytes_this_time, pool)))
{
if (APR_STATUS_IS_EOF(read_err->apr_err))
svn_error_clear(read_err);
else
{
svn_error_clear(svn_io_file_close(s, pool));
svn_error_clear(svn_io_file_close(d, pool));
return read_err;
}
}
/* Write 'em. */
if ((write_err = svn_io_file_write_full(d, buf, bytes_this_time, NULL,
pool)))
{
svn_error_clear(svn_io_file_close(s, pool));
svn_error_clear(svn_io_file_close(d, pool));
return write_err;
}
/* read_err is either NULL, or a dangling pointer - but it is only a
dangling pointer if it used to be an EOF error. */
if (read_err)
{
SVN_ERR(svn_io_file_close(s, pool));
SVN_ERR(svn_io_file_close(d, pool));
break; /* got EOF on read, all files closed, all done. */
}
}
return SVN_NO_ERROR;
}
static svn_error_t *
base_hotcopy(svn_fs_t *src_fs,
svn_fs_t *dst_fs,
const char *src_path,
const char *dest_path,
svn_boolean_t clean_logs,
svn_boolean_t incremental,
svn_cancel_func_t cancel_func,
void *cancel_baton,
apr_pool_t *pool)
{
svn_error_t *err;
u_int32_t pagesize;
svn_boolean_t log_autoremove = FALSE;
int format;
if (incremental)
return svn_error_createf(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
_("BDB repositories do not support incremental "
"hotcopy"));
/* Check the FS format number to be certain that we know how to
hotcopy this FS. Pre-1.2 filesystems did not have a format file (you
could say they were format "0"), so we will error here. This is not
optimal, but since this has been the case since 1.2.0, and no one has
complained, it apparently isn't much of a concern. (We did not check
the 'format' file in 1.2.x, but we did blindly try to copy 'locks',
which would have errored just the same.) */
SVN_ERR(svn_io_read_version_file(
&format, svn_dirent_join(src_path, FORMAT_FILE, pool), pool));
SVN_ERR(check_format(format));
/* If using Berkeley DB 4.2 or later, note whether the DB_LOG_AUTO_REMOVE
feature is on. If it is, we have a potential race condition:
another process might delete a logfile while we're in the middle
of copying all the logfiles. (This is not a huge deal; at worst,
the hotcopy fails with a file-not-found error.) */
#if SVN_BDB_VERSION_AT_LEAST(4, 2)
err = check_env_flags(&log_autoremove,
#if SVN_BDB_VERSION_AT_LEAST(4, 7)
DB_LOG_AUTO_REMOVE,
/* DB_LOG_AUTO_REMOVE was named DB_LOG_AUTOREMOVE before Berkeley DB 4.7. */
#else
DB_LOG_AUTOREMOVE,
#endif
src_path, pool);
#endif
SVN_ERR(err);
/* Copy the DB_CONFIG file. */
SVN_ERR(svn_io_dir_file_copy(src_path, dest_path, "DB_CONFIG", pool));
/* In order to copy the database files safely and atomically, we
must copy them in chunks which are multiples of the page-size
used by BDB. See sleepycat docs for details, or svn issue #1818. */
#if SVN_BDB_VERSION_AT_LEAST(4, 2)
SVN_ERR(get_db_pagesize(&pagesize, src_path, pool));
if (pagesize < SVN__STREAM_CHUNK_SIZE)
{
/* use the largest multiple of BDB pagesize we can. */
int multiple = SVN__STREAM_CHUNK_SIZE / pagesize;
pagesize *= multiple;
}
#else
/* default to 128K chunks, which should be safe.
BDB almost certainly uses a power-of-2 pagesize. */
pagesize = (4096 * 32);
#endif
/* Copy the databases. */
SVN_ERR(copy_db_file_safely(src_path, dest_path,
"nodes", pagesize, FALSE, pool));
SVN_ERR(copy_db_file_safely(src_path, dest_path,
"transactions", pagesize, FALSE, pool));
SVN_ERR(copy_db_file_safely(src_path, dest_path,
"revisions", pagesize, FALSE, pool));
SVN_ERR(copy_db_file_safely(src_path, dest_path,
"copies", pagesize, FALSE, pool));
SVN_ERR(copy_db_file_safely(src_path, dest_path,
"changes", pagesize, FALSE, pool));
SVN_ERR(copy_db_file_safely(src_path, dest_path,
"representations", pagesize, FALSE, pool));
SVN_ERR(copy_db_file_safely(src_path, dest_path,
"strings", pagesize, FALSE, pool));
( run in 0.328 second using v1.01-cache-2.11-cpan-483215c6ad5 )