subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhuij...@apache.org
Subject svn commit: r1342088 - /subversion/trunk/subversion/tests/libsvn_wc/wc-queries-test.c
Date Wed, 23 May 2012 23:26:32 GMT
Author: rhuijben
Date: Wed May 23 23:26:32 2012
New Revision: 1342088

URL: http://svn.apache.org/viewvc?rev=1342088&view=rev
Log:
Extend the wc-queries-test application to catch another type of
potentially slow queries: Queries that create temporary tables.

* subversion/tests/libsvn_wc/wc-queries-test.c
  (slow_statements): Remove STMT_SELECT_CHANGELIST_LIST as that is now
    caught as a result table. Add 3 queries that use a temp table.
  (explanation_item): Add some variables.
  (parse_explanation_item): Parse COMPOUND and some bits of USE. Set
    search type.
  (is_result_table): Add changelist_list.
  (test_query_expectations): Update tests to handle other info items.
    Check for search items before testing fields that may be NULL.

Modified:
    subversion/trunk/subversion/tests/libsvn_wc/wc-queries-test.c

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=1342088&r1=1342087&r2=1342088&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 23:26:32 2012
@@ -87,9 +87,6 @@ static const int slow_statements[] =
   STMT_LOOK_FOR_WORK,
   STMT_HAS_WORKING_NODES,
 
-  /* Lists an entire in-memory table */
-  STMT_SELECT_CHANGELIST_LIST,
-
   /* Need review: */
   STMT_SELECT_EXTERNAL_PROPERTIES,
   STMT_DELETE_ACTUAL_EMPTIES,
@@ -114,6 +111,11 @@ static const int slow_statements[] =
   STMT_SELECT_PRISTINE_BY_MD5, /* Only used by deprecated api */
   STMT_SELECT_DELETE_LIST,
 
+  /* Create temporary table */
+  STMT_SELECT_REVERT_LIST_RECURSIVE,
+  STMT_SELECT_ANCESTOR_WCLOCKS,
+  STMT_SELECT_GE_OP_DEPTH_CHILDREN,
+
   /* Designed as slow */
   STMT_SELECT_UNREFERENCED_PRISTINES,
 
@@ -220,12 +222,18 @@ struct explanation_item
   const char *table;
   const char *alias;
   svn_boolean_t scan;
+  svn_boolean_t search;
   svn_boolean_t covered_by_index;
-  svn_boolean_t primarary_key;
+  svn_boolean_t primary_key;
   svn_boolean_t automatic_index;
   const char *index;
   const char *expressions;
   const char *expected;
+
+  const char *compound_left;
+  const char *compound_right;
+  svn_boolean_t create_btree;
+
   int expression_vars;
   int expected_rows;
 };
@@ -260,6 +268,7 @@ parse_explanation_item(struct explanatio
 
   if (item->scan || MATCH_TOKEN(item->operation, "SEARCH"))
     {
+      item->search = TRUE; /* Search or scan */
       token = apr_strtok(NULL, " ", &last);
 
       if (!MATCH_TOKEN(token, "TABLE"))
@@ -320,7 +329,7 @@ parse_explanation_item(struct explanatio
                   return SVN_NO_ERROR;
                 }
 
-              item->primarary_key = TRUE;
+              item->primary_key = TRUE;
             }
           else
             {
@@ -383,13 +392,48 @@ parse_explanation_item(struct explanatio
   else if (MATCH_TOKEN(item->operation, "COMPOUND"))
     {
       /* Handling temporary table (E.g. UNION) */
-      return SVN_NO_ERROR;
+
+      token = apr_strtok(NULL, " ", &last);
+      if (!MATCH_TOKEN(token, "SUBQUERIES"))
+        {
+          printf("DBG: Expected 'SUBQUERIES', got '%s' in '%s'\n", token,
+                 text);
+          return SVN_NO_ERROR;
+        }
+
+      item->compound_left = apr_strtok(NULL, " ", &last);
+      token = apr_strtok(NULL, " ", &last);
+
+      if (!MATCH_TOKEN(token, "AND"))
+        {
+          printf("DBG: Expected 'AND', got '%s' in '%s'\n", token, text);
+          return SVN_NO_ERROR;
+        }
+
+      item->compound_right = apr_strtok(NULL, " ", &last);
+
+      token = apr_strtok(NULL, " ", &last);
+      if (MATCH_TOKEN(token, "USING"))
+        {
+          token = apr_strtok(NULL, " ", &last);
+          if (!MATCH_TOKEN(token, "TEMP"))
+            {
+              printf("DBG: Expected 'TEMP', got '%s' in '%s'\n", token, text);
+            }
+          token = apr_strtok(NULL, " ", &last);
+          if (!MATCH_TOKEN(token, "B-TREE"))
+            {
+              printf("DBG: Expected 'B-TREE', got '%s' in '%s'\n", token,
+                     text);
+            }
+          item->create_btree = TRUE;
+        }
     }
   else if (MATCH_TOKEN(item->operation, "USE"))
     {
       /* Using a temporary table for ordering results */
       /* ### Need parsing */
-      return SVN_NO_ERROR;
+      item->create_btree = TRUE;
     }
   else
     {
@@ -434,6 +478,7 @@ static svn_boolean_t
 is_result_table(const char *table_name)
 {
   return (apr_strnatcasecmp(table_name, "target_prop_cache") == 0
+          || apr_strnatcasecmp(table_name, "changelist_list") == 0
           || FALSE);
 }
 
@@ -541,7 +586,8 @@ test_query_expectations(apr_pool_t *scra
           if (!item)
             continue; /* Not parsable or not interesting */
 
-          if (item->automatic_index)
+          if (item->search
+              && item->automatic_index)
             {
               warned = TRUE;
               if (!is_slow_statement(i))
@@ -552,11 +598,12 @@ test_query_expectations(apr_pool_t *scra
                                 wc_query_info[i][0], wc_queries[i]);
                 }
             }
-          else if (item->primarary_key)
+          else if (item->search && item->primary_key)
             {
               /* Nice */
             }
-          else if (((item->expression_vars < 2 && is_node_table(item->table))
+          else if (item->search
+                   && ((item->expression_vars < 2 && is_node_table(item->table))
                        || (item->expression_vars < 1))
                    && !is_result_table(item->table))
             {
@@ -569,7 +616,7 @@ test_query_expectations(apr_pool_t *scra
                                 item->expression_vars, item->expressions,
                                 wc_queries[i]);
             }
-          else if (!item->index)
+          else if (item->search && !item->index)
             {
               warned = TRUE;
               if (!is_slow_statement(i))
@@ -587,6 +634,14 @@ test_query_expectations(apr_pool_t *scra
                                 "Performs scan on %s:\n%s",
                                 wc_query_info[i][0], item->table, wc_queries[i]);
             }
+          else if (item->create_btree)
+            {
+              warned = TRUE;
+              if (!is_slow_statement(i))
+                warnings = svn_error_createf(SVN_ERR_TEST_FAILED, warnings,
+                                "Query %s: Creates a temporary B-TREE:\n",
+                                wc_query_info[i][0], wc_queries[i]);
+            }
         }
       SQLITE_ERR(sqlite3_reset(stmt));
       SQLITE_ERR(sqlite3_finalize(stmt));



Mime
View raw message