Author: rhuijben
Date: Wed May 23 13:14:07 2012
New Revision: 1341851
URL: http://svn.apache.org/viewvc?rev=1341851&view=rev
Log:
Cleanup the svn ci --include-externals query to use indexes for most of its
work. Use the knowledge that 'parent_relpath = ?' is a subset of
IS_STRICT_DESCENDANT_OF() to at least use some indexing.
* subversion/libsvn_wc/externals.c
(is_external_rolled_out): Externals live in BASE, so use the cheap/direct
api towards that layer, without bothering with copies.
* subversion/libsvn_wc/wc-queries.sql
(STMT_SELECT_COMMITTABLE_EXTERNALS_BELOW): Rewrite query.
Remove unused result column. Add missing wc_id in subquery. Just obtain
the repos_id from the wc root, as we can't trust it to be available on
the passed node.
* subversion/libsvn_wc/wc_db.c
(svn_wc__db_committable_externals_below): Update column indexes.
* subversion/tests/libsvn_wc/wc-queries-test.c
(STMT_SELECT_COMMITTABLE_EXTERNALS_BELOW): And another one is done.
Modified:
subversion/trunk/subversion/libsvn_wc/externals.c
subversion/trunk/subversion/libsvn_wc/wc-queries.sql
subversion/trunk/subversion/libsvn_wc/wc_db.c
subversion/trunk/subversion/tests/libsvn_wc/wc-queries-test.c
Modified: subversion/trunk/subversion/libsvn_wc/externals.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/externals.c?rev=1341851&r1=1341850&r2=1341851&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/externals.c (original)
+++ subversion/trunk/subversion/libsvn_wc/externals.c Wed May 23 13:14:07 2012
@@ -1134,19 +1134,17 @@ is_external_rolled_out(svn_boolean_t *is
svn_wc__committable_external_info_t *xinfo,
apr_pool_t *scratch_pool)
{
- const char *x_repos_relpath;
- const char *x_repos_root_url;
+ const char *repos_relpath;
+ const char *repos_root_url;
svn_error_t *err;
*is_rolled_out = FALSE;
- err = svn_wc__node_get_origin(NULL, NULL,
- &x_repos_relpath,
- &x_repos_root_url,
- NULL, NULL,
- wc_ctx, xinfo->local_abspath,
- FALSE, /* scan_deleted */
- scratch_pool, scratch_pool);
+ err = svn_wc__db_base_get_info(NULL, NULL, NULL, &repos_relpath,
+ &repos_root_url, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL,
+ wc_ctx->db, xinfo->local_abspath,
+ scratch_pool, scratch_pool);
if (err)
{
@@ -1158,8 +1156,8 @@ is_external_rolled_out(svn_boolean_t *is
SVN_ERR(err);
}
- *is_rolled_out = (strcmp(xinfo->repos_root_url, x_repos_root_url) == 0 &&
- strcmp(xinfo->repos_relpath, x_repos_relpath) == 0);
+ *is_rolled_out = (strcmp(xinfo->repos_root_url, repos_root_url) == 0 &&
+ strcmp(xinfo->repos_relpath, repos_relpath) == 0);
return SVN_NO_ERROR;
}
Modified: subversion/trunk/subversion/libsvn_wc/wc-queries.sql
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-queries.sql?rev=1341851&r1=1341850&r2=1341851&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Wed May 23 13:14:07
2012
@@ -996,26 +996,23 @@ LIMIT 1
* inside an unversioned dir, because commit still breaks on those.
* Once that's been fixed, the conditions below "--->8---" become obsolete. */
-- STMT_SELECT_COMMITTABLE_EXTERNALS_BELOW
-SELECT local_relpath, kind, repos_id, def_repos_relpath, repository.root
-FROM externals
-LEFT OUTER JOIN repository ON repository.id = externals.repos_id
-WHERE wc_id = ?1
- AND IS_STRICT_DESCENDANT_OF(local_relpath, ?2)
- AND def_revision IS NULL
- AND repos_id = (SELECT repos_id FROM nodes
- WHERE nodes.local_relpath = ?2)
- AND ( ((NOT ?3)
- AND (
- /* Want only the cildren of e.local_relpath;
- * externals can't have a local_relpath = ''. */
- IS_STRICT_DESCENDANT_OF(local_relpath, ?2)))
- OR
- ((?3)
- AND parent_relpath = ?2) )
+SELECT local_relpath, kind, def_repos_relpath,
+ (SELECT root FROM repository AS r
+ WHERE r.id = e.repos_id)
+FROM externals AS e
+WHERE e.wc_id = ?1
+ AND IS_STRICT_DESCENDANT_OF(e.local_relpath, ?2)
+ AND e.def_revision IS NULL
+ AND e.repos_id = (SELECT repos_id
+ FROM nodes AS n
+ WHERE n.wc_id = ?1
+ AND n.local_relpath = ''
+ AND n.op_depth = 0)
+ AND ( (NOT ?3) OR (parent_relpath = ?2) )
/* ------>8----- */
AND (EXISTS (SELECT 1 FROM nodes
- WHERE nodes.wc_id = externals.wc_id
- AND nodes.local_relpath = externals.parent_relpath))
+ WHERE nodes.wc_id = e.wc_id
+ AND nodes.local_relpath = e.parent_relpath))
-- STMT_SELECT_EXTERNALS_DEFINED
SELECT local_relpath, def_local_relpath
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1341851&r1=1341850&r2=1341851&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Wed May 23 13:14:07 2012
@@ -3173,8 +3173,8 @@ svn_wc__db_committable_externals_below(a
SVN_ERR_ASSERT(db_kind == svn_kind_file || db_kind == svn_kind_dir);
info->kind = db_kind;
- info->repos_relpath = svn_sqlite__column_text(stmt, 3, result_pool);
- info->repos_root_url = svn_sqlite__column_text(stmt, 4, result_pool);
+ info->repos_relpath = svn_sqlite__column_text(stmt, 2, result_pool);
+ info->repos_root_url = svn_sqlite__column_text(stmt, 3, result_pool);
APR_ARRAY_PUSH(result, svn_wc__committable_external_info_t *) = info;
Modified: subversion/trunk/subversion/tests/libsvn_wc/wc-queries-test.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_wc/wc-queries-test.c?rev=1341851&r1=1341850&r2=1341851&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_wc/wc-queries-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_wc/wc-queries-test.c Wed May 23
13:14:07 2012
@@ -91,7 +91,6 @@ static const int slow_statements[] =
STMT_SELECT_CHANGELIST_LIST,
/* Need review: */
- STMT_SELECT_COMMITTABLE_EXTERNALS_BELOW,
STMT_SELECT_EXTERNAL_PROPERTIES,
STMT_DELETE_ACTUAL_EMPTIES,