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 02:44:33 UTC

svn commit: r1340603 - in /subversion/trunk/subversion/libsvn_wc: wc-queries.sql wc_db.c wc_db.h

Author: rhuijben
Date: Sun May 20 00:44:33 2012
New Revision: 1340603

URL: http://svn.apache.org/viewvc?rev=1340603&view=rev
Log:
Revert all the sqlite query changes I applied in r1340598, r1340592 and
r1340588 until I have the time to find out why I get mixed results.

* subversion/libsvn_wc/wc-queries.sql
  (STMT_DELETE_SHADOWED_RECURSIVE,
   STMT_SELECT_BASE_NODE_LOCK_TOKENS_RECURSIVE,
   STMT_DELETE_NODES_RECURSIVE,
   STMT_INSERT_DELETE_FROM_NODE_RECURSIVE,
   STMT_HAS_SERVER_EXCLUDED_NODES,
   STMT_INSERT_DELETE_LIST): Revert to before this batch.

* subversion/libsvn_wc/wc_db.c
  (svn_wc__db_base_get_lock_tokens_recursive):
    Revert query related documentation change.

* subversion/libsvn_wc/wc_db.h
  (svn_wc__db_base_get_lock_tokens_recursive):
    Revert query related documentation change.

Modified:
    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/subversion/libsvn_wc/wc-queries.sql
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-queries.sql?rev=1340603&r1=1340602&r2=1340603&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Sun May 20 00:44:33 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 (parent_relpath = ?2
-       OR IS_STRICT_DESCENDANT_OF(parent_relpath, ?2))
+  AND (local_relpath = ?2
+       OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
   AND (op_depth < ?3
        OR (op_depth = ?3 AND presence = 'base-deleted'))
 
@@ -265,8 +265,9 @@ 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 (parent_relpath = ?2
-       OR IS_STRICT_DESCENDANT_OF(parent_relpath, ?2))
+  AND (?2 = ''
+       OR local_relpath = ?2
+       OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
 
 -- STMT_INSERT_WCROOT
 INSERT INTO wcroot (local_abspath)
@@ -605,8 +606,7 @@ DELETE FROM nodes
 WHERE wc_id = ?1
   AND (?2 = ''
        OR local_relpath = ?2
-       OR parent_relpath = ?2
-       OR IS_STRICT_DESCENDANT_OF(parent_relpath, ?2))
+       OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
   AND op_depth >= ?3
 
 -- STMT_DELETE_ACTUAL_NODE
@@ -846,8 +846,7 @@ SELECT wc_id, local_relpath, ?4 /*op_dep
 FROM nodes
 WHERE wc_id = ?1
   AND (local_relpath = ?2
-       OR parent_relpath = ?2
-       OR IS_STRICT_DESCENDANT_OF(parent_relpath, ?2))
+       OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
   AND op_depth = ?3
   AND presence NOT IN ('base-deleted', 'not-present', 'excluded', 'absent')
 
@@ -886,8 +885,9 @@ LIMIT 1
 -- STMT_HAS_SERVER_EXCLUDED_NODES
 SELECT local_relpath FROM nodes
 WHERE wc_id = ?1
-  AND (parent_relpath = ?2
-       OR IS_STRICT_DESCENDANT_OF(parent_relpath, ?2))
+  AND (?2 = ''
+       OR local_relpath = ?2
+       OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
   AND op_depth = 0 AND presence = 'absent'
 LIMIT 1
 
@@ -1262,8 +1262,7 @@ INSERT INTO delete_list(local_relpath)
 SELECT local_relpath FROM nodes_current
 WHERE wc_id = ?1
   AND (local_relpath = ?2
-       OR parent_relpath = ?2
-       OR IS_STRICT_DESCENDANT_OF(parent_relpath, ?2))
+       OR IS_STRICT_DESCENDANT_OF(local_relpath, ?2))
   AND op_depth >= ?3
   AND presence NOT IN ('base-deleted', 'not-present', 'excluded', 'absent')
 

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1340603&r1=1340602&r2=1340603&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Sun May 20 00:44:33 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 under LOCAL_RELPATH. */
+  /* Fetch all the lock tokens in and 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=1340603&r1=1340602&r2=1340603&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Sun May 20 00:44:33 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 below LOCAL_ABSPATH in DB which has
+ * lock tokens for every base node at or under 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 *



RE: svn commit: r1340603 - in /subversion/trunk/subversion/libsvn_wc: wc-queries.sql wc_db.c wc_db.h

Posted by Bert Huijben <be...@qqmail.nl>.

> -----Original Message-----
> From: rhuijben@apache.org [mailto:rhuijben@apache.org]
> Sent: zondag 20 mei 2012 2:45
> To: commits@subversion.apache.org
> Subject: svn commit: r1340603 - in /subversion/trunk/subversion/libsvn_wc: wc-
> queries.sql wc_db.c wc_db.h
> 
> Author: rhuijben
> Date: Sun May 20 00:44:33 2012
> New Revision: 1340603
> 
> URL: http://svn.apache.org/viewvc?rev=1340603&view=rev
> Log:
> Revert all the sqlite query changes I applied in r1340598, r1340592 and
> r1340588 until I have the time to find out why I get mixed results.
> 
> * subversion/libsvn_wc/wc-queries.sql
>   (STMT_DELETE_SHADOWED_RECURSIVE,
>    STMT_SELECT_BASE_NODE_LOCK_TOKENS_RECURSIVE,
>    STMT_DELETE_NODES_RECURSIVE,
>    STMT_INSERT_DELETE_FROM_NODE_RECURSIVE,
>    STMT_HAS_SERVER_EXCLUDED_NODES,
>    STMT_INSERT_DELETE_LIST): Revert to before this batch.

The problem was not in not really in using the index, but in the ?2 = '' part of the query to properly handle the working copy root.

As Sqlite only uses a single query plan, it notes that it needs a table scan to handle the ?2 = '' extrme case, and forgets the other optimizations.

We should split the performance critical queries in a normal and working copy root specific one (if one is necessary)

	Bert