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 2010/10/08 16:13:19 UTC
svn commit: r1005836 - in /subversion/trunk/subversion/libsvn_wc:
wc-queries.sql wc_db.c
Author: rhuijben
Date: Fri Oct 8 14:13:19 2010
New Revision: 1005836
URL: http://svn.apache.org/viewvc?rev=1005836&view=rev
Log:
Remove more SQLIte read-lock release-obtain cycles by using a single
query to read pristine properties instead of a separate WORKING and
BASE query.
* subversion/libsvn_wc/wc-queries.sql
(STMT_SELECT_WORKING_PROPS): Remove query.
(STMT_SELECT_NODE_PROPS): New query.
* subversion/libsvn_wc/wc_db.c
(svn_wc__db_read_pristine_props): Use STMT_SELECT_NODE_PROPS
to avoid performing a second (separate) query in the likely case where
there is no WORKING node.
Modified:
subversion/trunk/subversion/libsvn_wc/wc-queries.sql
subversion/trunk/subversion/libsvn_wc/wc_db.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=1005836&r1=1005835&r2=1005836&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Fri Oct 8 14:13:19 2010
@@ -111,11 +111,10 @@ WHERE wc_id = ?1 AND parent_relpath = ?2
SELECT properties FROM nodes
WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = 0;
--- STMT_SELECT_WORKING_PROPS
+-- STMT_SELECT_NODE_PROPS
SELECT properties, presence FROM nodes
-WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth > 0
-ORDER BY op_depth DESC
-LIMIT 1;
+WHERE wc_id = ?1 AND local_relpath = ?2
+ORDER BY op_depth DESC;
-- STMT_SELECT_ACTUAL_PROPS
SELECT properties FROM actual_node
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1005836&r1=1005835&r2=1005836&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Fri Oct 8 14:13:19 2010
@@ -4720,51 +4720,54 @@ svn_wc__db_read_pristine_props(apr_hash_
{
svn_sqlite__stmt_t *stmt;
svn_boolean_t have_row;
+ svn_wc__db_status_t presence;
SVN_ERR(get_statement_for_path(&stmt, db, local_abspath,
- STMT_SELECT_WORKING_PROPS, scratch_pool));
+ STMT_SELECT_NODE_PROPS, scratch_pool));
SVN_ERR(svn_sqlite__step(&have_row, stmt));
- /* If there is a WORKING row, then examine its status:
+ if (!have_row)
+ {
+ return svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND,
+ svn_sqlite__reset(stmt),
+ _("The node '%s' was not found."),
+ svn_dirent_local_style(local_abspath,
+ scratch_pool));
+ }
- For adds/copies/moves, then pristine properties are in this row.
- For deletes, the pristines may be located here (as a result of a
- copy/move-here), or they are located in BASE.
- ### right now, we don't have a strong definition yet. moving to the
- ### proposed NODE_DATA system will create more determinism around
- ### where props are located and their relation to layered operations. */
- if (have_row)
+ /* Examine the presence: */
+ presence = svn_sqlite__column_token(stmt, 1, presence_map);
+
+ /* For "base-deleted", it is obvious the pristine props are located
+ in the BASE table. Fall through to fetch them.
+ ### BH: Is this really the behavior we want here? */
+ if (presence == svn_wc__db_status_base_deleted)
{
- svn_wc__db_status_t presence;
+ SVN_ERR(svn_sqlite__step(&have_row, stmt));
- /* For "base-deleted", it is obvious the pristine props are located
- in the BASE table. Fall through to fetch them.
+ SVN_ERR_ASSERT(have_row);
- ### for regular deletes, the properties should be in the WORKING
- ### row. though operation layering and the suggested NODE_DATA may
- ### really be needed to ensure the props are always available,
- ### and what "pristine" really means. */
presence = svn_sqlite__column_token(stmt, 1, presence_map);
- if (presence != svn_wc__db_status_base_deleted)
- {
- svn_error_t *err;
+ }
+
+ /* normal or copied: Fetch properties */
+ if (presence == svn_wc__db_status_normal)
+ {
+ svn_error_t *err;
- err = svn_sqlite__column_properties(props, stmt, 0, result_pool,
- scratch_pool);
- SVN_ERR(svn_error_compose_create(err, svn_sqlite__reset(stmt)));
+ err = svn_sqlite__column_properties(props, stmt, 0, result_pool,
+ scratch_pool);
+ SVN_ERR(svn_error_compose_create(err, svn_sqlite__reset(stmt)));
- /* ### *PROPS may be NULL. is this okay? */
- return SVN_NO_ERROR;
- }
- }
+ if (!*props)
+ *props = apr_hash_make(result_pool);
- SVN_ERR(svn_sqlite__reset(stmt));
+ return SVN_NO_ERROR;
+ }
- /* No WORKING node, so the props must be in the BASE node. */
- return svn_error_return(svn_wc__db_base_get_props(props, db, local_abspath,
- result_pool,
- scratch_pool));
+ *props = NULL;
+ return svn_error_return(svn_sqlite__reset(stmt));
}