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 13:35:37 UTC
svn commit: r1341838 - 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 11:35:36 2012
New Revision: 1341838
URL: http://svn.apache.org/viewvc?rev=1341838&view=rev
Log:
Clean up some loose ends in the streamy property handling.
Rename some statements and apply a generic exception in the statement
validator for tables like the property cache.
No functional changes.
* subversion/libsvn_wc/wc-queries.sql
(STMT_CREATE_NODE_PROPS_CACHE): Rename to...
(STMT_CREATE_TARGET_PROP_CACHE): ... as it is more related to target than
node processing. Remove proof of concept note, as this was part of 1.7.
Rename temporary table to target_prop_cache, to more closely match
our other temporary table names.
Define primary key to avoid a sort when reporting.
(STMT_CACHE_TARGET_PROPS,
STMT_CACHE_TARGET_PRISTINE_PROPS): Update users
(STMT_SELECT_RELEVANT_PROPS_FROM_CACHE): Rename to ...
(STMT_SELECT_ALL_PROP_CACHE):
STMT_DROP_NODE_PROPS_CACHE): Update users.
* subversion/libsvn_wc/wc_db.c
(cache_props_recursive): Update user.
* subversion/tests/libsvn_wc/wc-queries-test.c
(schema_statements): Update reference.
(slow_statements): Remove statement.
(is_node_table): Add final line to allow extending with one line changes.
(is_result_table): New function.
(test_query_expectations): Allow exceptions on scan and index rules on
(temporary) result tables.
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=1341838&r1=1341837&r2=1341838&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Wed May 23 11:35:36 2012
@@ -1087,23 +1087,25 @@ WHERE NOT ((prop_reject IS NULL) AND (co
AND (tree_conflict_data IS NULL))
LIMIT 1
-/* ------------------------------------------------------------------------- */
-/* PROOF OF CONCEPT: Complex queries for callback walks, caching results
- in a temporary table. */
-
--- STMT_CREATE_NODE_PROPS_CACHE
-DROP TABLE IF EXISTS temp__node_props_cache;
-CREATE TEMPORARY TABLE temp__node_props_cache (
- local_Relpath TEXT NOT NULL,
+/* --------------------------------------------------------------------------
+ * Complex queries for callback walks, caching results in a temporary table.
+ *
+ * These target table are then used for joins against NODES, or for reporting
+ */
+
+-- STMT_CREATE_TARGET_PROP_CACHE
+DROP TABLE IF EXISTS target_prop_cache;
+CREATE TEMPORARY TABLE target_prop_cache (
+ local_relpath TEXT NOT NULL PRIMARY KEY,
kind TEXT NOT NULL,
properties BLOB
- );
+);
/* ### Need index?
CREATE UNIQUE INDEX temp__node_props_cache_unique
ON temp__node_props_cache (local_relpath) */
-- STMT_CACHE_TARGET_PROPS
-INSERT INTO temp__node_props_cache(local_relpath, kind, properties)
+INSERT INTO target_prop_cache(local_relpath, kind, properties)
SELECT n.local_relpath, n.kind,
IFNULL((SELECT properties FROM actual_node AS a
WHERE a.wc_id = n.wc_id
@@ -1116,7 +1118,7 @@ INSERT INTO temp__node_props_cache(local
AND (presence='normal' OR presence='incomplete')
-- STMT_CACHE_TARGET_PRISTINE_PROPS
-INSERT INTO temp__node_props_cache(local_relpath, kind, properties)
+INSERT INTO target_prop_cache(local_relpath, kind, properties)
SELECT n.local_relpath, n.kind,
CASE n.presence
WHEN 'base-deleted'
@@ -1134,12 +1136,12 @@ INSERT INTO temp__node_props_cache(local
OR presence = 'incomplete'
OR presence = 'base-deleted')
--- STMT_SELECT_RELEVANT_PROPS_FROM_CACHE
-SELECT local_relpath, properties FROM temp__node_props_cache
+-- STMT_SELECT_ALL_TARGET_PROP_CACHE
+SELECT local_relpath, properties FROM target_prop_cache
ORDER BY local_relpath
--- STMT_DROP_NODE_PROPS_CACHE
-DROP TABLE IF EXISTS temp__node_props_cache;
+-- STMT_DROP_TARGET_PROP_CACHE
+DROP TABLE IF EXISTS target_prop_cache;
-- STMT_CREATE_REVERT_LIST
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1341838&r1=1341837&r2=1341838&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Wed May 23 11:35:36 2012
@@ -8229,7 +8229,7 @@ cache_props_recursive(void *cb_baton,
baton->changelists, scratch_pool));
SVN_ERR(svn_sqlite__exec_statements(wcroot->sdb,
- STMT_CREATE_NODE_PROPS_CACHE));
+ STMT_CREATE_TARGET_PROP_CACHE));
if (baton->pristine)
stmt_idx = STMT_CACHE_TARGET_PRISTINE_PROPS;
@@ -8292,7 +8292,7 @@ svn_wc__db_read_props_streamily(svn_wc__
iterpool = svn_pool_create(scratch_pool);
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
- STMT_SELECT_RELEVANT_PROPS_FROM_CACHE));
+ STMT_SELECT_ALL_TARGET_PROP_CACHE));
SVN_ERR(svn_sqlite__step(&have_row, stmt));
while (!err && have_row)
{
@@ -8329,7 +8329,7 @@ svn_wc__db_read_props_streamily(svn_wc__
SVN_ERR(svn_error_compose_create(
err,
svn_sqlite__exec_statements(wcroot->sdb,
- STMT_DROP_NODE_PROPS_CACHE)));
+ STMT_DROP_TARGET_PROP_CACHE)));
return SVN_NO_ERROR;
}
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=1341838&r1=1341837&r2=1341838&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 11:35:36 2012
@@ -68,7 +68,7 @@ static const int schema_statements[] =
/* Memory tables */
STMT_CREATE_TARGETS_LIST,
STMT_CREATE_CHANGELIST_LIST,
- STMT_CREATE_NODE_PROPS_CACHE,
+ STMT_CREATE_TARGET_PROP_CACHE,
STMT_CREATE_REVERT_LIST,
STMT_CREATE_DELETE_LIST,
-1 /* final marker */
@@ -104,7 +104,6 @@ static const int slow_statements[] =
STMT_HAS_ACTUAL_NODES_CONFLICTS,
/* Join on targets table */
- STMT_SELECT_RELEVANT_PROPS_FROM_CACHE,
STMT_UPDATE_ACTUAL_CHANGELISTS,
/* Moved to/from index? */
@@ -428,7 +427,17 @@ is_node_table(const char *table_name)
return (apr_strnatcasecmp(table_name, "nodes") == 0
|| apr_strnatcasecmp(table_name, "actual_node") == 0
|| apr_strnatcasecmp(table_name, "externals") == 0
- || apr_strnatcasecmp(table_name, "wc_lock") == 0);
+ || apr_strnatcasecmp(table_name, "wc_lock") == 0
+ || FALSE);
+}
+
+/* Returns TRUE if TABLE specifies an intermediate result table, which is
+ allowed to have table scans, etc. */
+static svn_boolean_t
+is_result_table(const char *table_name)
+{
+ return (apr_strnatcasecmp(table_name, "target_prop_cache") == 0
+ || FALSE);
}
static svn_error_t *
@@ -550,8 +559,9 @@ test_query_expectations(apr_pool_t *scra
{
/* Nice */
}
- else if ((item->expression_vars < 2 && is_node_table(item->table))
+ else if (((item->expression_vars < 2 && is_node_table(item->table))
|| (item->expression_vars < 1))
+ && !is_result_table(item->table))
{
warned = TRUE;
if (!is_slow_statement(i))
@@ -571,7 +581,7 @@ test_query_expectations(apr_pool_t *scra
"Query on %s doesn't use an index:\n%s",
wc_query_info[i][0], item->table, wc_queries[i]);
}
- else if (item->scan)
+ else if (item->scan && !is_result_table(item->table))
{
warned = TRUE;
if (!is_slow_statement(i))