You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ph...@apache.org on 2011/05/03 12:48:44 UTC
svn commit: r1098999 - in /subversion/trunk/subversion:
libsvn_wc/wc-queries.sql libsvn_wc/wc_db.c
tests/cmdline/tree_conflict_tests.py
Author: philip
Date: Tue May 3 10:48:43 2011
New Revision: 1098999
URL: http://svn.apache.org/viewvc?rev=1098999&view=rev
Log:
Try a non-trigger approach to single-txn delete. This is sufficient
to pass all but three Python, and one C, regression tests.
* subversion/libsvn_wc/wc-queries.sql
(STMT_UPDATE_OP_DEPTH_RECURSIVE, STMT_DELETE_WORKING_NODE_NOT_DELETED,
STMT_DELETE_WORKING_ORPHAN, STMT_DROP_DELETE_LIST_TRIGGERS): Remove.
(STMT_CREATE_DELETE_LIST): Don't create triggers.
(STMT_INSERT_DELETE_LIST): New.
* subversion/libsvn_wc/wc_db.c
(op_delete_txn): Explicitly populate delete list, remove all working
nodes and if necessary insert a whole layer, handle actual nodes.
(svn_wc__db_op_delete): Don't use triggers.
* subversion/tests/cmdline/tree_conflict_tests.py
(query_absent_tree_conflicted_dir): Accept unordered delete notifications.
Modified:
subversion/trunk/subversion/libsvn_wc/wc-queries.sql
subversion/trunk/subversion/libsvn_wc/wc_db.c
subversion/trunk/subversion/tests/cmdline/tree_conflict_tests.py
Modified: subversion/trunk/subversion/libsvn_wc/wc-queries.sql
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-queries.sql?rev=1098999&r1=1098998&r2=1098999&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Tue May 3 10:48:43 2011
@@ -785,22 +785,6 @@ WHERE wc_id = ?1 AND local_relpath LIKE
UPDATE nodes SET op_depth = ?4
WHERE wc_id = ?1 AND local_relpath = ?2 AND op_depth = ?3
--- STMT_UPDATE_OP_DEPTH_RECURSIVE
-UPDATE nodes SET op_depth = ?3
-WHERE wc_id = ?1 AND local_relpath LIKE ?2 ESCAPE '#' AND op_depth > ?3
-
--- STMT_DELETE_WORKING_NODE_NOT_DELETED
-DELETE FROM nodes
-WHERE wc_id = ?1 AND local_relpath LIKE ?2 ESCAPE '#' AND op_depth > ?3
- AND presence NOT IN ('base-deleted', 'not-present')
-
--- STMT_DELETE_WORKING_ORPHAN
-DELETE FROM nodes
-WHERE wc_id = ?1 AND local_relpath LIKE ?2 ESCAPE '#' AND op_depth = ?3
-AND NOT EXISTS (SELECT 1 FROM nodes AS A
- WHERE A.wc_id = ?1
- AND A.local_relpath = nodes.local_relpath AND op_depth < ?3)
-
-- STMT_UPDATE_WORKING_TO_DELETED
UPDATE nodes SET
repos_id = NULL, repos_path = NULL, revision = NULL,
@@ -1128,17 +1112,13 @@ WHERE local_relpath = ?1 OR local_relpat
DROP TABLE IF EXISTS delete_list;
CREATE TEMPORARY TABLE delete_list (
local_relpath TEXT PRIMARY KEY
- );
-DROP TRIGGER IF EXISTS trigger_delete_list_nodes;
-CREATE TEMPORARY TRIGGER trigger_delete_list_nodes
-AFTER INSERT ON nodes
-BEGIN
- INSERT INTO delete_list(local_relpath)
- SELECT NEW.local_relpath;
-END
+ )
--- STMT_DROP_DELETE_LIST_TRIGGERS
-DROP TRIGGER IF EXISTS trigger_delete_list_nodes
+-- STMT_INSERT_DELETE_LIST
+INSERT INTO delete_list(local_relpath)
+SELECT local_relpath FROM nodes_current
+WHERE wc_id = ?1 AND (local_relpath = ?2 OR local_relpath LIKE ?3 ESCAPE '#')
+ AND presence NOT IN ('base-deleted', 'not-present')
-- STMT_SELECT_DELETE_LIST
SELECT local_relpath FROM delete_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=1098999&r1=1098998&r2=1098999&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Tue May 3 10:48:43 2011
@@ -5092,7 +5092,11 @@ op_delete_txn(void *baton,
struct op_delete_baton_t *b = baton;
svn_wc__db_status_t status;
svn_boolean_t op_root, have_base, have_work;
- svn_boolean_t add_work = FALSE, del_work = FALSE, mod_work = FALSE;
+ svn_boolean_t add_work = FALSE;
+ svn_sqlite__stmt_t *stmt;
+ const char *like_arg;
+
+ SVN_ERR(svn_sqlite__exec_statements(wcroot->sdb, STMT_CREATE_DELETE_LIST));
SVN_ERR(read_info(&status,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -5119,72 +5123,35 @@ op_delete_txn(void *baton,
if ((below_base || below_work)
&& below_status != svn_wc__db_status_not_present
&& below_status != svn_wc__db_status_deleted)
- mod_work = TRUE;
- else
- del_work = TRUE;
+ add_work = TRUE;
}
else
add_work = TRUE;
- if (del_work)
- {
- svn_sqlite__stmt_t *stmt;
- const char *like_arg = construct_like_arg(local_relpath, scratch_pool);
-
- SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
- STMT_DELETE_NODES_RECURSIVE));
- SVN_ERR(svn_sqlite__bindf(stmt, "issi",
- wcroot->wc_id, local_relpath, like_arg,
- b->delete_depth));
- SVN_ERR(svn_sqlite__step_done(stmt));
- }
- else if (add_work || mod_work)
- {
- /* To avoid notification on already deleted nodes that remain
- deleted we want to avoid removing/reinserting any such
- nodes. */
-
- svn_sqlite__stmt_t *stmt;
- const char *like_arg = construct_like_arg(local_relpath, scratch_pool);
-
- if (mod_work)
- {
- /* Reusing existing queries to delete nodes so insert below
- works, could use another single query here. */
- SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
- STMT_DELETE_WORKING_NODE));
- SVN_ERR(svn_sqlite__bindf(stmt, "is",
- wcroot->wc_id, local_relpath));
- SVN_ERR(svn_sqlite__step_done(stmt));
-
- SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
- STMT_DELETE_WORKING_NODE_NOT_DELETED));
- SVN_ERR(svn_sqlite__bindf(stmt, "isi",
- wcroot->wc_id, like_arg,
- b->delete_depth - 1));
- SVN_ERR(svn_sqlite__step_done(stmt));
- }
- else
- {
- SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
- STMT_DELETE_WORKING_NODE_NOT_DELETED));
- SVN_ERR(svn_sqlite__bindf(stmt, "isi",
- wcroot->wc_id, like_arg, b->delete_depth));
- SVN_ERR(svn_sqlite__step_done(stmt));
- }
-
- SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
- STMT_UPDATE_OP_DEPTH_RECURSIVE));
- SVN_ERR(svn_sqlite__bindf(stmt, "isi",
- wcroot->wc_id, like_arg, b->delete_depth));
- SVN_ERR(svn_sqlite__step_done(stmt));
+ like_arg = construct_like_arg(local_relpath, scratch_pool);
- SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
- STMT_DELETE_WORKING_ORPHAN));
- SVN_ERR(svn_sqlite__bindf(stmt, "isi",
- wcroot->wc_id, like_arg, b->delete_depth));
- SVN_ERR(svn_sqlite__step_done(stmt));
+ /* ### Put actual-only nodes into the list? */
+ SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+ STMT_INSERT_DELETE_LIST));
+ SVN_ERR(svn_sqlite__bindf(stmt, "iss",
+ wcroot->wc_id, local_relpath, like_arg));
+ SVN_ERR(svn_sqlite__step_done(stmt));
+ SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+ STMT_DELETE_NODES_RECURSIVE));
+ SVN_ERR(svn_sqlite__bindf(stmt, "issi",
+ wcroot->wc_id, local_relpath, like_arg,
+ b->delete_depth));
+ SVN_ERR(svn_sqlite__step_done(stmt));
+
+ SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
+ STMT_DELETE_ACTUAL_NODE_LEAVING_CHANGELIST_RECURSIVE));
+ SVN_ERR(svn_sqlite__bindf(stmt, "iss",
+ wcroot->wc_id, local_relpath, like_arg));
+ SVN_ERR(svn_sqlite__step_done(stmt));
+
+ if (add_work)
+ {
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
STMT_INSERT_WORKING_NODE_FROM_NODE_RECURSIVE));
SVN_ERR(svn_sqlite__bindf(stmt, "issi",
@@ -5204,8 +5171,6 @@ svn_wc__db_op_delete(svn_wc__db_t *db,
svn_wc__db_wcroot_t *wcroot;
const char *local_relpath;
struct op_delete_baton_t b;
- struct with_triggers_baton_t wtb = { STMT_CREATE_DELETE_LIST,
- STMT_DROP_DELETE_LIST_TRIGGERS };
SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
@@ -5214,10 +5179,8 @@ svn_wc__db_op_delete(svn_wc__db_t *db,
VERIFY_USABLE_WCROOT(wcroot);
b.delete_depth = relpath_depth(local_relpath);
- wtb.cb_baton = &b;
- wtb.cb_func = op_delete_txn;
- SVN_ERR(svn_wc__db_with_txn(wcroot, local_relpath, with_triggers, &wtb,
+ SVN_ERR(svn_wc__db_with_txn(wcroot, local_relpath, op_delete_txn, &b,
scratch_pool));
SVN_ERR(flush_entries(wcroot, local_abspath, scratch_pool));
Modified: subversion/trunk/subversion/tests/cmdline/tree_conflict_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/tree_conflict_tests.py?rev=1098999&r1=1098998&r2=1098999&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/tree_conflict_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/tree_conflict_tests.py Tue May 3 10:48:43 2011
@@ -944,8 +944,8 @@ def query_absent_tree_conflicted_dir(sbo
# Delete A/C with --keep-local, in effect disarming the tree-conflict.
run_and_verify_svn(None,
- ['D ' + C_C_path + '\n',
- 'D ' + C_path + '\n'],
+ verify.UnorderedOutput(['D ' + C_C_path + '\n',
+ 'D ' + C_path + '\n']),
[],
'delete', C_path, '--keep-local')