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/20 01:03:51 UTC

svn commit: r1340588 - in /subversion/trunk: build/transform_sql.py subversion/libsvn_client/commit_util.c subversion/libsvn_wc/wc-queries.sql subversion/libsvn_wc/wc_db.c subversion/libsvn_wc/wc_db.h

Author: rhuijben
Date: Sat May 19 23:03:50 2012
New Revision: 1340588

URL: http://svn.apache.org/viewvc?rev=1340588&view=rev
Log:
Make STMT_SELECT_BASE_NODE_LOCK_TOKENS_RECURSIVE only retrieve the lock tokens
below the specified path, instead of also for the path itself.

This allows simplifying the query to use parent_relpath. I think this should
improve the sqlite index usage for this query.

* build/transform_sql.py
  (process_file): Update generated query to stop searching for strings between
  "/" and "0" without a prefix.

* subversion/libsvn_client/commit_util.c
  (harvest_status_callback): Don't search for lock tokens if not deleting a
    BASE node.

* subversion/libsvn_wc/wc-queries.sql
  (STMT_DELETE_SHADOWED_RECURSIVE): Only select descendants.
  (STMT_SELECT_BASE_NODE_LOCK_TOKENS_RECURSIVE): Only select descendants.

* subversion/libsvn_wc/wc_db.c
  (svn_wc__db_base_get_lock_tokens_recursive): Update comment.

* subversion/libsvn_wc/wc_db.h
  (svn_wc__db_base_get_lock_tokens_recursive): Update comment.

Modified:
    subversion/trunk/build/transform_sql.py
    subversion/trunk/subversion/libsvn_client/commit_util.c
    subversion/trunk/subversion/libsvn_wc/wc-queries.sql
    subversion/trunk/subversion/libsvn_wc/wc_db.c
    subversion/trunk/subversion/libsvn_wc/wc_db.h

Modified: subversion/trunk/build/transform_sql.py
URL: http://svn.apache.org/viewvc/subversion/trunk/build/transform_sql.py?rev=1340588&r1=1340587&r2=1340588&view=diff
==============================================================================
--- subversion/trunk/build/transform_sql.py (original)
+++ subversion/trunk/build/transform_sql.py Sat May 19 23:03:50 2012
@@ -105,7 +105,7 @@ class Processor(object):
 
       # '/'+1 == '0'
       line = re.sub(r'IS_STRICT_DESCENDANT_OF[(]([A-Za-z_.]+), ([?][0-9]+)[)]',
-                    r"((\1) > (\2) || '/' AND (\1) < (\2) || '0') ",
+                    r"((\2) != '' AND ((\1) > (\2) || '/') AND ((\1) < (\2) || '0')) ",
                     line)
 
       if line.strip():

Modified: subversion/trunk/subversion/libsvn_client/commit_util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/commit_util.c?rev=1340588&r1=1340587&r2=1340588&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/commit_util.c (original)
+++ subversion/trunk/subversion/libsvn_client/commit_util.c Sat May 19 23:03:50 2012
@@ -859,9 +859,11 @@ harvest_status_callback(void *status_bat
                               result_pool, scratch_pool));
     }
 
-    /* Fetch lock tokens for descendants of deleted nodes. */
+    /* Fetch lock tokens for descendants of deleted BASE nodes. */
   if (matches_changelists
       && (state_flags & SVN_CLIENT_COMMIT_ITEM_DELETE)
+      && !copy_mode
+      && SVN_IS_VALID_REVNUM(node_rev) /* && BASE-kind = dir */
       && baton->lock_tokens)
     {
       apr_hash_t *local_relpath_tokens;

Modified: subversion/trunk/subversion/libsvn_wc/wc-queries.sql
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-queries.sql?rev=1340588&r1=1340587&r2=1340588&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Sat May 19 23:03:50 2012
@@ -181,8 +181,8 @@ WHERE wc_id = ?1 AND parent_relpath = ?2
 -- STMT_DELETE_SHADOWED_RECURSIVE
 DELETE FROM nodes
 WHERE wc_id = ?1
-  AND (local_relpath = ?2
-       OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
+  AND (parent_relpath = ?2
+       OR IS_STRICT_DESCENDANT_OF(parent_relpath, ?2))
   AND (op_depth < ?3
        OR (op_depth = ?3 AND presence = 'base-deleted'))
 
@@ -265,9 +265,8 @@ FROM nodes
 LEFT JOIN lock ON nodes.repos_id = lock.repos_id
   AND nodes.repos_path = lock.repos_relpath
 WHERE wc_id = ?1 AND op_depth = 0
-  AND (?2 = ''
-       OR local_relpath = ?2
-       OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
+  AND (parent_relpath = ?2
+       OR IS_STRICT_DESCENDANT_OF(parent_relpath, ?2))
 
 -- STMT_INSERT_WCROOT
 INSERT INTO wcroot (local_abspath)

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1340588&r1=1340587&r2=1340588&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Sat May 19 23:03:50 2012
@@ -13223,7 +13223,7 @@ svn_wc__db_base_get_lock_tokens_recursiv
 
   *lock_tokens = apr_hash_make(result_pool);
 
-  /* Fetch all the lock tokens in and under LOCAL_RELPATH. */
+  /* Fetch all the lock tokens under LOCAL_RELPATH. */
   SVN_ERR(svn_sqlite__get_statement(
               &stmt, wcroot->sdb,
               STMT_SELECT_BASE_NODE_LOCK_TOKENS_RECURSIVE));

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=1340588&r1=1340587&r2=1340588&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Sat May 19 23:03:50 2012
@@ -814,7 +814,7 @@ svn_wc__db_base_clear_dav_cache_recursiv
                                           apr_pool_t *scratch_pool);
 
 /* Set LOCK_TOKENS to a hash mapping const char * full URLs to const char *
- * lock tokens for every base node at or under LOCAL_ABSPATH in DB which has
+ * lock tokens for every base node below LOCAL_ABSPATH in DB which has
  * such a lock token set on it.
  * Allocate the hash and all items therein from RESULT_POOL.  */
 svn_error_t *