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 2012/05/23 02:33:05 UTC
svn commit: r1341690 - in /subversion/trunk/subversion:
libsvn_wc/wc-queries.sql libsvn_wc/wc_db.c tests/libsvn_wc/wc-queries-test.c
Author: rhuijben
Date: Wed May 23 00:33:04 2012
New Revision: 1341690
URL: http://svn.apache.org/viewvc?rev=1341690&view=rev
Log:
Remove a few wcroot specific queries that can now safely use the generic
variant without any measurable performance penalty.
* subversion/libsvn_wc/wc-queries.sql
(STMT_DELETE_NODES_ABOVE_DEPTH_RECURSIVE,
STMT_DELETE_ACTUAL_NODE_LEAVING_CHANGELIST_RECURSIVE,
STMT_CLEAR_ACTUAL_NODE_LEAVING_CHANGELIST_RECURSIVE,
STMT_HAS_SERVER_EXCLUDED_DESCENDANTS): Remove obsolete comments.
(STMT_DELETE_ALL_NODES_ABOVE_DEPTH,
STMT_DELETE_ALL_ACTUAL_NODE_LEAVING_CHANGELIST,
STMT_CLEAR_ALL_ACTUAL_NODE_LEAVING_CHANGELIST,
STMT_SELECT_ALL_EXCLUDED_NODES): Remove statements.
* subversion/libsvn_wc/wc_db.c
(catch_copy_of_server_excluded,
op_revert_recursive_txn): Update caller.
* subversion/tests/libsvn_wc/wc-queries-test.c
(slow_statements): Remove slow statements.
Modified:
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/wc-queries.sql
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-queries.sql?rev=1341690&r1=1341689&r2=1341690&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Wed May 23 00:33:04 2012
@@ -596,7 +596,6 @@ WHERE wc_id = ?1 AND local_relpath = ?2
DELETE FROM nodes
WHERE wc_id = ?1 AND local_relpath = ?2
-/* Will not delete recursive when run on the wcroot */
-- STMT_DELETE_NODES_ABOVE_DEPTH_RECURSIVE
DELETE FROM nodes
WHERE wc_id = ?1
@@ -604,12 +603,6 @@ WHERE wc_id = ?1
OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
AND op_depth >= ?3
-/* WC-Root query for STMT_DELETE_NODES_ABOVE_DEPTH_RECURSIVE */
--- STMT_DELETE_ALL_NODES_ABOVE_DEPTH
-DELETE FROM nodes
-WHERE wc_id = ?1
- AND op_depth >= ?2
-
-- STMT_DELETE_ACTUAL_NODE
DELETE FROM actual_node
WHERE wc_id = ?1 AND local_relpath = ?2
@@ -635,7 +628,6 @@ WHERE wc_id = ?1
WHERE c.wc_id = ?1 AND c.local_relpath = ?2
AND c.kind = 'file'))
-/* Not valid for the wc-root */
-- STMT_DELETE_ACTUAL_NODE_LEAVING_CHANGELIST_RECURSIVE
DELETE FROM actual_node
WHERE wc_id = ?1
@@ -647,15 +639,6 @@ WHERE wc_id = ?1
AND c.local_relpath = actual_node.local_relpath
AND c.kind = 'file'))
--- STMT_DELETE_ALL_ACTUAL_NODE_LEAVING_CHANGELIST
-DELETE FROM actual_node
-WHERE wc_id = ?1
- AND (changelist IS NULL
- OR NOT EXISTS (SELECT 1 FROM nodes_current c
- WHERE c.wc_id = ?1
- AND c.local_relpath = actual_node.local_relpath
- AND c.kind = 'file'))
-
-- STMT_CLEAR_ACTUAL_NODE_LEAVING_CHANGELIST
UPDATE actual_node
SET properties = NULL,
@@ -670,7 +653,6 @@ SET properties = NULL,
right_checksum = NULL
WHERE wc_id = ?1 AND local_relpath = ?2
-/* Not valid for the wc-root */
-- STMT_CLEAR_ACTUAL_NODE_LEAVING_CHANGELIST_RECURSIVE
UPDATE actual_node
SET properties = NULL,
@@ -687,20 +669,6 @@ WHERE wc_id = ?1
AND (local_relpath = ?2
OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
--- STMT_CLEAR_ALL_ACTUAL_NODE_LEAVING_CHANGELIST
-UPDATE actual_node
-SET properties = NULL,
- text_mod = NULL,
- tree_conflict_data = NULL,
- conflict_old = NULL,
- conflict_new = NULL,
- conflict_working = NULL,
- prop_reject = NULL,
- older_checksum = NULL,
- left_checksum = NULL,
- right_checksum = NULL
-WHERE wc_id = ?1
-
-- STMT_UPDATE_NODE_BASE_DEPTH
UPDATE nodes SET depth = ?3
WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0
@@ -905,7 +873,6 @@ WHERE wc_id = ?1
SELECT 1 FROM nodes WHERE wc_id = ?1 AND local_relpath = ?2
LIMIT 1
-/* Not valid for the wc-root */
-- STMT_HAS_SERVER_EXCLUDED_DESCENDANTS
SELECT local_relpath FROM nodes
WHERE wc_id = ?1
@@ -913,27 +880,14 @@ WHERE wc_id = ?1
AND op_depth = 0 AND presence = 'absent'
LIMIT 1
-/* Applies to all nodes in a wc */
--- STMT_WC_HAS_SERVER_EXCLUDED
-SELECT local_relpath FROM nodes
-WHERE wc_id = ?1
- AND op_depth = 0 AND presence = 'absent'
-LIMIT 1
-
/* Select all excluded nodes. Not valid on the WC-root */
--- STMT_SELECT_ALL_EXCLUDED_NODES
+-- STMT_SELECT_ALL_EXCLUDED_DESCENDANTS
SELECT local_relpath FROM nodes
WHERE wc_id = ?1
AND IS_STRICT_DESCENDANT_OF(local_relpath, ?2)
AND op_depth = 0
AND (presence = 'absent' OR presence = 'excluded')
--- STMT_SELECT_ALL_EXCLUDED_WCROOT
-SELECT local_relpath FROM nodes
-WHERE wc_id = ?1
- AND op_depth = 0
- AND (presence = 'absent' OR presence = 'excluded')
-
/* Creates a copy from one top level NODE to a different location */
-- STMT_INSERT_WORKING_NODE_COPY_FROM
INSERT OR REPLACE INTO nodes (
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1341690&r1=1341689&r2=1341690&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Wed May 23 00:33:04 2012
@@ -4223,9 +4223,7 @@ catch_copy_of_server_excluded(svn_wc__db
const char *server_excluded_relpath;
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
- (local_relpath[0] == '\0')
- ? STMT_WC_HAS_SERVER_EXCLUDED
- : STMT_HAS_SERVER_EXCLUDED_DESCENDANTS));
+ STMT_HAS_SERVER_EXCLUDED_DESCENDANTS));
SVN_ERR(svn_sqlite__bindf(stmt, "is",
wcroot->wc_id,
local_relpath));
@@ -5606,49 +5604,25 @@ op_revert_recursive_txn(void *baton,
/* Don't delete BASE nodes */
select_op_depth = op_depth ? op_depth : 1;
- if (local_relpath[0] == '\0')
- {
- /* Reverting the wc-root. Use the table-scan queries */
- SVN_ERR(svn_sqlite__get_statement(
- &stmt, wcroot->sdb,
- STMT_DELETE_ALL_NODES_ABOVE_DEPTH));
- SVN_ERR(svn_sqlite__bindf(stmt, "id", wcroot->wc_id, select_op_depth));
- SVN_ERR(svn_sqlite__step_done(stmt));
-
- SVN_ERR(svn_sqlite__get_statement(
- &stmt, wcroot->sdb,
- STMT_DELETE_ALL_ACTUAL_NODE_LEAVING_CHANGELIST));
- SVN_ERR(svn_sqlite__bind_int64(stmt, 1, wcroot->wc_id));
- SVN_ERR(svn_sqlite__step_done(stmt));
-
- SVN_ERR(svn_sqlite__get_statement(
- &stmt, wcroot->sdb,
- STMT_CLEAR_ALL_ACTUAL_NODE_LEAVING_CHANGELIST));
- SVN_ERR(svn_sqlite__bind_int64(stmt, 1, wcroot->wc_id));
- SVN_ERR(svn_sqlite__step_done(stmt));
- }
- else
- {
- /* Reverting any non wc-root node */
- SVN_ERR(svn_sqlite__get_statement(
- &stmt, wcroot->sdb,
- STMT_DELETE_NODES_ABOVE_DEPTH_RECURSIVE));
- SVN_ERR(svn_sqlite__bindf(stmt, "isd", wcroot->wc_id,
- local_relpath, select_op_depth));
- SVN_ERR(svn_sqlite__step_done(stmt));
+ /* Reverting any non wc-root node */
+ SVN_ERR(svn_sqlite__get_statement(
+ &stmt, wcroot->sdb,
+ STMT_DELETE_NODES_ABOVE_DEPTH_RECURSIVE));
+ SVN_ERR(svn_sqlite__bindf(stmt, "isd", wcroot->wc_id,
+ local_relpath, select_op_depth));
+ SVN_ERR(svn_sqlite__step_done(stmt));
- SVN_ERR(svn_sqlite__get_statement(
- &stmt, wcroot->sdb,
- STMT_DELETE_ACTUAL_NODE_LEAVING_CHANGELIST_RECURSIVE));
- SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
- SVN_ERR(svn_sqlite__step_done(stmt));
+ SVN_ERR(svn_sqlite__get_statement(
+ &stmt, wcroot->sdb,
+ STMT_DELETE_ACTUAL_NODE_LEAVING_CHANGELIST_RECURSIVE));
+ SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
+ SVN_ERR(svn_sqlite__step_done(stmt));
- SVN_ERR(svn_sqlite__get_statement(
- &stmt, wcroot->sdb,
- STMT_CLEAR_ACTUAL_NODE_LEAVING_CHANGELIST_RECURSIVE));
- SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
- SVN_ERR(svn_sqlite__step_done(stmt));
- }
+ SVN_ERR(svn_sqlite__get_statement(
+ &stmt, wcroot->sdb,
+ STMT_CLEAR_ACTUAL_NODE_LEAVING_CHANGELIST_RECURSIVE));
+ SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
+ SVN_ERR(svn_sqlite__step_done(stmt));
/* ### This removes the locks, but what about the access batons? */
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
@@ -11802,7 +11776,7 @@ wclock_obtain_cb(void *baton,
/* Check if there are nodes locked below the new lock root */
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb, STMT_FIND_WC_LOCK));
- SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, filter));
+ SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, local_relpath));
lock_depth = relpath_depth(local_relpath);
max_depth = lock_depth + bt->levels_to_lock;
@@ -12996,20 +12970,11 @@ svn_wc__db_get_excluded_subtrees(apr_has
scratch_pool, scratch_pool));
VERIFY_USABLE_WCROOT(wcroot);
- if (local_relpath[0] == '\0')
- {
- SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
- STMT_SELECT_ALL_EXCLUDED_WCROOT));
- SVN_ERR(svn_sqlite__bind_int64(stmt, 1, wcroot->wc_id));
- }
- else
- {
- SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
- STMT_SELECT_ALL_EXCLUDED_NODES));
- SVN_ERR(svn_sqlite__bindf(stmt, "is",
- wcroot->wc_id,
- local_relpath));
- }
+ SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+ STMT_SELECT_ALL_EXCLUDED_DESCENDANTS));
+ SVN_ERR(svn_sqlite__bindf(stmt, "is",
+ wcroot->wc_id,
+ local_relpath));
SVN_ERR(svn_sqlite__step(&have_row, stmt));
if (have_row)
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=1341690&r1=1341689&r2=1341690&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 00:33:04 2012
@@ -80,12 +80,9 @@ static const int slow_statements[] =
{
/* Operate on the entire WC */
STMT_RECURSIVE_UPDATE_NODE_REPO,
- STMT_DELETE_ALL_NODES_ABOVE_DEPTH,
- STMT_WC_HAS_SERVER_EXCLUDED,
STMT_HAS_SWITCHED_WCROOT,
STMT_HAS_SWITCHED_WCROOT_REPOS_ROOT,
STMT_SELECT_ALL_NODES,
- STMT_SELECT_ALL_EXCLUDED_WCROOT,
/* Is there a record? */
STMT_LOOK_FOR_WORK,
@@ -108,9 +105,7 @@ static const int slow_statements[] =
STMT_SELECT_REVERT_LIST_RECURSIVE,
STMT_DELETE_REVERT_LIST_RECURSIVE,
STMT_SELECT_CONFLICT_MARKER_FILES,
- STMT_CLEAR_ALL_ACTUAL_NODE_LEAVING_CHANGELIST,
STMT_DELETE_ACTUAL_EMPTIES,
- STMT_DELETE_ALL_ACTUAL_NODE_LEAVING_CHANGELIST,
/* Upgrade statements? */
STMT_SELECT_OLD_TREE_CONFLICT,