You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2011/08/23 15:12:20 UTC
svn commit: r1160671 - in /subversion/trunk/subversion/libsvn_wc: upgrade.c
wc_db.c wc_db.h
Author: rhuijben
Date: Tue Aug 23 13:12:20 2011
New Revision: 1160671
URL: http://svn.apache.org/viewvc?rev=1160671&view=rev
Log:
Resolve issue #3994, "Subversion working copies that contain 'svn lock'-style"
locks cannot be upgraded.
Do this by using a single sqlite handle for performing upgrades from entries to
the wc-ng format. This makes it possible to use the normal svn_wc__db api while
upgrading.
This api usage used to work correctly before we optimized the performance of
upgrades by using a transaction (r1136525).
Before this patch the repository lock handling in the working copy verified if
a node existed via one sqlite handle, but which was part of an uncommitted
transaction in the other handle. (This is the cause of issue #3994)
This moves more of the upgrade processing in a single transaction, so it might
also improve performance a bit.
* subversion/libsvn_wc/upgrade.c
(svn_wc_upgrade): Update caller.
* subversion/libsvn_wc/wc_db.c
(svn_wc__db_upgrade_begin): Store the new sqlite handle in the now passed
wc_db to allow using the standard wc_db api on the same database handle.
* subversion/libsvn_wc/wc_db.h
(svn_wc__db_upgrade_begin): Add some documentation. Update prototype.
Found by: Markus Schaber <m.schaber{_AT_}3s-software.com>
Modified:
subversion/trunk/subversion/libsvn_wc/upgrade.c
subversion/trunk/subversion/libsvn_wc/wc_db.c
subversion/trunk/subversion/libsvn_wc/wc_db.h
Modified: subversion/trunk/subversion/libsvn_wc/upgrade.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/upgrade.c?rev=1160671&r1=1160670&r2=1160671&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/upgrade.c (original)
+++ subversion/trunk/subversion/libsvn_wc/upgrade.c Tue Aug 23 13:12:20 2011
@@ -1914,12 +1914,12 @@ svn_wc_upgrade(svn_wc_context_t *wc_ctx,
scratch_pool));
SVN_ERR(svn_wc__ensure_directory(root_adm_abspath, scratch_pool));
- /* Create an empty sqlite database for this directory. */
+ /* Create an empty sqlite database for this directory and store it in DB. */
SVN_ERR(svn_wc__db_upgrade_begin(&data.sdb,
&data.repos_id, &data.wc_id,
- data.root_abspath,
+ db, data.root_abspath,
this_dir->repos, this_dir->uuid,
- scratch_pool, scratch_pool));
+ scratch_pool));
/* Migrate the entries over to the new database.
### We need to think about atomicity here.
@@ -1964,7 +1964,6 @@ svn_wc_upgrade(svn_wc_context_t *wc_ctx,
SVN_ERR(svn_wc__db_wq_add(db, data.root_abspath, work_items, scratch_pool));
SVN_ERR(svn_wc__db_wclock_release(db, data.root_abspath, scratch_pool));
- SVN_ERR(svn_sqlite__close(data.sdb));
SVN_ERR(svn_wc__db_close(db));
/* Renaming the db file is what makes the pre-wcng into a wcng */
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1160671&r1=1160670&r2=1160671&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Tue Aug 23 13:12:20 2011
@@ -10151,16 +10151,30 @@ svn_error_t *
svn_wc__db_upgrade_begin(svn_sqlite__db_t **sdb,
apr_int64_t *repos_id,
apr_int64_t *wc_id,
+ svn_wc__db_t *wc_db,
const char *dir_abspath,
const char *repos_root_url,
const char *repos_uuid,
- apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
- return svn_error_trace(create_db(sdb, repos_id, wc_id, dir_abspath,
- repos_root_url, repos_uuid,
- SDB_FILE,
- result_pool, scratch_pool));
+ svn_wc__db_wcroot_t *wcroot;
+ SVN_ERR(create_db(sdb, repos_id, wc_id, dir_abspath,
+ repos_root_url, repos_uuid,
+ SDB_FILE,
+ wc_db->state_pool, scratch_pool));
+
+ SVN_ERR(svn_wc__db_pdh_create_wcroot(&wcroot,
+ apr_pstrdup(wc_db->state_pool,
+ dir_abspath),
+ *sdb, *wc_id, FORMAT_FROM_SDB,
+ FALSE /* auto-upgrade */,
+ FALSE /* enforce_empty_wq */,
+ wc_db->state_pool, scratch_pool));
+
+ /* The WCROOT is complete. Stash it into DB. */
+ apr_hash_set(wc_db->dir_data, wcroot->abspath, APR_HASH_KEY_STRING, wcroot);
+
+ return SVN_NO_ERROR;
}
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=1160671&r1=1160670&r2=1160671&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Tue Aug 23 13:12:20 2011
@@ -2605,14 +2605,20 @@ svn_wc__db_scan_deletion(const char **ba
@{
*/
+/* Create a new wc.db file for LOCAL_DIR_ABSPATH, which is going to be a
+ working copy for the repository REPOS_ROOT_URL with uuid REPOS_UUID.
+ Return the raw sqlite handle, repository id and working copy id
+ and store the database in WC_DB.
+
+ Perform temporary allocations in SCRATCH_POOL. */
svn_error_t *
svn_wc__db_upgrade_begin(svn_sqlite__db_t **sdb,
apr_int64_t *repos_id,
apr_int64_t *wc_id,
+ svn_wc__db_t *wc_db,
const char *local_dir_abspath,
const char *repos_root_url,
const char *repos_uuid,
- apr_pool_t *result_pool,
apr_pool_t *scratch_pool);