Return-Path: X-Original-To: apmail-subversion-commits-archive@minotaur.apache.org Delivered-To: apmail-subversion-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id ABA6817B89 for ; Sat, 11 Oct 2014 16:14:50 +0000 (UTC) Received: (qmail 64513 invoked by uid 500); 11 Oct 2014 16:14:50 -0000 Delivered-To: apmail-subversion-commits-archive@subversion.apache.org Received: (qmail 64479 invoked by uid 500); 11 Oct 2014 16:14:50 -0000 Mailing-List: contact commits-help@subversion.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@subversion.apache.org Delivered-To: mailing list commits@subversion.apache.org Received: (qmail 64469 invoked by uid 99); 11 Oct 2014 16:14:50 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 11 Oct 2014 16:14:50 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 11 Oct 2014 16:14:48 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id E599723888D7; Sat, 11 Oct 2014 16:14:28 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1631075 - in /subversion/trunk/subversion: libsvn_fs_fs/fs.h libsvn_fs_fs/fs_fs.c libsvn_fs_fs/structure libsvn_fs_fs/util.c tests/libsvn_fs/fs-test.c Date: Sat, 11 Oct 2014 16:14:28 -0000 To: commits@subversion.apache.org From: stefan2@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20141011161428.E599723888D7@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: stefan2 Date: Sat Oct 11 16:14:28 2014 New Revision: 1631075 URL: http://svn.apache.org/r1631075 Log: Make FSFS format 7 use a different name for the 'transactions' folder. This is somewhat similar to what happened during the f1/f2->f3 upgrade which made old code either succeed with a commit or fail in various places when the format upgrade already had an impact on the contents. With this change, however, old servers will not be able to even access txns after the upgrade and will consistently see ENOENT errors. Hence, they can't write to the repo. New servers will only be able to continue transactions after a hot upgrade when they refresh their format info as done in e.g. r1627949. * subversion/libsvn_fs_fs/fs.h (PATH_TXNS_DIR): Document that this is only valid for pre-f7 repos. (PATH_TXNS_LA_DIR): New path constant. * subversion/libsvn_fs_fs/fs_fs.c (upgrade_body): Rename the txns dir if the repo has been pre-f7. Be sure to revert that if the upgrade process failed. * subversion/libsvn_fs_fs/util.c (svn_fs_fs__path_txns_dir): Return the now format-dependent txns folder. * subversion/libsvn_fs_fs/structure (Layout of the FS directory): Document how the txns folder name depends on the repo format. * subversion/tests/libsvn_fs/fs-test.c (upgrade_while_committing): Adapt test case. Any txn access with an outdated svn_fs_t will now fail with ENOENT. Modified: subversion/trunk/subversion/libsvn_fs_fs/fs.h subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c subversion/trunk/subversion/libsvn_fs_fs/structure subversion/trunk/subversion/libsvn_fs_fs/util.c subversion/trunk/subversion/tests/libsvn_fs/fs-test.c Modified: subversion/trunk/subversion/libsvn_fs_fs/fs.h URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/fs.h?rev=1631075&r1=1631074&r2=1631075&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_fs_fs/fs.h (original) +++ subversion/trunk/subversion/libsvn_fs_fs/fs.h Sat Oct 11 16:14:28 2014 @@ -58,7 +58,10 @@ extern "C" { #define PATH_PACK_LOCK_FILE "pack-lock" /* Pack lock file */ #define PATH_REVS_DIR "revs" /* Directory of revisions */ #define PATH_REVPROPS_DIR "revprops" /* Directory of revprops */ -#define PATH_TXNS_DIR "transactions" /* Directory of transactions */ +#define PATH_TXNS_DIR "transactions" /* Directory of transactions in + repos w/o log addressing */ +#define PATH_TXNS_LA_DIR "transactions-la" /* Directory of transactions in + repos with log addressing */ #define PATH_NODE_ORIGINS_DIR "node-origins" /* Lazy node-origin cache */ #define PATH_TXN_PROTOS_DIR "txn-protorevs" /* Directory of proto-revs */ #define PATH_TXN_CURRENT "txn-current" /* File with next txn key */ Modified: subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c?rev=1631075&r1=1631074&r2=1631075&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c (original) +++ subversion/trunk/subversion/libsvn_fs_fs/fs_fs.c Sat Oct 11 16:14:28 2014 @@ -1177,6 +1177,8 @@ upgrade_body(void *baton, apr_pool_t *po const char *format_path = path_format(fs, pool); svn_node_kind_t kind; svn_boolean_t needs_revprop_shard_cleanup = FALSE; + svn_error_t* err; + const char *txns_dir; /* Read the FS format number and max-files-per-dir setting. */ SVN_ERR(read_format(&format, &max_files_per_dir, &min_log_addressing_rev, @@ -1204,6 +1206,9 @@ upgrade_body(void *baton, apr_pool_t *po if (format == SVN_FS_FS__FORMAT_NUMBER) return SVN_NO_ERROR; + /* Remember the current 'transactions' dir path */ + txns_dir = svn_fs_fs__path_txns_dir(fs, pool); + /* If our filesystem predates the existence of the 'txn-current file', make that file and its corresponding lock file. */ if (format < SVN_FS_FS__MIN_TXN_CURRENT_FORMAT) @@ -1269,13 +1274,31 @@ upgrade_body(void *baton, apr_pool_t *po accidentally uses outdated information. Keep the UUID. */ SVN_ERR(svn_fs_fs__set_uuid(fs, fs->uuid, NULL, pool)); + /* Rename the 'transactions' folder */ + if (format < SVN_FS_FS__MIN_LOG_ADDRESSING_FORMAT) + SVN_ERR(svn_io_file_rename(txns_dir, svn_fs_fs__path_txns_dir(fs, pool), + pool)); + /* Bump the format file. */ - SVN_ERR(svn_fs_fs__write_format(fs, TRUE, pool)); - if (upgrade_baton->notify_func) - SVN_ERR(upgrade_baton->notify_func(upgrade_baton->notify_baton, - SVN_FS_FS__FORMAT_NUMBER, - svn_fs_upgrade_format_bumped, - pool)); + err = svn_fs_fs__write_format(fs, TRUE, pool); + if (err) + { + /* Something went wrong at the last minute. + * Undo the 'transactions' dir rename. */ + if (format < SVN_FS_FS__MIN_LOG_ADDRESSING_FORMAT) + svn_error_compose(err, + svn_io_file_rename(svn_fs_fs__path_txns_dir(fs, + pool), + txns_dir, pool)); + + SVN_ERR(err); + } + else + if (upgrade_baton->notify_func) + SVN_ERR(upgrade_baton->notify_func(upgrade_baton->notify_baton, + SVN_FS_FS__FORMAT_NUMBER, + svn_fs_upgrade_format_bumped, + pool)); /* Now, it is safe to remove the redundant revprop files. */ if (needs_revprop_shard_cleanup) Modified: subversion/trunk/subversion/libsvn_fs_fs/structure URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/structure?rev=1631075&r1=1631074&r2=1631075&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_fs_fs/structure (original) +++ subversion/trunk/subversion/libsvn_fs_fs/structure Sat Oct 11 16:14:28 2014 @@ -44,7 +44,9 @@ repository) is: . Pack file, if the repository has been packed (see below) manifest Pack manifest file, if a pack file exists (see below) revprops.db SQLite database of the packed revision properties - transactions/ Subdirectory containing transactions + transactions/ Subdirectory containing transactions (format 1 to 6) + .txn/ Directory containing transaction + transactions-la/ Subdirectory containing transactions (format 7+) .txn/ Directory containing transaction txn-protorevs/ Subdirectory containing transaction proto-revision files .rev Proto-revision file for transaction Modified: subversion/trunk/subversion/libsvn_fs_fs/util.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_fs/util.c?rev=1631075&r1=1631074&r2=1631075&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_fs_fs/util.c (original) +++ subversion/trunk/subversion/libsvn_fs_fs/util.c Sat Oct 11 16:14:28 2014 @@ -237,7 +237,11 @@ const char * svn_fs_fs__path_txns_dir(svn_fs_t *fs, apr_pool_t *pool) { - return svn_dirent_join(fs->path, PATH_TXNS_DIR, pool); + fs_fs_data_t *ffd = fs->fsap_data; + + return ffd->format >= SVN_FS_FS__MIN_LOG_ADDRESSING_FORMAT + ? svn_dirent_join(fs->path, PATH_TXNS_LA_DIR, pool) + : svn_dirent_join(fs->path, PATH_TXNS_DIR, pool); } const char * Modified: subversion/trunk/subversion/tests/libsvn_fs/fs-test.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_fs/fs-test.c?rev=1631075&r1=1631074&r2=1631075&view=diff ============================================================================== --- subversion/trunk/subversion/tests/libsvn_fs/fs-test.c (original) +++ subversion/trunk/subversion/tests/libsvn_fs/fs-test.c Sat Oct 11 16:14:28 2014 @@ -5411,7 +5411,7 @@ upgrade_while_committing(const svn_test_ svn_fs_t *fs; svn_revnum_t head_rev = 0; svn_fs_root_t *root; - svn_fs_txn_t *txn; + svn_fs_txn_t *txn1, *txn2; const char *fs_path; apr_hash_t *fs_config = apr_hash_make(pool); @@ -5432,21 +5432,24 @@ upgrade_while_committing(const svn_test_ SVN_ERR(svn_test__create_fs2(&fs, fs_path, opts, fs_config, pool)); SVN_ERR(svn_fs_open(&fs, fs_path, NULL, pool)); - SVN_ERR(svn_fs_begin_txn(&txn, fs, head_rev, pool)); - SVN_ERR(svn_fs_txn_root(&root, txn, pool)); + SVN_ERR(svn_fs_begin_txn(&txn1, fs, head_rev, pool)); + SVN_ERR(svn_fs_txn_root(&root, txn1, pool)); SVN_ERR(svn_test__create_greek_tree(root, pool)); - SVN_ERR(test_commit_txn(&head_rev, txn, NULL, pool)); + SVN_ERR(test_commit_txn(&head_rev, txn1, NULL, pool)); + + /* Create txn with changes. */ + SVN_ERR(svn_fs_begin_txn(&txn1, fs, head_rev, pool)); + SVN_ERR(svn_fs_txn_root(&root, txn1, pool)); + SVN_ERR(svn_fs_make_dir(root, "/foo", pool)); /* Upgrade filesystem, but keep existing svn_fs_t object. */ SVN_ERR(svn_fs_upgrade(fs_path, pool)); - /* Create txn with changes. */ - SVN_ERR(svn_fs_begin_txn(&txn, fs, head_rev, pool)); - SVN_ERR(svn_fs_txn_root(&root, txn, pool)); - SVN_ERR(svn_fs_make_dir(root, "/foo", pool)); + /* Creating a new txn for the old svn_fs_t object shall fail. */ + SVN_TEST_ASSERT_ERROR(svn_fs_begin_txn(&txn2, fs, head_rev, pool), ENOENT); - /* Commit txn. */ - SVN_ERR(test_commit_txn(&head_rev, txn, NULL, pool)); + /* Committing the already existing txn shall fail as well. */ + SVN_TEST_ASSERT_ERROR(test_commit_txn(&head_rev, txn1, NULL, pool), ENOENT); /* Verify filesystem content. */ SVN_ERR(svn_fs_verify(fs_path, NULL, 0, SVN_INVALID_REVNUM, NULL, NULL,