You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2011/09/06 17:13:07 UTC
svn commit: r1165700 - in
/subversion/branches/fs-successor-ids/subversion/libsvn_fs_fs: fs.h fs_fs.c
Author: stsp
Date: Tue Sep 6 15:13:07 2011
New Revision: 1165700
URL: http://svn.apache.org/viewvc?rev=1165700&view=rev
Log:
On the fs-successor-ids branch, bump the FSFS format number and create
successor directories in newly created repositories.
Thwart attempts to upgrade existing repositories to the new format for now
and suggest a dump/load cycle as a workaround.
We still need to decide how to perform upgrades to this format.
(This upgrade can take some time. At the very least we'll need some
kind of progress reporting.)
* subversion/libsvn_fs_fs/fs.h
(PATH_SUCCESSORS_TOP_DIR, PATH_SUCCESSORS_NODE_REVS_DIR,
PATH_SUCCESSORS_REVISIONS_DIR, PATH_SUCCESSORS_IDS_DIR,
SVN_FS_FS__MIN_SUCCESSORS_FORMAT): New constants.
(SVN_FS_FS__FORMAT_NUMBER): Bump from 4 to 6 (5 is reserved for an
unreleased temporary FSFS format).
* subversion/libsvn_fs_fs/fs_fs.c
(make_successor_ids_dirs): New. Creates successor-ID directories within
the db/successors directory.
(upgrade_body): Error on attempts to upgrade an FSFS filesystem to format 6.
(svn_fs_fs__create): Create successors dirs for filesystems with format >= 6.
Modified:
subversion/branches/fs-successor-ids/subversion/libsvn_fs_fs/fs.h
subversion/branches/fs-successor-ids/subversion/libsvn_fs_fs/fs_fs.c
Modified: subversion/branches/fs-successor-ids/subversion/libsvn_fs_fs/fs.h
URL: http://svn.apache.org/viewvc/subversion/branches/fs-successor-ids/subversion/libsvn_fs_fs/fs.h?rev=1165700&r1=1165699&r2=1165700&view=diff
==============================================================================
--- subversion/branches/fs-successor-ids/subversion/libsvn_fs_fs/fs.h (original)
+++ subversion/branches/fs-successor-ids/subversion/libsvn_fs_fs/fs.h Tue Sep 6 15:13:07 2011
@@ -82,10 +82,16 @@ extern "C" {
#define CONFIG_SECTION_REP_SHARING "rep-sharing"
#define CONFIG_OPTION_ENABLE_REP_SHARING "enable-rep-sharing"
+/* Names for successors directories. */
+#define PATH_SUCCESSORS_TOP_DIR "successors"
+#define PATH_SUCCESSORS_NODE_REVS_DIR "node-revs"
+#define PATH_SUCCESSORS_REVISIONS_DIR "revs"
+#define PATH_SUCCESSORS_IDS_DIR "ids"
+
/* The format number of this filesystem.
This is independent of the repository format number, and
independent of any other FS back ends. */
-#define SVN_FS_FS__FORMAT_NUMBER 4
+#define SVN_FS_FS__FORMAT_NUMBER 6
/* The minimum format number that supports svndiff version 1. */
#define SVN_FS_FS__MIN_SVNDIFF1_FORMAT 2
@@ -117,6 +123,9 @@ extern "C" {
/* The minimum format number that stores node kinds in changed-paths lists. */
#define SVN_FS_FS__MIN_KIND_IN_CHANGED_FORMAT 4
+/* The minimum format number that supports successor-IDs.*/
+#define SVN_FS_FS__MIN_SUCCESSORS_FORMAT 6
+
/* Private FSFS-specific data shared between all svn_txn_t objects that
relate to a particular transaction in a filesystem (as identified
by transaction id and filesystem UUID). Objects of this type are
Modified: subversion/branches/fs-successor-ids/subversion/libsvn_fs_fs/fs_fs.c
URL: http://svn.apache.org/viewvc/subversion/branches/fs-successor-ids/subversion/libsvn_fs_fs/fs_fs.c?rev=1165700&r1=1165699&r2=1165700&view=diff
==============================================================================
--- subversion/branches/fs-successor-ids/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/branches/fs-successor-ids/subversion/libsvn_fs_fs/fs_fs.c Tue Sep 6 15:13:07 2011
@@ -1224,6 +1224,26 @@ create_file_ignore_eexist(const char *fi
}
static svn_error_t *
+make_successor_ids_dirs(svn_fs_t *fs, apr_pool_t *pool)
+{
+ const char *top_dir = svn_dirent_join(fs->path, PATH_SUCCESSORS_TOP_DIR,
+ pool);
+ const char *node_revs_dir = svn_dirent_join(top_dir,
+ PATH_SUCCESSORS_NODE_REVS_DIR,
+ pool);
+ const char *revs_dir = svn_dirent_join(top_dir,
+ PATH_SUCCESSORS_REVISIONS_DIR, pool);
+ const char *data_dir = svn_dirent_join(top_dir, PATH_SUCCESSORS_IDS_DIR,
+ pool);
+
+ SVN_ERR(svn_io_make_dir_recursively(node_revs_dir, pool));
+ SVN_ERR(svn_io_make_dir_recursively(revs_dir, pool));
+ SVN_ERR(svn_io_make_dir_recursively(data_dir, pool));
+
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
upgrade_body(void *baton, apr_pool_t *pool)
{
svn_fs_t *fs = baton;
@@ -1237,6 +1257,20 @@ upgrade_body(void *baton, apr_pool_t *po
if (format == SVN_FS_FS__FORMAT_NUMBER)
return SVN_NO_ERROR;
+ /* ### We don't [yet] support upgrades to formats that support successor-IDs.
+ * ### We'd need to parse all node-revisions to create successor-ID data.
+ * ### This could be done, but for now, we punt. */
+ if (SVN_FS_FS__FORMAT_NUMBER >= SVN_FS_FS__MIN_SUCCESSORS_FORMAT &&
+ format < SVN_FS_FS__MIN_SUCCESSORS_FORMAT)
+ {
+ return svn_error_createf(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
+ _("Upgrading FSFS filesystems to format %d is "
+ "not supported; please dump this repository "
+ "and load the dump file into a new "
+ "repository"),
+ SVN_FS_FS__MIN_SUCCESSORS_FORMAT);
+ }
+
/* If our filesystem predates the existance of the 'txn-current
file', make that file and its corresponding lock file. */
if (format < SVN_FS_FS__MIN_TXN_CURRENT_FORMAT)
@@ -6266,6 +6300,10 @@ svn_fs_fs__create(svn_fs_t *fs,
"", pool));
}
+ /* Create successor data dirs if the filesystem supports successors. */
+ if (format >= SVN_FS_FS__MIN_SUCCESSORS_FORMAT)
+ SVN_ERR(make_successor_ids_dirs(fs, pool));
+
/* This filesystem is ready. Stamp it with a format number. */
SVN_ERR(write_format(path_format(fs, pool),
ffd->format, ffd->max_files_per_dir, FALSE, pool));