11039e7
11039e7
http://svn.apache.org/viewvc?view=revision&revision=1542774
11039e7
11039e7
(H/T Andreas Stieger)
11039e7
11039e7
--- subversion-1.8.5/subversion/tests/libsvn_wc/wc-queries-test.c.r1542774
11039e7
+++ subversion-1.8.5/subversion/tests/libsvn_wc/wc-queries-test.c
11039e7
@@ -95,8 +95,8 @@ static const int slow_statements[] =
11039e7
   /* Operate on the entire WC */
11039e7
   STMT_SELECT_ALL_NODES,                /* schema validation code */
11039e7
 
11039e7
-  /* Is there a record? ### Can we somehow check for LIMIT 1? */
11039e7
-  STMT_LOOK_FOR_WORK,
11039e7
+  /* Updates all records for a repository (designed slow) */
11039e7
+  STMT_UPDATE_LOCK_REPOS_ID,
11039e7
 
11039e7
   /* Full temporary table read */
11039e7
   STMT_INSERT_ACTUAL_EMPTIES,
11039e7
@@ -114,6 +114,19 @@ static const int slow_statements[] =
11039e7
   -1 /* final marker */
11039e7
 };
11039e7
 
11039e7
+/* Statements that just read the first record from a table,
11039e7
+   using the primary key. Specialized as different sqlite
11039e7
+   versions produce different results */
11039e7
+static const int primary_key_statements[] =
11039e7
+{
11039e7
+  /* Is there a record? ### Can we somehow check for LIMIT 1,
11039e7
+     and primary key instead of adding a list? */
11039e7
+  STMT_LOOK_FOR_WORK,
11039e7
+  STMT_SELECT_WORK_ITEM,
11039e7
+
11039e7
+  -1 /* final marker */
11039e7
+};
11039e7
+
11039e7
 /* Helper function to determine if a statement is in a list */
11039e7
 static svn_boolean_t
11039e7
 in_list(const int list[], int stmt_idx)
11039e7
@@ -529,6 +542,7 @@ is_node_table(const char *table_name)
11039e7
   return (apr_strnatcasecmp(table_name, "nodes") == 0
11039e7
           || apr_strnatcasecmp(table_name, "actual_node") == 0
11039e7
           || apr_strnatcasecmp(table_name, "externals") == 0
11039e7
+          || apr_strnatcasecmp(table_name, "lock") == 0
11039e7
           || apr_strnatcasecmp(table_name, "wc_lock") == 0
11039e7
           || FALSE);
11039e7
 }
11039e7
@@ -651,14 +665,24 @@ test_query_expectations(apr_pool_t *scra
11039e7
                        || (item->expression_vars < 1))
11039e7
                    && !is_result_table(item->table))
11039e7
             {
11039e7
-              warned = TRUE;
11039e7
-              if (!is_slow_statement(i))
11039e7
-                warnings = svn_error_createf(SVN_ERR_TEST_FAILED, warnings,
11039e7
+              if (in_list(primary_key_statements, i))
11039e7
+                {
11039e7
+                  /* Reported as primary key index usage in Sqlite 3.7,
11039e7
+                     as table scan in 3.8+, while the execution plan is
11039e7
+                     identical: read first record from table */
11039e7
+                }
11039e7
+              else if (!is_slow_statement(i))
11039e7
+                {
11039e7
+                  warned = TRUE;
11039e7
+                  warnings = svn_error_createf(SVN_ERR_TEST_FAILED, warnings,
11039e7
                                 "%s: "
11039e7
                                 "Uses %s with only %d index component: (%s)\n%s",
11039e7
                                 wc_query_info[i][0], item->table,
11039e7
                                 item->expression_vars, item->expressions,
11039e7
                                 wc_queries[i]);
11039e7
+                }
11039e7
+              else
11039e7
+                warned = TRUE;
11039e7
             }
11039e7
           else if (item->search && !item->index)
11039e7
             {