You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2011/05/26 11:57:51 UTC
svn commit: r1127852 - in /subversion/trunk/subversion/libsvn_wc:
wc-checks.sql wc_db.c
Author: julianfoad
Date: Thu May 26 09:57:50 2011
New Revision: 1127852
URL: http://svn.apache.org/viewvc?rev=1127852&view=rev
Log:
Add another WC DB verification trigger. This one requires that parent rows
are added before their children, so adjust a function that was adding the
parent row after the children. As noted in r1127834, the triggers are
currently installed in such a way that they will not be active until the WC
format is bumped to 29.
* subversion/libsvn_wc/wc-checks.sql
(validation_03): New trigger statement.
* subversion/libsvn_wc/wc_db.c
(make_copy_txn): Add the parent row before the child rows.
Modified:
subversion/trunk/subversion/libsvn_wc/wc-checks.sql
subversion/trunk/subversion/libsvn_wc/wc_db.c
Modified: subversion/trunk/subversion/libsvn_wc/wc-checks.sql
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-checks.sql?rev=1127852&r1=1127851&r2=1127852&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-checks.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-checks.sql Thu May 26 09:57:50 2011
@@ -49,3 +49,16 @@ BEGIN
SELECT RAISE(FAIL, 'WC DB validity check 02 failed');
END;
+/* Verify: on every NODES row: it is an op-root or its op-root row exists. */
+CREATE TRIGGER validation_03 BEFORE INSERT ON NODES
+WHEN NOT (
+ (new.op_depth = relpath_depth(new.local_relpath))
+ OR
+ ((SELECT COUNT(*) FROM nodes
+ WHERE wc_id = new.wc_id AND op_depth = new.op_depth
+ AND local_relpath = new.parent_relpath) == 1)
+ )
+BEGIN
+ SELECT RAISE(FAIL, 'WC DB validity check 03 failed');
+END;
+
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1127852&r1=1127851&r2=1127852&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Thu May 26 09:57:50 2011
@@ -11018,25 +11018,6 @@ make_copy_txn(void *baton,
else
SVN_ERR(svn_sqlite__reset(stmt));
- /* Get the BASE children, as WORKING children don't need modifications */
- SVN_ERR(gather_repo_children(&children, wcroot, local_relpath,
- 0, scratch_pool, iterpool));
-
- for (i = 0; i < children->nelts; i++)
- {
- const char *name = APR_ARRAY_IDX(children, i, const char *);
- struct make_copy_baton_t cbt;
- const char *copy_relpath;
-
- svn_pool_clear(iterpool);
-
- copy_relpath = svn_relpath_join(local_relpath, name, iterpool);
-
- cbt.op_depth = mcb->op_depth;
-
- SVN_ERR(make_copy_txn(&cbt, wcroot, copy_relpath, iterpool));
- }
-
if (remove_working)
{
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
@@ -11062,6 +11043,25 @@ make_copy_txn(void *baton,
SVN_ERR(svn_sqlite__step_done(stmt));
}
+ /* Get the BASE children, as WORKING children don't need modifications */
+ SVN_ERR(gather_repo_children(&children, wcroot, local_relpath,
+ 0, scratch_pool, iterpool));
+
+ for (i = 0; i < children->nelts; i++)
+ {
+ const char *name = APR_ARRAY_IDX(children, i, const char *);
+ struct make_copy_baton_t cbt;
+ const char *copy_relpath;
+
+ svn_pool_clear(iterpool);
+
+ copy_relpath = svn_relpath_join(local_relpath, name, iterpool);
+
+ cbt.op_depth = mcb->op_depth;
+
+ SVN_ERR(make_copy_txn(&cbt, wcroot, copy_relpath, iterpool));
+ }
+
SVN_ERR(flush_entries(wcroot, svn_dirent_join(wcroot->abspath, local_relpath,
iterpool),
svn_depth_empty, iterpool));