You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2010/09/20 22:16:16 UTC
svn commit: r999098 [6/8] - in /subversion/branches/performance: ./
subversion/bindings/javahl/native/
subversion/bindings/javahl/src/org/apache/subversion/javahl/
subversion/bindings/javahl/src/org/tigris/subversion/javahl/
subversion/bindings/javahl/...
Modified: subversion/branches/performance/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_wc/wc_db.c?rev=999098&r1=999097&r2=999098&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/branches/performance/subversion/libsvn_wc/wc_db.c Mon Sep 20 20:16:13 2010
@@ -374,6 +374,176 @@ fetch_repos_info(const char **repos_root
return svn_error_return(svn_sqlite__reset(stmt));
}
+#ifdef SVN_WC__NODES
+
+/* Can't verify if we only have the NODES table */
+#ifndef SVN_WC__NODES_ONLY
+
+/* */
+static svn_error_t *
+assert_text_columns_equal(svn_sqlite__stmt_t *stmt1,
+ svn_sqlite__stmt_t *stmt2,
+ int column,
+ apr_pool_t *scratch_pool)
+{
+ const char *val1 = svn_sqlite__column_text(stmt1, column, scratch_pool);
+ const char *val2 = svn_sqlite__column_text(stmt2, column, scratch_pool);
+
+ if (val1 != NULL && val2 != NULL) {
+ if (strcmp(val1, val2) != 0)
+ return svn_error_createf(SVN_ERR_WC_CORRUPT, NULL,
+ "Value in statement 1 (%s) differs from value in statement 2 (%s)",
+ val1, val2);
+ } else if (val1 == NULL && val2 == NULL) {
+ /* Do nothing: equal */
+ } else
+ return svn_error_createf(SVN_ERR_WC_CORRUPT, NULL,
+ "Value in statement 1 (%s) differs from value in statement 2 (%s)",
+ val1, val2);
+
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+assert_blob_columns_equal(svn_sqlite__stmt_t *stmt1,
+ svn_sqlite__stmt_t *stmt2,
+ int column,
+ apr_pool_t *scratch_pool)
+{
+ apr_size_t len1, len2;
+ const void *val1 = svn_sqlite__column_blob(stmt1, column, &len1, NULL);
+ const void *val2 = svn_sqlite__column_blob(stmt2, column, &len2, NULL);
+
+ if (!len1 && !len2)
+ return SVN_NO_ERROR;
+
+ if (len1 != len2 || memcmp(val1, val2, len1))
+ return svn_error_createf(SVN_ERR_WC_CORRUPT, NULL,
+ "Blob of length %ld in statement 1 differs "
+ "from blob of length %ld in statement 2",
+ len1, len2);
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+assert_base_rows_match(svn_boolean_t have_row1,
+ svn_boolean_t have_row2,
+ svn_sqlite__stmt_t *stmt1,
+ svn_sqlite__stmt_t *stmt2,
+ const char *relpath,
+ apr_pool_t *scratch_pool)
+{
+
+ if (have_row1 != have_row2)
+ SVN_ERR(svn_error_createf(
+ SVN_ERR_WC_CORRUPT, NULL,
+ "Different results from BASE (%d) and NODES queries (%d), "
+ "for local_relpath %s",
+ have_row1, have_row2, relpath));
+
+ if (have_row1) {
+ SVN_ERR_ASSERT(svn_sqlite__column_int64(stmt1, 0)
+ == svn_sqlite__column_int64(stmt2, 0));
+
+ SVN_ERR(assert_text_columns_equal(stmt1, stmt2, 1, scratch_pool));
+
+ SVN_ERR(assert_text_columns_equal(stmt1, stmt2, 2, scratch_pool));
+
+ SVN_ERR(assert_text_columns_equal(stmt1, stmt2, 3, scratch_pool));
+
+ SVN_ERR_ASSERT(svn_sqlite__column_revnum(stmt1, 4)
+ == svn_sqlite__column_revnum(stmt2, 4));
+
+ SVN_ERR(assert_text_columns_equal(stmt1, stmt2, 5, scratch_pool));
+
+ SVN_ERR(assert_text_columns_equal(stmt1, stmt2, 6, scratch_pool));
+
+ SVN_ERR_ASSERT(svn_sqlite__column_revnum(stmt1, 7)
+ == svn_sqlite__column_revnum(stmt2, 7));
+
+
+ SVN_ERR_ASSERT(svn_sqlite__column_int64(stmt1, 8)
+ == svn_sqlite__column_int64(stmt2, 8));
+
+ SVN_ERR(assert_text_columns_equal(stmt1, stmt2, 9, scratch_pool));
+
+ SVN_ERR(assert_text_columns_equal(stmt1, stmt2, 10, scratch_pool));
+
+ SVN_ERR(assert_text_columns_equal(stmt1, stmt2, 11, scratch_pool));
+
+ SVN_ERR_ASSERT(svn_sqlite__column_int64(stmt1, 12)
+ == svn_sqlite__column_int64(stmt2, 12));
+
+ /* verify props */
+ SVN_ERR(assert_blob_columns_equal(stmt1, stmt2, 13, scratch_pool));
+ }
+
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+assert_working_rows_match(svn_boolean_t have_row1,
+ svn_boolean_t have_row2,
+ svn_sqlite__stmt_t *stmt1,
+ svn_sqlite__stmt_t *stmt2,
+ const char *relpath,
+ apr_pool_t *scratch_pool)
+{
+ if (have_row1 != have_row2)
+ SVN_ERR(svn_error_createf(
+ SVN_ERR_WC_CORRUPT, NULL,
+ "Different results from WORKING (%d) and NODES queries (%d), "
+ "for local_relpath %s",
+ have_row1, have_row2, relpath));
+
+ if (!have_row1)
+ return SVN_NO_ERROR;
+
+ /* presence */
+ SVN_ERR(assert_text_columns_equal(stmt1, stmt2, 0, scratch_pool));
+ /* kind */
+ SVN_ERR(assert_text_columns_equal(stmt1, stmt2, 1, scratch_pool));
+ /* checksum */
+ SVN_ERR(assert_text_columns_equal(stmt1, stmt2, 2, scratch_pool));
+ /* translated_size */
+ SVN_ERR_ASSERT(svn_sqlite__column_int64(stmt1, 3)
+ == svn_sqlite__column_int64(stmt2, 3));
+ /* changed_rev */
+ SVN_ERR_ASSERT(svn_sqlite__column_int64(stmt1, 4)
+ == svn_sqlite__column_int64(stmt2, 4));
+ /* changed_date */
+ SVN_ERR_ASSERT(svn_sqlite__column_int64(stmt1, 5)
+ == svn_sqlite__column_int64(stmt2, 5));
+ /* changed_author */
+ SVN_ERR(assert_text_columns_equal(stmt1, stmt2, 6, scratch_pool));
+ /* depth */
+ SVN_ERR(assert_text_columns_equal(stmt1, stmt2, 7, scratch_pool));
+ /* symlink_target */
+ /* copyfrom_repos_id */
+ SVN_ERR_ASSERT(svn_sqlite__column_int64(stmt1, 9)
+ == svn_sqlite__column_int64(stmt2, 9));
+ /* copyfrom_repos_path */
+ SVN_ERR(assert_text_columns_equal(stmt1, stmt2, 7, scratch_pool));
+ /* copyfrom_revnum */
+ SVN_ERR_ASSERT(svn_sqlite__column_int64(stmt1, 11)
+ == svn_sqlite__column_int64(stmt2, 11));
+ /* moved_here */
+ /* moved_to */
+ /* last_mod_time */
+ SVN_ERR_ASSERT(svn_sqlite__column_int64(stmt1, 14)
+ == svn_sqlite__column_int64(stmt2, 14));
+ /* properties */
+#if 0
+ /* Disabled for now as base-deleted don't match */
+ SVN_ERR(assert_blob_columns_equal(stmt1, stmt2, 15, scratch_pool));
+#endif
+
+ return SVN_NO_ERROR;
+}
+
+#endif /* SVN_WC__NODES_ONLY */
+
+#endif /* SVN_WC__NODES */
/* Scan from LOCAL_RELPATH upwards through parent nodes until we find a parent
that has values in the 'repos_id' and 'repos_relpath' columns. Return
@@ -394,20 +564,52 @@ scan_upwards_for_repos(apr_int64_t *repo
const char *current_relpath = local_relpath;
svn_sqlite__stmt_t *stmt;
+#ifdef SVN_WC__NODES
+ svn_sqlite__stmt_t *data_stmt;
+#endif
+
SVN_ERR_ASSERT(wcroot->sdb != NULL && wcroot->wc_id != UNKNOWN_WC_ID);
SVN_ERR_ASSERT(repos_id != NULL || repos_relpath != NULL);
+#ifndef SVN_WC__NODES_ONLY
/* ### is it faster to fetch fewer columns? */
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
STMT_SELECT_BASE_NODE));
+#endif
+
+#ifdef SVN_WC__NODES
+ SVN_ERR(svn_sqlite__get_statement(&data_stmt, wcroot->sdb,
+ STMT_SELECT_BASE_NODE_1));
+#endif
while (TRUE)
{
svn_boolean_t have_row;
+#ifdef SVN_WC__NODES
+ svn_boolean_t have_data_row;
+#endif
+#ifndef SVN_WC__NODES_ONLY
/* Get the current node's repository information. */
SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, current_relpath));
SVN_ERR(svn_sqlite__step(&have_row, stmt));
+#endif
+
+#ifdef SVN_WC__NODES
+
+ /* Get the current node's repository information. */
+ SVN_ERR(svn_sqlite__bindf(data_stmt, "is",
+ wcroot->wc_id, current_relpath));
+ SVN_ERR(svn_sqlite__step(&have_data_row, data_stmt));
+
+#ifndef SVN_WC__NODES_ONLY
+ /* When switching to NODES_ONLY, stop verifying our results. */
+ SVN_ERR(assert_base_rows_match(have_row, have_data_row,
+ stmt, data_stmt,
+ current_relpath,
+ scratch_pool));
+#endif
+#endif
if (!have_row)
{
@@ -430,6 +632,9 @@ scan_upwards_for_repos(apr_int64_t *repo
svn_dirent_local_style(local_abspath, scratch_pool));
}
+#ifdef SVN_WC__NODES
+ SVN_ERR(svn_sqlite__reset(data_stmt));
+#endif
return svn_error_compose_create(err, svn_sqlite__reset(stmt));
}
@@ -449,10 +654,17 @@ scan_upwards_for_repos(apr_int64_t *repo
NULL),
relpath_suffix,
result_pool);
+#ifdef SVN_WC__NODES
+ SVN_ERR(svn_sqlite__reset(data_stmt));
+#endif
return svn_sqlite__reset(stmt);
}
+#ifdef SVN_WC__NODES
+ SVN_ERR(svn_sqlite__reset(data_stmt));
+#endif
+#ifndef SVN_WC__NODES_ONLY
SVN_ERR(svn_sqlite__reset(stmt));
-
+#endif
if (*current_relpath == '\0')
{
/* We scanned all the way up, and did not find the information.
@@ -509,27 +721,6 @@ get_statement_for_path(svn_sqlite__stmt_
}
-/* */
-static svn_error_t *
-navigate_to_parent(svn_wc__db_pdh_t **parent_pdh,
- svn_wc__db_t *db,
- svn_wc__db_pdh_t *child_pdh,
- svn_sqlite__mode_t smode,
- svn_boolean_t verify_parent_stub,
- apr_pool_t *scratch_pool)
-{
- SVN_ERR(svn_wc__db_pdh_navigate_to_parent(parent_pdh,
- db,
- child_pdh,
- smode,
- scratch_pool));
-
- SVN_ERR_ASSERT(!verify_parent_stub);
-
- return SVN_NO_ERROR;
-}
-
-
/* For a given REPOS_ROOT_URL/REPOS_UUID pair, return the existing REPOS_ID
value. If one does not exist, then create a new one. */
static svn_error_t *
@@ -588,7 +779,9 @@ static svn_error_t *
insert_base_node(void *baton, svn_sqlite__db_t *sdb, apr_pool_t *scratch_pool)
{
const insert_base_baton_t *pibb = baton;
+#ifndef SVN_WC__NODES_ONLY
svn_sqlite__stmt_t *stmt;
+#endif
#ifdef SVN_WC__NODES
svn_sqlite__stmt_t *stmt_node;
#endif
@@ -603,7 +796,7 @@ insert_base_node(void *baton, svn_sqlite
#ifndef SVN_WC__NODES_ONLY
SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_INSERT_BASE_NODE));
- SVN_ERR(svn_sqlite__bindf(stmt, "isisstti",
+ SVN_ERR(svn_sqlite__bindf(stmt, "isissttr",
pibb->wc_id, pibb->local_relpath,
pibb->repos_id,
pibb->repos_relpath,
@@ -647,34 +840,39 @@ insert_base_node(void *baton, svn_sqlite
#endif
#ifdef SVN_WC__NODES
- /* the 'r' binding below doesn't work yet...
- no idea why; needs more investigation... */
SVN_ERR(svn_sqlite__get_statement(&stmt_node, sdb, STMT_INSERT_NODE));
- { svn_revnum_t rev = pibb->changed_rev;
- SVN_ERR(svn_sqlite__bindf(stmt_node, "isisnnn" /* No repos rev, id, path */
+ SVN_ERR(svn_sqlite__bindf(stmt_node, "isisisr"
"tstr" /* 8 - 11 */
"isnnnnns", /* 12 - 19 */
pibb->wc_id, /* 1 */
pibb->local_relpath, /* 2 */
(apr_int64_t)0, /* op_depth is 0 for base */
parent_relpath, /* 4 */
+ pibb->repos_id,
+ pibb->repos_relpath,
+ pibb->revision,
presence_map, pibb->status, /* 8 */
(pibb->kind == svn_wc__db_kind_dir) ? /* 9 */
svn_depth_to_word(pibb->depth) : NULL,
kind_map, pibb->kind, /* 10 */
- rev, /* 11 */
+ pibb->changed_rev, /* 11 */
pibb->changed_date, /* 12 */
pibb->changed_author, /* 13 */
(pibb->kind == svn_wc__db_kind_symlink) ?
pibb->target : NULL)); /* 19 */
- }
- if (pibb->kind == svn_wc__db_kind_file)
+ if (pibb->kind == svn_wc__db_kind_file) {
SVN_ERR(svn_sqlite__bind_checksum(stmt_node, 14, pibb->checksum,
scratch_pool));
+ if (pibb->translated_size != SVN_INVALID_FILESIZE)
+ SVN_ERR(svn_sqlite__bind_int64(stmt_node, 16, pibb->translated_size));
+ }
SVN_ERR(svn_sqlite__bind_properties(stmt_node, 15, pibb->props,
scratch_pool));
+ if (pibb->dav_cache)
+ SVN_ERR(svn_sqlite__bind_properties(stmt_node, 18, pibb->dav_cache,
+ scratch_pool));
SVN_ERR(svn_sqlite__insert(NULL, stmt_node));
#endif
@@ -697,7 +895,7 @@ insert_base_node(void *baton, svn_sqlite
const char *name = APR_ARRAY_IDX(pibb->children, i, const char *);
#ifndef SVN_WC__NODES_ONLY
- SVN_ERR(svn_sqlite__bindf(stmt, "issi",
+ SVN_ERR(svn_sqlite__bindf(stmt, "issr",
pibb->wc_id,
svn_relpath_join(pibb->local_relpath,
name,
@@ -707,13 +905,14 @@ insert_base_node(void *baton, svn_sqlite
SVN_ERR(svn_sqlite__insert(NULL, stmt));
#endif
#ifdef SVN_WC__NODES
- SVN_ERR(svn_sqlite__bindf(stmt_node, "isisnnnsns",
+ SVN_ERR(svn_sqlite__bindf(stmt_node, "isisnnrsns",
pibb->wc_id,
svn_relpath_join(pibb->local_relpath,
name,
scratch_pool),
(apr_int64_t)0 /* BASE */,
pibb->local_relpath, /* parent_relpath */
+ pibb->revision,
"incomplete",
"unknown"));
SVN_ERR(svn_sqlite__insert(NULL, stmt_node));
@@ -747,39 +946,28 @@ copy_working_from_base(void *baton,
const insert_working_baton_t *piwb = baton;
svn_sqlite__stmt_t *stmt;
-#ifdef SVN_WC__NODE_DATA
- /* Insert NODE_DATA stuff */
+#ifdef SVN_WC__NODES
+
SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
- STMT_INSERT_WORKING_NODE_DATA_FROM_BASE_NODE_1));
- SVN_ERR(svn_sqlite__bindf(stmt, "isti", piwb->wc_id,
+ STMT_INSERT_WORKING_NODE_FROM_BASE));
+ SVN_ERR(svn_sqlite__bindf(stmt, "isit", piwb->wc_id,
piwb->local_relpath,
- presence_map, piwb->presence,
- piwb->op_depth));
+ piwb->op_depth,
+ presence_map, piwb->presence));
SVN_ERR(svn_sqlite__insert(NULL, stmt));
-#if 0
- /* This doesn't work yet, due to the fact that other constraints
- are active on the WORKING NODE table while we haven't removed the
- NODE_TABLE columns. */
-
- /* Insert WORKING_NODE stuff */
- SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
- STMT_INSERT_WORKING_NODE_DATA_FROM_BASE_NODE_2));
- SVN_ERR(svn_sqlite__bindf(stmt, "is", piwb->wc_id, piwb->local_relpath));
- SVN_ERR(svn_sqlite__insert(NULL, stmt));
-#endif
#endif
+#ifndef SVN_WC__NODES_ONLY
/* Run the sequence below instead, which copies all the columns, including
- those with the restrictions
-
- ### REMOVE when fully migrating to NODE_DATA */
+ those with the restrictions */
SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
STMT_INSERT_WORKING_NODE_FROM_BASE_NODE));
SVN_ERR(svn_sqlite__bindf(stmt, "ist", piwb->wc_id, piwb->local_relpath,
presence_map, piwb->presence));
SVN_ERR(svn_sqlite__step_done(stmt));
+#endif
return SVN_NO_ERROR;
}
@@ -849,8 +1037,10 @@ insert_working_node(void *baton,
{
const insert_working_baton_t *piwb = baton;
const char *parent_relpath;
+#ifndef SVN_WC__NODES_ONLY
svn_sqlite__stmt_t *stmt;
-#ifdef SVN_WC__NODE_DATA
+#endif
+#ifdef SVN_WC__NODES
svn_sqlite__stmt_t *stmt_node;
apr_int64_t op_depth;
#endif
@@ -863,6 +1053,7 @@ insert_working_node(void *baton,
else
parent_relpath = svn_relpath_dirname(piwb->local_relpath, scratch_pool);
+#ifndef SVN_WC__NODES_ONLY
SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_INSERT_WORKING_NODE));
SVN_ERR(svn_sqlite__bindf(stmt, "isstt",
piwb->wc_id, piwb->local_relpath,
@@ -918,55 +1109,51 @@ insert_working_node(void *baton,
SVN_ERR(svn_sqlite__insert(NULL, stmt));
+#endif
-#ifdef SVN_WC__NODE_DATA
+#ifdef SVN_WC__NODES
op_depth = (parent_relpath == NULL) ? 1 /* THIS_DIR */
: 2; /* immediate children */
- SVN_ERR(svn_sqlite__get_statement(&stmt_node, sdb, STMT_INSERT_NODE_DATA));
- SVN_ERR(svn_sqlite__bindf(stmt_node, "isistt",
- piwb->wc_id, piwb->local_relpath,
- op_depth,
- parent_relpath,
- presence_map, piwb->presence,
- kind_map, piwb->kind));
+ SVN_ERR(svn_sqlite__get_statement(&stmt_node, sdb, STMT_INSERT_NODE));
+ SVN_ERR(svn_sqlite__bindf(stmt_node, "isisnnntstrisn"
+ "nnnn" /* properties translated_size last_mod_time dav_cache */
+ "s",
+ piwb->wc_id, piwb->local_relpath,
+ op_depth,
+ parent_relpath,
+ presence_map, piwb->presence,
+ (piwb->kind == svn_wc__db_kind_dir)
+ ? svn_depth_to_word(piwb->depth) : NULL,
+ kind_map, piwb->kind,
+ piwb->changed_rev,
+ piwb->changed_date,
+ piwb->changed_author,
+ (piwb->kind == svn_wc__db_kind_symlink)
+ ? piwb->target : NULL));
- if (SVN_IS_VALID_REVNUM(piwb->changed_rev))
- SVN_ERR(svn_sqlite__bind_int64(stmt_node, 7, piwb->changed_rev));
- if (piwb->changed_date)
- SVN_ERR(svn_sqlite__bind_int64(stmt_node, 8, piwb->changed_date));
- if (piwb->changed_author)
- SVN_ERR(svn_sqlite__bind_text(stmt_node, 9, piwb->changed_author));
- if (piwb->kind == svn_wc__db_kind_dir)
- {
- SVN_ERR(svn_sqlite__bind_text(stmt_node, 10,
- svn_depth_to_word(piwb->depth)));
- }
- else if (piwb->kind == svn_wc__db_kind_file)
+ if (piwb->kind == svn_wc__db_kind_file)
{
- SVN_ERR(svn_sqlite__bind_checksum(stmt_node, 11, piwb->checksum,
+ SVN_ERR(svn_sqlite__bind_checksum(stmt_node, 14, piwb->checksum,
scratch_pool));
}
else if (piwb->kind == svn_wc__db_kind_symlink)
{
/* Note: incomplete nodes may have a NULL target. */
if (piwb->target)
- SVN_ERR(svn_sqlite__bind_text(stmt_node, 12, piwb->target));
+ SVN_ERR(svn_sqlite__bind_text(stmt_node, 19, piwb->target));
}
if (piwb->original_repos_relpath != NULL)
{
- SVN_ERR(svn_sqlite__bind_int64(stmt_node, 13, piwb->original_repos_id));
- SVN_ERR(svn_sqlite__bind_text(stmt_node, 14,
+ SVN_ERR(svn_sqlite__bind_int64(stmt_node, 5, piwb->original_repos_id));
+ SVN_ERR(svn_sqlite__bind_text(stmt_node, 6,
piwb->original_repos_relpath));
- SVN_ERR(svn_sqlite__bind_int64(stmt_node, 15, piwb->original_revnum));
+ SVN_ERR(svn_sqlite__bind_int64(stmt_node, 7, piwb->original_revnum));
}
- /* Don't bind original_repos_id, original_repos_path and original_revision */
-
-
- SVN_ERR(svn_sqlite__bind_properties(stmt_node, 16, piwb->props,
+ SVN_ERR(svn_sqlite__bind_properties(stmt_node, 15, piwb->props,
scratch_pool));
SVN_ERR(svn_sqlite__insert(NULL, stmt_node));
@@ -1393,11 +1580,6 @@ create_db(svn_sqlite__db_t **sdb,
/* Create the database's schema. */
SVN_ERR(svn_sqlite__exec_statements(*sdb, STMT_CREATE_SCHEMA));
-#ifdef SVN_WC__NODE_DATA
- /* Create the NODE_DATA table for the experimental schema */
- SVN_ERR(svn_sqlite__exec_statements(*sdb, STMT_CREATE_NODE_DATA));
-#endif
-
#ifdef SVN_WC__NODES
/* Create the NODES table for the experimental schema */
SVN_ERR(svn_sqlite__exec_statements(*sdb, STMT_CREATE_NODES));
@@ -1834,18 +2016,18 @@ svn_wc__db_base_add_symlink(svn_wc__db_t
}
-svn_error_t *
-svn_wc__db_base_add_absent_node(svn_wc__db_t *db,
- const char *local_abspath,
- const char *repos_relpath,
- const char *repos_root_url,
- const char *repos_uuid,
- svn_revnum_t revision,
- svn_wc__db_kind_t kind,
- svn_wc__db_status_t status,
- const svn_skel_t *conflict,
- const svn_skel_t *work_items,
- apr_pool_t *scratch_pool)
+static svn_error_t *
+add_absent_excluded_not_present_node(svn_wc__db_t *db,
+ const char *local_abspath,
+ const char *repos_relpath,
+ const char *repos_root_url,
+ const char *repos_uuid,
+ svn_revnum_t revision,
+ svn_wc__db_kind_t kind,
+ svn_wc__db_status_t status,
+ const svn_skel_t *conflict,
+ const svn_skel_t *work_items,
+ apr_pool_t *scratch_pool)
{
svn_wc__db_pdh_t *pdh;
const char *local_relpath;
@@ -1904,6 +2086,46 @@ svn_wc__db_base_add_absent_node(svn_wc__
svn_error_t *
+svn_wc__db_base_add_absent_node(svn_wc__db_t *db,
+ const char *local_abspath,
+ const char *repos_relpath,
+ const char *repos_root_url,
+ const char *repos_uuid,
+ svn_revnum_t revision,
+ svn_wc__db_kind_t kind,
+ svn_wc__db_status_t status,
+ const svn_skel_t *conflict,
+ const svn_skel_t *work_items,
+ apr_pool_t *scratch_pool)
+{
+ SVN_ERR_ASSERT(status == svn_wc__db_status_absent
+ || status == svn_wc__db_status_excluded);
+
+ return add_absent_excluded_not_present_node(
+ db, local_abspath, repos_relpath, repos_root_url, repos_uuid, revision,
+ kind, status, conflict, work_items, scratch_pool);
+}
+
+
+svn_error_t *
+svn_wc__db_base_add_not_present_node(svn_wc__db_t *db,
+ const char *local_abspath,
+ const char *repos_relpath,
+ const char *repos_root_url,
+ const char *repos_uuid,
+ svn_revnum_t revision,
+ svn_wc__db_kind_t kind,
+ const svn_skel_t *conflict,
+ const svn_skel_t *work_items,
+ apr_pool_t *scratch_pool)
+{
+ return add_absent_excluded_not_present_node(
+ db, local_abspath, repos_relpath, repos_root_url, repos_uuid, revision,
+ kind, svn_wc__db_status_not_present, conflict, work_items, scratch_pool);
+}
+
+
+svn_error_t *
svn_wc__db_base_remove(svn_wc__db_t *db,
const char *local_abspath,
apr_pool_t *scratch_pool)
@@ -1919,15 +2141,17 @@ svn_wc__db_base_remove(svn_wc__db_t *db,
scratch_pool, scratch_pool));
VERIFY_USABLE_PDH(pdh);
+#ifndef SVN_WC__NODES_ONLY
SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
STMT_DELETE_BASE_NODE));
SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
SVN_ERR(svn_sqlite__step_done(stmt));
+#endif
-#ifdef SVN_WC__NODE_DATA
+#ifdef SVN_WC__NODES
SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
- STMT_DELETE_NODE_DATA_BASE));
+ STMT_DELETE_BASE_NODE_1));
SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
SVN_ERR(svn_sqlite__step_done(stmt));
@@ -1964,6 +2188,10 @@ svn_wc__db_base_get_info(svn_wc__db_stat
const char *local_relpath;
svn_sqlite__stmt_t *stmt;
svn_boolean_t have_row;
+#ifdef SVN_WC__NODES
+ svn_sqlite__stmt_t *stmt_nodes;
+ svn_boolean_t have_node_row;
+#endif
svn_error_t *err = SVN_NO_ERROR;
SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
@@ -1973,11 +2201,32 @@ svn_wc__db_base_get_info(svn_wc__db_stat
scratch_pool, scratch_pool));
VERIFY_USABLE_PDH(pdh);
+#ifndef SVN_WC__NODES_ONLY
SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
lock ? STMT_SELECT_BASE_NODE_WITH_LOCK
: STMT_SELECT_BASE_NODE));
SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
SVN_ERR(svn_sqlite__step(&have_row, stmt));
+#endif
+
+#ifdef SVN_WC__NODES
+ SVN_ERR(svn_sqlite__get_statement(&stmt_nodes, pdh->wcroot->sdb,
+ lock ? STMT_SELECT_BASE_NODE_WITH_LOCK_1
+ : STMT_SELECT_BASE_NODE_1));
+ SVN_ERR(svn_sqlite__bindf(stmt_nodes, "is",
+ pdh->wcroot->wc_id, local_relpath));
+ SVN_ERR(svn_sqlite__step(&have_node_row, stmt_nodes));
+
+#ifndef SVN_WC__NODES_ONLY
+ SVN_ERR(assert_base_rows_match(have_row, have_node_row, stmt, stmt_nodes,
+ local_relpath, scratch_pool));
+#else
+ /* Lets assume the two queries return compatible data */
+ have_row = have_node_row;
+ stmt = stmt_nodes;
+#endif
+
+#endif /* SVN_WC__NODES */
if (have_row)
{
@@ -2108,6 +2357,12 @@ svn_wc__db_base_get_info(svn_wc__db_stat
scratch_pool));
}
+#ifdef SVN_WC__NODES
+#ifndef SVN_WC__NODES_ONLY
+ SVN_ERR(svn_sqlite__reset(stmt_nodes));
+#endif
+#endif
+
/* Note: given the composition, no need to wrap for tracing. */
return svn_error_compose_create(err, svn_sqlite__reset(stmt));
}
@@ -2238,10 +2493,29 @@ svn_wc__db_base_get_props(apr_hash_t **p
svn_sqlite__stmt_t *stmt;
svn_boolean_t have_row;
svn_error_t *err;
+#ifdef SVN_WC__NODES
+ svn_sqlite__stmt_t *stmt_node;
+ svn_boolean_t have_node_row;
+#endif
+#ifndef SVN_WC__NODES_ONLY
SVN_ERR(get_statement_for_path(&stmt, db, local_abspath,
STMT_SELECT_BASE_PROPS, scratch_pool));
SVN_ERR(svn_sqlite__step(&have_row, stmt));
+#endif
+#ifdef SVN_WC__NODES
+ SVN_ERR(get_statement_for_path(&stmt_node, db, local_abspath,
+ STMT_SELECT_BASE_PROPS_1, scratch_pool));
+ SVN_ERR(svn_sqlite__step(&have_node_row, stmt_node));
+#ifndef SVN_WC__NODES_ONLY
+ SVN_ERR_ASSERT(have_row == have_node_row);
+ SVN_ERR(assert_blob_columns_equal(stmt, stmt_node, 0, scratch_pool));
+ SVN_ERR(svn_sqlite__reset(stmt_node));
+#else
+ stmt = stmt_node;
+ have_row = have_node_row;
+#endif
+#endif
if (!have_row)
{
err = svn_sqlite__reset(stmt);
@@ -2285,6 +2559,7 @@ svn_wc__db_base_set_dav_cache(svn_wc__db
svn_sqlite__stmt_t *stmt;
int affected_rows;
+#ifndef SVN_WC__NODES_ONLY
SVN_ERR(get_statement_for_path(&stmt, db, local_abspath,
STMT_UPDATE_BASE_DAV_CACHE, scratch_pool));
SVN_ERR(svn_sqlite__bind_properties(stmt, 3, props, scratch_pool));
@@ -2296,6 +2571,21 @@ svn_wc__db_base_set_dav_cache(svn_wc__db
_("The node '%s' was not found."),
svn_dirent_local_style(local_abspath,
scratch_pool));
+#endif
+#ifdef SVN_WC__NODES
+ SVN_ERR(get_statement_for_path(&stmt, db, local_abspath,
+ STMT_UPDATE_BASE_NODE_DAV_CACHE,
+ scratch_pool));
+ SVN_ERR(svn_sqlite__bind_properties(stmt, 3, props, scratch_pool));
+
+ SVN_ERR(svn_sqlite__update(&affected_rows, stmt));
+
+ if (affected_rows != 1)
+ return svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND, NULL,
+ _("The node '%s' was not found."),
+ svn_dirent_local_style(local_abspath,
+ scratch_pool));
+#endif
return SVN_NO_ERROR;
}
@@ -2350,11 +2640,23 @@ svn_wc__db_base_clear_dav_cache_recursiv
escape_sqlite_like(local_relpath, scratch_pool),
"/%", NULL);
+#ifndef SVN_WC__NODES_ONLY
SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
STMT_CLEAR_BASE_RECURSIVE_DAV_CACHE));
SVN_ERR(svn_sqlite__bindf(stmt, "iss", pdh->wcroot->wc_id, local_relpath,
like_arg));
- return svn_error_return(svn_sqlite__step_done(stmt));
+ SVN_ERR(svn_sqlite__step_done(stmt));
+#endif
+#ifdef SVN_WC__NODES
+ SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
+ STMT_CLEAR_BASE_NODE_RECURSIVE_DAV_CACHE));
+ SVN_ERR(svn_sqlite__bindf(stmt, "iss", pdh->wcroot->wc_id, local_relpath,
+ like_arg));
+
+ SVN_ERR(svn_sqlite__step_done(stmt));
+#endif
+
+ return SVN_NO_ERROR;
}
svn_error_t *
@@ -3203,7 +3505,6 @@ svn_wc__db_op_copy(svn_wc__db_t *db,
scratch_pool));
}
- /* Get the children for a directory if this is not the parent stub */
if (kind == svn_wc__db_kind_dir)
SVN_ERR(gather_children(&children, FALSE, db, src_abspath,
scratch_pool, scratch_pool));
@@ -3216,6 +3517,7 @@ svn_wc__db_op_copy(svn_wc__db_t *db,
const char *dst_parent_relpath = svn_relpath_dirname(dst_relpath,
scratch_pool);
+#ifndef SVN_WC__NODES_ONLY
if (have_work)
SVN_ERR(svn_sqlite__get_statement(&stmt, src_pdh->wcroot->sdb,
STMT_INSERT_WORKING_NODE_COPY_FROM_WORKING));
@@ -3235,17 +3537,18 @@ svn_wc__db_op_copy(svn_wc__db_t *db,
SVN_ERR(svn_sqlite__bind_int64(stmt, 8, copyfrom_rev));
}
SVN_ERR(svn_sqlite__step_done(stmt));
+#endif
-#ifdef SVN_WC__NODE_DATA
+#ifdef SVN_WC__NODES
if (have_work)
SVN_ERR(svn_sqlite__get_statement(&stmt, src_pdh->wcroot->sdb,
- STMT_INSERT_WORKING_NODE_DATA_COPY_FROM_WORKING_1));
+ STMT_INSERT_WORKING_NODE_COPY_FROM_WORKING_1));
else
SVN_ERR(svn_sqlite__get_statement(&stmt, src_pdh->wcroot->sdb,
- STMT_INSERT_WORKING_NODE_DATA_COPY_FROM_BASE_1));
+ STMT_INSERT_WORKING_NODE_COPY_FROM_BASE_1));
- SVN_ERR(svn_sqlite__bindf(stmt, "issist",
+ SVN_ERR(svn_sqlite__bindf(stmt, "issisnnnt",
src_pdh->wcroot->wc_id, src_relpath,
dst_relpath,
(children == NULL) ? (apr_int64_t)2 :
@@ -3255,28 +3558,12 @@ svn_wc__db_op_copy(svn_wc__db_t *db,
if (copyfrom_relpath)
{
- SVN_ERR(svn_sqlite__bind_int64(stmt, 7, copyfrom_id));
- SVN_ERR(svn_sqlite__bind_text(stmt, 8, copyfrom_relpath));
- SVN_ERR(svn_sqlite__bind_int64(stmt, 9, copyfrom_rev));
+ SVN_ERR(svn_sqlite__bind_int64(stmt, 6, copyfrom_id));
+ SVN_ERR(svn_sqlite__bind_text(stmt, 7, copyfrom_relpath));
+ SVN_ERR(svn_sqlite__bind_int64(stmt, 8, copyfrom_rev));
}
SVN_ERR(svn_sqlite__step_done(stmt));
-#if 0
- /* ### NODE_DATA the section below can only be enabled once we stop
- running STMT_INSERT_WORKING_NODE_COPY_FROM_{BASE,WORKING} above */
- if (have_work)
- SVN_ERR(svn_sqlite__get_statement(&stmt, src_pdh->wcroot->sdb,
- STMT_INSERT_WORKING_NODE_DATA_COPY_FROM_WORKING_2));
- else
- SVN_ERR(svn_sqlite__get_statement(&stmt, src_pdh->wcroot->sdb,
- STMT_INSERT_WORKING_NODE_DATA_COPY_FROM_BASE_2));
-
- SVN_ERR(svn_sqlite__bindf(stmt, "isss",
- src_pdh->wcroot->wc_id, src_relpath,
- dst_relpath, dst_parent_relpath));
-
- SVN_ERR(svn_sqlite__step_done(stmt));
-#endif
#endif
/* ### Copying changelist is OK for a move but what about a copy? */
@@ -3749,15 +4036,20 @@ svn_wc__db_temp_base_set_props(svn_wc__d
const apr_hash_t *props,
apr_pool_t *scratch_pool)
{
-#ifdef SVN_WC__NODE_DATA
+#ifdef SVN_WC__NODES
SVN_ERR(set_properties(db, local_abspath, props,
- STMT_UPDATE_NODE_DATA_BASE_PROPS,
+ STMT_UPDATE_NODE_BASE_PROPS,
"base node", scratch_pool));
#endif
+
+#ifndef SVN_WC__NODES_ONLY
return svn_error_return(set_properties(db, local_abspath, props,
STMT_UPDATE_BASE_PROPS,
"base_node",
scratch_pool));
+#else
+ return SVN_NO_ERROR;
+#endif
}
@@ -3767,15 +4059,20 @@ svn_wc__db_temp_working_set_props(svn_wc
const apr_hash_t *props,
apr_pool_t *scratch_pool)
{
-#ifdef SVN_WC__NODE_DATA
+#ifdef SVN_WC__NODES
SVN_ERR(set_properties(db, local_abspath, props,
- STMT_UPDATE_NODE_DATA_WORKING_PROPS,
+ STMT_UPDATE_NODE_WORKING_PROPS,
"working node", scratch_pool));
#endif
+
+#ifndef SVN_WC__NODES_ONLY
return svn_error_return(set_properties(db, local_abspath, props,
STMT_UPDATE_WORKING_PROPS,
"working_node",
scratch_pool));
+#else
+ return SVN_NO_ERROR;
+#endif
}
#endif /* SVN__SUPPORT_BASE_MERGE */
@@ -4195,6 +4492,7 @@ svn_wc__db_temp_op_remove_entry(svn_wc__
sdb = pdh->wcroot->sdb;
wc_id = pdh->wcroot->wc_id;
+#ifndef SVN_WC__NODES_ONLY
SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_DELETE_BASE_NODE));
SVN_ERR(svn_sqlite__bindf(stmt, "is", wc_id, local_relpath));
SVN_ERR(svn_sqlite__step_done(stmt));
@@ -4202,10 +4500,11 @@ svn_wc__db_temp_op_remove_entry(svn_wc__
SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_DELETE_WORKING_NODE));
SVN_ERR(svn_sqlite__bindf(stmt, "is", wc_id, local_relpath));
SVN_ERR(svn_sqlite__step_done(stmt));
+#endif
-#ifdef SVN_WC__NODE_DATA
- SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_DELETE_NODE_DATA_LAYERS));
- SVN_ERR(svn_sqlite__bindf(stmt, "isi", wc_id, local_relpath, (apr_int64_t)0));
+#ifdef SVN_WC__NODES
+ SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_DELETE_NODES));
+ SVN_ERR(svn_sqlite__bindf(stmt, "is", wc_id, local_relpath));
SVN_ERR(svn_sqlite__step_done(stmt));
#endif
@@ -4236,14 +4535,16 @@ svn_wc__db_temp_op_remove_working(svn_wc
SVN_ERR(flush_entries(db, pdh, local_abspath, scratch_pool));
+#ifndef SVN_WC__NODES_ONLY
SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
STMT_DELETE_WORKING_NODE));
SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
SVN_ERR(svn_sqlite__step_done(stmt));
+#endif
-#ifdef SVN_WC__NODE_DATA
+#ifdef SVN_WC__NODES
SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
- STMT_DELETE_NODE_DATA_WORKING));
+ STMT_DELETE_WORKING_NODES));
SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
SVN_ERR(svn_sqlite__step_done(stmt));
#endif
@@ -4266,6 +4567,7 @@ update_depth_values(svn_wc__db_t *db,
/* Flush any entries before we start monkeying the database. */
SVN_ERR(flush_entries(db, pdh, local_abspath, scratch_pool));
+#ifndef SVN_WC__NODES_ONLY
SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
excluded
? STMT_UPDATE_BASE_EXCLUDED
@@ -4274,8 +4576,9 @@ update_depth_values(svn_wc__db_t *db,
if (!excluded)
SVN_ERR(svn_sqlite__bind_text(stmt, 3, svn_depth_to_word(depth)));
SVN_ERR(svn_sqlite__step_done(stmt));
+#endif
-#ifdef SVN_WC__NODE_DATA
+#ifdef SVN_WC__NODES
SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
excluded
? STMT_UPDATE_NODE_BASE_EXCLUDED
@@ -4286,6 +4589,7 @@ update_depth_values(svn_wc__db_t *db,
SVN_ERR(svn_sqlite__step_done(stmt));
#endif
+#ifndef SVN_WC__NODES_ONLY
SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
excluded
? STMT_UPDATE_WORKING_EXCLUDED
@@ -4294,8 +4598,9 @@ update_depth_values(svn_wc__db_t *db,
if (!excluded)
SVN_ERR(svn_sqlite__bind_text(stmt, 3, svn_depth_to_word(depth)));
SVN_ERR(svn_sqlite__step_done(stmt));
+#endif
-#ifdef SVN_WC__NODE_DATA
+#ifdef SVN_WC__NODES
SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
excluded
? STMT_UPDATE_NODE_WORKING_EXCLUDED
@@ -4354,13 +4659,15 @@ db_working_update_presence(svn_wc__db_st
scratch_pool, scratch_pool));
VERIFY_USABLE_PDH(pdh);
+#ifndef SVN_WC__NODES_ONLY
SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
STMT_UPDATE_WORKING_PRESENCE));
SVN_ERR(svn_sqlite__bindf(stmt, "ist", pdh->wcroot->wc_id, local_relpath,
presence_map, status));
SVN_ERR(svn_sqlite__step_done(stmt));
+#endif
-#ifdef SVN_WC__NODE_DATA
+#ifdef SVN_WC__NODES
SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
STMT_UPDATE_NODE_WORKING_PRESENCE));
SVN_ERR(svn_sqlite__bindf(stmt, "ist", pdh->wcroot->wc_id, local_relpath,
@@ -4389,14 +4696,16 @@ db_working_actual_remove(svn_wc__db_t *d
VERIFY_USABLE_PDH(pdh);
+#ifndef SVN_WC__NODES_ONLY
SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
STMT_DELETE_WORKING_NODE));
SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
SVN_ERR(svn_sqlite__step_done(stmt));
+#endif
-#ifdef SVN_WC__NODE_DATA
+#ifdef SVN_WC__NODES
SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
- STMT_DELETE_NODE_DATA_WORKING));
+ STMT_DELETE_WORKING_NODES));
SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
SVN_ERR(svn_sqlite__step_done(stmt));
#endif
@@ -4705,6 +5014,12 @@ svn_wc__db_read_info(svn_wc__db_status_t
svn_boolean_t local_have_base;
svn_boolean_t local_have_work;
svn_boolean_t have_act;
+#ifdef SVN_WC__NODES
+ svn_sqlite__stmt_t *stmt_nodes_base;
+ svn_sqlite__stmt_t *stmt_nodes_work;
+ svn_boolean_t local_have_nodes_base;
+ svn_boolean_t local_have_nodes_work;
+#endif
svn_error_t *err = NULL;
SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
@@ -4738,6 +5053,39 @@ svn_wc__db_read_info(svn_wc__db_status_t
pdh->wcroot->wc_id, local_relpath));
SVN_ERR(svn_sqlite__step(&have_act, stmt_act));
+#ifdef SVN_WC__NODES
+ SVN_ERR(svn_sqlite__get_statement(&stmt_nodes_base, pdh->wcroot->sdb,
+ lock ? STMT_SELECT_BASE_NODE_WITH_LOCK_1
+ : STMT_SELECT_BASE_NODE_1));
+ SVN_ERR(svn_sqlite__bindf(stmt_nodes_base, "is",
+ pdh->wcroot->wc_id, local_relpath));
+ SVN_ERR(svn_sqlite__step(&local_have_nodes_base, stmt_nodes_base));
+
+ /* Possible optimisation: if we didn't select op_depth > 0 then this
+ would give us the base node when there is no working node. */
+ SVN_ERR(svn_sqlite__get_statement(&stmt_nodes_work, pdh->wcroot->sdb,
+ STMT_SELECT_WORKING_NODE_1));
+ SVN_ERR(svn_sqlite__bindf(stmt_nodes_work, "is",
+ pdh->wcroot->wc_id, local_relpath));
+ SVN_ERR(svn_sqlite__step(&local_have_nodes_work, stmt_nodes_work));
+
+#ifndef SVN_WC__NODES_ONLY
+ SVN_ERR(assert_base_rows_match(*have_base, local_have_nodes_base,
+ stmt_base, stmt_nodes_base,
+ local_relpath, scratch_pool));
+ SVN_ERR(assert_working_rows_match(*have_work, local_have_nodes_work,
+ stmt_work, stmt_nodes_work,
+ local_relpath, scratch_pool));
+#else
+ /* Lets assume the queries return compatible data */
+ *have_base = local_have_nodes_base;
+ *have_work = local_have_nodes_work;
+ stmt_base = stmt_nodes_base;
+ stmt_work = stmt_nodes_work;
+#endif
+
+#endif /* SVN_WC__NODES */
+
if (*have_base || *have_work)
{
svn_wc__db_kind_t node_kind;
@@ -5038,6 +5386,13 @@ svn_wc__db_read_info(svn_wc__db_status_t
scratch_pool));
}
+#ifdef SVN_WC__NODES
+#ifndef SVN_WC__NODES_ONLY
+ err = svn_error_compose_create(err, svn_sqlite__reset(stmt_nodes_base));
+ err = svn_error_compose_create(err, svn_sqlite__reset(stmt_nodes_work));
+#endif
+#endif
+
err = svn_error_compose_create(err, svn_sqlite__reset(stmt_base));
err = svn_error_compose_create(err, svn_sqlite__reset(stmt_work));
SVN_ERR(svn_error_compose_create(err, svn_sqlite__reset(stmt_act)));
@@ -5139,10 +5494,34 @@ svn_wc__db_read_pristine_props(apr_hash_
{
svn_sqlite__stmt_t *stmt;
svn_boolean_t have_row;
+#ifdef SVN_WC__NODES
+ svn_sqlite__stmt_t *stmt_node;
+ svn_boolean_t have_node_row;
+#endif
+#ifndef SVN_WC__NODES_ONLY
SVN_ERR(get_statement_for_path(&stmt, db, local_abspath,
STMT_SELECT_WORKING_PROPS, scratch_pool));
SVN_ERR(svn_sqlite__step(&have_row, stmt));
+#endif
+
+#ifdef SVN_WC__NODES
+ SVN_ERR(get_statement_for_path(&stmt_node, db, local_abspath,
+ STMT_SELECT_WORKING_PROPS_1, scratch_pool));
+ SVN_ERR(svn_sqlite__step(&have_node_row, stmt_node));
+
+#ifndef SVN_WC__NODES_ONLY
+ SVN_ERR_ASSERT(have_row == have_node_row);
+#if 0
+ /* Disabled for now as base-deleted don't match */
+ SVN_ERR(assert_blob_columns_equal(stmt, stmt_node, 0, scratch_pool));
+#endif
+ SVN_ERR(svn_sqlite__reset(stmt_node));
+#else
+ stmt = stmt_node;
+ have_row = have_node_row;
+#endif
+#endif
/* If there is a WORKING row, then examine its status:
@@ -5237,16 +5616,19 @@ relocate_txn(void *baton, svn_sqlite__db
escape_sqlite_like(rb->local_relpath, scratch_pool),
"/%", NULL);
+#ifndef SVN_WC__NODES_ONLY
/* Update non-NULL WORKING_NODE.copyfrom_repos_id. */
SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
STMT_UPDATE_WORKING_RECURSIVE_COPYFROM_REPO));
SVN_ERR(svn_sqlite__bindf(stmt, "issi", rb->wc_id, rb->local_relpath,
like_arg, new_repos_id));
SVN_ERR(svn_sqlite__step_done(stmt));
+#endif
-#ifdef SVN_WC__NODE_DATA
+#ifdef SVN_WC__NODES
+ /* Set the (base and working) repos_ids and clear the dav_caches */
SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
- STMT_UPDATE_NODE_DATA_RECURSIVE_ORIGINAL_REPO));
+ STMT_RECURSIVE_UPDATE_NODE_REPO));
SVN_ERR(svn_sqlite__bindf(stmt, "issii",
rb->wc_id, rb->local_relpath,
like_arg, rb->old_repos_id,
@@ -5258,6 +5640,7 @@ relocate_txn(void *baton, svn_sqlite__db
base_node in the first place. */
if (rb->have_base_node)
{
+#ifndef SVN_WC__NODES_ONLY
/* Purge the DAV cache (wcprops) from any BASE that have 'em. */
SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
STMT_CLEAR_BASE_RECURSIVE_DAV_CACHE));
@@ -5271,6 +5654,7 @@ relocate_txn(void *baton, svn_sqlite__db
SVN_ERR(svn_sqlite__bindf(stmt, "issi", rb->wc_id, rb->local_relpath,
like_arg, new_repos_id));
SVN_ERR(svn_sqlite__step_done(stmt));
+#endif
/* Update any locks for the root or its children. */
if (rb->repos_relpath[0] == 0)
@@ -5540,6 +5924,7 @@ commit_node(void *baton, svn_sqlite__db_
/* ### other presences? or reserve that for separate functions? */
new_presence = svn_wc__db_status_normal;
+#ifndef SVN_WC__NODES_ONLY
SVN_ERR(svn_sqlite__get_statement(&stmt, cb->pdh->wcroot->sdb,
STMT_APPLY_CHANGES_TO_BASE));
SVN_ERR(svn_sqlite__bindf(stmt, "issttiisb",
@@ -5569,27 +5954,30 @@ commit_node(void *baton, svn_sqlite__db_
scratch_pool));
SVN_ERR(svn_sqlite__step_done(stmt));
+#endif
-#ifdef SVN_WC__NODE_DATA
+#ifdef SVN_WC__NODES
SVN_ERR(svn_sqlite__get_statement(&stmt, cb->pdh->wcroot->sdb,
- STMT_APPLY_CHANGES_TO_BASE_NODE_DATA));
- SVN_ERR(svn_sqlite__bindf(stmt, "issttisb",
+ STMT_APPLY_CHANGES_TO_BASE_NODE));
+ /* symlink_target not yet used */
+ SVN_ERR(svn_sqlite__bindf(stmt, "issisrtstrisnbn",
cb->pdh->wcroot->wc_id, cb->local_relpath,
parent_relpath,
+ cb->repos_id,
+ cb->repos_relpath,
+ cb->new_revision,
presence_map, new_presence,
+ new_depth_str,
kind_map, new_kind,
- (apr_int64_t)cb->changed_rev,
+ cb->changed_rev,
+ cb->changed_date,
cb->changed_author,
prop_blob.data, prop_blob.len));
- SVN_ERR(svn_sqlite__bind_checksum(stmt, 9, cb->new_checksum,
+ SVN_ERR(svn_sqlite__bind_checksum(stmt, 13, cb->new_checksum,
scratch_pool));
- if (cb->changed_date > 0)
- SVN_ERR(svn_sqlite__bind_int64(stmt, 10, cb->changed_date));
- SVN_ERR(svn_sqlite__bind_text(stmt, 11, new_depth_str));
- /* ### 12. target. */
- SVN_ERR(svn_sqlite__bind_properties(stmt, 12, cb->new_dav_cache,
+ SVN_ERR(svn_sqlite__bind_properties(stmt, 15, cb->new_dav_cache,
scratch_pool));
SVN_ERR(svn_sqlite__step_done(stmt));
@@ -5606,9 +5994,9 @@ commit_node(void *baton, svn_sqlite__db_
cb->pdh->wcroot->wc_id, cb->local_relpath));
SVN_ERR(svn_sqlite__step_done(stmt));
-#ifdef SVN_WC__NODE_DATA
+#ifdef SVN_WC__NODES
SVN_ERR(svn_sqlite__get_statement(&stmt, cb->pdh->wcroot->sdb,
- STMT_DELETE_NODE_DATA_WORKING));
+ STMT_DELETE_WORKING_NODES));
SVN_ERR(svn_sqlite__bindf(stmt, "is",
cb->pdh->wcroot->wc_id, cb->local_relpath));
SVN_ERR(svn_sqlite__step_done(stmt));
@@ -5921,7 +6309,7 @@ record_fileinfo(void *baton, svn_sqlite_
"information."),
svn_dirent_local_style(rb->local_abspath,
scratch_pool));
-
+#ifndef SVN_WC__NODES_ONLY
SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
working_exists
? STMT_UPDATE_WORKING_FILEINFO
@@ -5932,6 +6320,23 @@ record_fileinfo(void *baton, svn_sqlite_
SVN_ERR(svn_sqlite__update(&affected_rows, stmt));
SVN_ERR_ASSERT(affected_rows == 1);
+#endif
+
+#ifdef SVN_WC__NODES
+ /* ### Instead of doing it this way, we just ought to update the highest
+ op_depth level. That way, there's no need to find out which
+ tree to update first */
+ SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
+ working_exists
+ ? STMT_UPDATE_WORKING_NODE_FILEINFO
+ : STMT_UPDATE_BASE_NODE_FILEINFO));
+ SVN_ERR(svn_sqlite__bindf(stmt, "isii",
+ rb->wc_id, rb->local_relpath,
+ rb->translated_size, rb->last_mod_time));
+ SVN_ERR(svn_sqlite__update(&affected_rows, stmt));
+
+ SVN_ERR_ASSERT(affected_rows == 1);
+#endif
return SVN_NO_ERROR;
}
@@ -6107,6 +6512,7 @@ svn_wc__db_scan_addition(svn_wc__db_stat
const char *child_abspath = NULL;
const char *build_relpath = "";
svn_wc__db_pdh_t *pdh;
+ svn_wc__db_wcroot_t *wcroot;
svn_boolean_t found_info = FALSE;
SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
@@ -6137,6 +6543,8 @@ svn_wc__db_scan_addition(svn_wc__db_stat
scratch_pool, scratch_pool));
VERIFY_USABLE_PDH(pdh);
+ wcroot = pdh->wcroot;
+
while (TRUE)
{
svn_sqlite__stmt_t *stmt;
@@ -6144,10 +6552,9 @@ svn_wc__db_scan_addition(svn_wc__db_stat
svn_wc__db_status_t presence;
/* ### is it faster to fetch fewer columns? */
- SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
+ SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
STMT_SELECT_WORKING_NODE));
- SVN_ERR(svn_sqlite__bindf(stmt, "is",
- pdh->wcroot->wc_id, current_relpath));
+ SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, current_relpath));
SVN_ERR(svn_sqlite__step(&have_row, stmt));
if (!have_row)
@@ -6214,7 +6621,7 @@ svn_wc__db_scan_addition(svn_wc__db_stat
result_pool);
if (original_root_url || original_uuid)
SVN_ERR(fetch_repos_info(original_root_url, original_uuid,
- pdh->wcroot->sdb,
+ wcroot->sdb,
svn_sqlite__column_int64(stmt, 9),
result_pool));
if (original_revision)
@@ -6248,14 +6655,13 @@ svn_wc__db_scan_addition(svn_wc__db_stat
/* Move to the parent node. Remember the abspath to this node, since
it could be the root of an add/delete. */
child_abspath = current_abspath;
- if (strcmp(current_abspath, pdh->local_abspath) == 0)
- {
- /* The current node is a directory, so move to the parent dir. */
- SVN_ERR(navigate_to_parent(&pdh, db, pdh, svn_sqlite__mode_readonly,
- FALSE, scratch_pool));
- }
- current_abspath = pdh->local_abspath;
- current_relpath = svn_wc__db_pdh_compute_relpath(pdh, NULL);
+
+ /* The wcroot can't have a restructuring operation; make sure we don't
+ loop on invalid data */
+ SVN_ERR_ASSERT(current_relpath[0] != '\0');
+
+ current_relpath = svn_relpath_dirname(current_relpath, scratch_pool);
+ current_abspath = svn_dirent_dirname(current_abspath, scratch_pool);
}
/* If we're here, then we have an added/copied/moved (start) node, and
@@ -6298,6 +6704,7 @@ svn_wc__db_scan_deletion(const char **ba
svn_boolean_t child_has_base = FALSE;
svn_boolean_t found_moved_to = FALSE;
svn_wc__db_pdh_t *pdh;
+ svn_wc__db_wcroot_t *wcroot;
SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
@@ -6320,6 +6727,8 @@ svn_wc__db_scan_deletion(const char **ba
scratch_pool, scratch_pool));
VERIFY_USABLE_PDH(pdh);
+ wcroot = pdh->wcroot;
+
while (TRUE)
{
svn_sqlite__stmt_t *stmt;
@@ -6327,10 +6736,9 @@ svn_wc__db_scan_deletion(const char **ba
svn_boolean_t have_base;
svn_wc__db_status_t work_presence;
- SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
+ SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
STMT_SELECT_DELETION_INFO));
- SVN_ERR(svn_sqlite__bindf(stmt, "is",
- pdh->wcroot->wc_id, current_relpath));
+ SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, current_relpath));
SVN_ERR(svn_sqlite__step(&have_row, stmt));
if (!have_row)
@@ -6458,7 +6866,7 @@ svn_wc__db_scan_deletion(const char **ba
if (moved_to_abspath != NULL)
*moved_to_abspath = svn_dirent_join(
- pdh->wcroot->abspath,
+ wcroot->abspath,
svn_sqlite__column_text(stmt, 2, NULL),
result_pool);
}
@@ -6480,14 +6888,13 @@ svn_wc__db_scan_deletion(const char **ba
child_abspath = current_abspath;
child_presence = work_presence;
child_has_base = have_base;
- if (strcmp(current_abspath, pdh->local_abspath) == 0)
- {
- /* The current node is a directory, so move to the parent dir. */
- SVN_ERR(navigate_to_parent(&pdh, db, pdh, svn_sqlite__mode_readonly,
- FALSE, scratch_pool));
- }
- current_abspath = pdh->local_abspath;
- current_relpath = svn_wc__db_pdh_compute_relpath(pdh, NULL);
+
+ /* The wcroot can't be deleted, but make sure we don't loop on invalid
+ data */
+ SVN_ERR_ASSERT(current_relpath[0] != '\0');
+
+ current_relpath = svn_relpath_dirname(current_relpath, scratch_pool);
+ current_abspath = svn_dirent_dirname(current_abspath, scratch_pool);
}
return SVN_NO_ERROR;
@@ -6523,11 +6930,23 @@ svn_wc__db_upgrade_apply_dav_cache(svn_s
apr_pool_t *iterpool = svn_pool_create(scratch_pool);
apr_int64_t wc_id;
apr_hash_index_t *hi;
+#ifndef SVN_WC__NODES_ONLY
svn_sqlite__stmt_t *stmt;
+#endif
+#ifdef SVN_WC__NODES
+ svn_sqlite__stmt_t *stmt_node;
+#endif
SVN_ERR(svn_wc__db_util_fetch_wc_id(&wc_id, sdb, iterpool));
+#ifndef SVN_WC__NODES_ONLY
SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_UPDATE_BASE_DAV_CACHE));
+#endif
+#ifdef SVN_WC__NODES
+ SVN_ERR(svn_sqlite__get_statement(&stmt_node, sdb,
+ STMT_UPDATE_BASE_NODE_DAV_CACHE));
+#endif
+
/* Iterate over all the wcprops, writing each one to the wc_db. */
for (hi = apr_hash_first(scratch_pool, cache_values);
@@ -6542,9 +6961,17 @@ svn_wc__db_upgrade_apply_dav_cache(svn_s
local_relpath = svn_relpath_join(dir_relpath, name, iterpool);
+#ifndef SVN_WC__NODES_ONLY
SVN_ERR(svn_sqlite__bindf(stmt, "is", wc_id, local_relpath));
SVN_ERR(svn_sqlite__bind_properties(stmt, 3, props, iterpool));
SVN_ERR(svn_sqlite__step_done(stmt));
+#endif
+#ifdef SVN_WC__NODES
+ SVN_ERR(svn_sqlite__bindf(stmt_node, "is", wc_id, local_relpath));
+ SVN_ERR(svn_sqlite__bind_properties(stmt_node, 3, props, iterpool));
+ SVN_ERR(svn_sqlite__step_done(stmt_node));
+#endif
+
}
svn_pool_destroy(iterpool);
@@ -6629,6 +7056,7 @@ svn_wc__db_upgrade_apply_props(svn_sqlit
{
apr_hash_t *props = revert_props ? revert_props : base_props;
+#ifndef SVN_WC__NODES_ONLY
SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_UPDATE_BASE_PROPS));
SVN_ERR(svn_sqlite__bindf(stmt, "is", wc_id, local_relpath));
SVN_ERR(svn_sqlite__bind_properties(stmt, 3, props, scratch_pool));
@@ -6636,6 +7064,17 @@ svn_wc__db_upgrade_apply_props(svn_sqlit
/* ### should we provide a nicer error message? */
SVN_ERR_ASSERT(affected_rows == 1);
+#endif
+#ifdef SVN_WC__NODES
+ SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
+ STMT_UPDATE_NODE_BASE_PROPS));
+ SVN_ERR(svn_sqlite__bindf(stmt, "is", wc_id, local_relpath));
+ SVN_ERR(svn_sqlite__bind_properties(stmt, 3, props, scratch_pool));
+ SVN_ERR(svn_sqlite__update(&affected_rows, stmt));
+
+ /* ### should we provide a nicer error message? */
+ SVN_ERR_ASSERT(affected_rows == 1);
+#endif
}
if (have_work)
@@ -6652,6 +7091,18 @@ svn_wc__db_upgrade_apply_props(svn_sqlit
&& (work_presence == svn_wc__db_status_normal
|| work_presence == svn_wc__db_status_incomplete))
{
+#ifndef SVN_WC__NODES_ONLY
+ SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
+ STMT_UPDATE_WORKING_PROPS));
+ SVN_ERR(svn_sqlite__bindf(stmt, "is", wc_id, local_relpath));
+ SVN_ERR(svn_sqlite__bind_properties(stmt, 3, base_props,
+ scratch_pool));
+ SVN_ERR(svn_sqlite__update(&affected_rows, stmt));
+
+ /* ### should we provide a nicer error message? */
+ SVN_ERR_ASSERT(affected_rows == 1);
+#endif
+#ifdef SVN_WC__NODES
SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
STMT_UPDATE_WORKING_PROPS));
SVN_ERR(svn_sqlite__bindf(stmt, "is", wc_id, local_relpath));
@@ -6661,6 +7112,7 @@ svn_wc__db_upgrade_apply_props(svn_sqlit
/* ### should we provide a nicer error message? */
SVN_ERR_ASSERT(affected_rows == 1);
+#endif
}
/* else other states should have no properties. */
/* ### should we insert empty props for <= SVN_WC__NO_REVERT_FILES? */
@@ -7116,58 +7568,6 @@ svn_wc__db_temp_borrow_sdb(svn_sqlite__d
return SVN_NO_ERROR;
}
-
-svn_error_t *
-svn_wc__db_temp_is_dir_deleted(svn_boolean_t *not_present,
- svn_revnum_t *base_revision,
- svn_wc__db_t *db,
- const char *local_dir_abspath,
- apr_pool_t *scratch_pool)
-{
- const char *parent_abspath;
- const char *base_name;
- svn_wc__db_pdh_t *pdh;
- const char *local_relpath;
- svn_sqlite__stmt_t *stmt;
- svn_boolean_t have_row;
-
- SVN_ERR_ASSERT(svn_dirent_is_absolute(local_dir_abspath));
- SVN_ERR_ASSERT(not_present != NULL);
- SVN_ERR_ASSERT(base_revision != NULL);
-
- svn_dirent_split(&parent_abspath, &base_name, local_dir_abspath,
- scratch_pool);
-
- /* The parent should be a working copy if this function is called.
- Basically, the child is in an "added" state, which is not possible
- for a working copy root. */
- SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,
- parent_abspath, svn_sqlite__mode_readonly,
- scratch_pool, scratch_pool));
- VERIFY_USABLE_PDH(pdh);
-
- /* Build the local_relpath for the requested directory. */
- local_relpath = svn_dirent_join(local_relpath, base_name, scratch_pool);
-
- SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
- STMT_SELECT_PARENT_STUB_INFO));
- SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
-
- /* There MAY be a BASE_NODE row in the parent directory. It is entirely
- possible the parent only has WORKING_NODE rows. If there is no BASE_NODE,
- then we certainly aren't looking at a 'not-present' row. */
- SVN_ERR(svn_sqlite__step(&have_row, stmt));
-
- *not_present = have_row && svn_sqlite__column_int(stmt, 0);
- if (*not_present)
- {
- *base_revision = svn_sqlite__column_revnum(stmt, 1);
- }
- /* else don't touch *BASE_REVISION. */
-
- return svn_error_return(svn_sqlite__reset(stmt));
-}
-
svn_error_t *
svn_wc__db_read_conflict_victims(const apr_array_header_t **victims,
svn_wc__db_t *db,
@@ -7931,7 +8331,7 @@ svn_wc__db_temp_op_set_base_incomplete(s
svn_sqlite__stmt_t *stmt;
svn_wc__db_pdh_t *pdh;
int affected_rows;
-#ifdef SVN_WC__NODE_DATA
+#ifdef SVN_WC__NODES
int affected_node_rows;
#endif
svn_wc__db_status_t base_status;
@@ -7945,12 +8345,14 @@ svn_wc__db_temp_op_set_base_incomplete(s
SVN_ERR_ASSERT(base_status == svn_wc__db_status_normal ||
base_status == svn_wc__db_status_incomplete);
+#ifndef SVN_WC__NODES_ONLY
SVN_ERR(get_statement_for_path(&stmt, db, local_dir_abspath,
STMT_UPDATE_BASE_PRESENCE, scratch_pool));
SVN_ERR(svn_sqlite__bind_text(stmt, 3, incomplete ? "incomplete" : "normal"));
SVN_ERR(svn_sqlite__update(&affected_rows, stmt));
+#endif
-#ifdef SVN_WC__NODE_DATA
+#ifdef SVN_WC__NODES
SVN_ERR(get_statement_for_path(&stmt, db, local_dir_abspath,
STMT_UPDATE_NODE_BASE_PRESENCE, scratch_pool));
SVN_ERR(svn_sqlite__bind_text(stmt, 3, incomplete ? "incomplete" : "normal"));
@@ -7996,6 +8398,7 @@ start_directory_update_txn(void *baton,
if (strcmp(du->new_repos_relpath, repos_relpath) == 0)
{
+#ifndef SVN_WC__NODES_ONLY
/* Just update revision and status */
SVN_ERR(svn_sqlite__get_statement(
&stmt, db,
@@ -8006,9 +8409,25 @@ start_directory_update_txn(void *baton,
du->local_relpath,
presence_map, svn_wc__db_status_incomplete,
(apr_int64_t)du->new_rev));
+ SVN_ERR(svn_sqlite__step_done(stmt));
+#endif
+#ifdef SVN_WC__NODES
+ /* Just update revision and status */
+ SVN_ERR(svn_sqlite__get_statement(
+ &stmt, db,
+ STMT_UPDATE_BASE_NODE_PRESENCE_AND_REVNUM));
+
+ SVN_ERR(svn_sqlite__bindf(stmt, "isti",
+ du->wc_id,
+ du->local_relpath,
+ presence_map, svn_wc__db_status_incomplete,
+ (apr_int64_t)du->new_rev));
+ SVN_ERR(svn_sqlite__step_done(stmt));
+#endif
}
else
{
+#ifndef SVN_WC__NODES_ONLY
/* ### TODO: Maybe check if we can make repos_relpath NULL. */
SVN_ERR(svn_sqlite__get_statement(
&stmt, db,
@@ -8020,9 +8439,24 @@ start_directory_update_txn(void *baton,
presence_map, svn_wc__db_status_incomplete,
(apr_int64_t)du->new_rev,
du->new_repos_relpath));
- }
+ SVN_ERR(svn_sqlite__step_done(stmt));
+#endif
+#ifdef SVN_WC__NODES
+ /* ### TODO: Maybe check if we can make repos_relpath NULL. */
+ SVN_ERR(svn_sqlite__get_statement(
+ &stmt, db,
+ STMT_UPDATE_BASE_NODE_PRESENCE_REVNUM_AND_REPOS_PATH));
- return svn_error_return(svn_sqlite__step_done(stmt));
+ SVN_ERR(svn_sqlite__bindf(stmt, "istis",
+ du->wc_id,
+ du->local_relpath,
+ presence_map, svn_wc__db_status_incomplete,
+ (apr_int64_t)du->new_rev,
+ du->new_repos_relpath));
+ SVN_ERR(svn_sqlite__step_done(stmt));
+#endif
+ }
+ return SVN_NO_ERROR;
}
svn_error_t *
@@ -8184,6 +8618,8 @@ make_copy_txn(void *baton,
if (remove_working)
{
+
+#ifndef SVN_WC__NODES_ONLY
/* Remove current WORKING_NODE record */
SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
STMT_DELETE_WORKING_NODE));
@@ -8191,10 +8627,11 @@ make_copy_txn(void *baton,
mcb->pdh->wcroot->wc_id,
mcb->local_relpath));
SVN_ERR(svn_sqlite__step_done(stmt));
+#endif
-#ifdef SVN_WC_NODE_DATA
+#ifdef SVN_WC__NODES
SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
- STMT_DELETE_NODE_DATA_WORKING));
+ STMT_DELETE_WORKING_NODES));
SVN_ERR(svn_sqlite__bindf(stmt, "is",
mcb->pdh->wcroot->wc_id,
mcb->local_relpath));
@@ -8206,6 +8643,7 @@ make_copy_txn(void *baton,
{
/* Add a copy of the BASE_NODE to WORKING_NODE */
+#ifndef SVN_WC__NODES_ONLY
SVN_ERR(svn_sqlite__get_statement(
&stmt, sdb,
STMT_INSERT_WORKING_NODE_NORMAL_FROM_BASE_NODE));
@@ -8215,11 +8653,12 @@ make_copy_txn(void *baton,
mcb->local_relpath));
SVN_ERR(svn_sqlite__step_done(stmt));
+#endif
-#ifdef SVN_WC__NODE_DATA
+#ifdef SVN_WC__NODES
SVN_ERR(svn_sqlite__get_statement(
&stmt, sdb,
- STMT_INSERT_WORKING_NODE_DATA_NORMAL_FROM_BASE_NODE_1));
+ STMT_INSERT_WORKING_NODE_NORMAL_FROM_BASE));
SVN_ERR(svn_sqlite__bindf(stmt, "isi",
mcb->pdh->wcroot->wc_id,
@@ -8227,20 +8666,6 @@ make_copy_txn(void *baton,
(*mcb->local_relpath == '\0') ? 1 : 2));
SVN_ERR(svn_sqlite__step_done(stmt));
-
-#if 0
- /* ### NODE_DATA we can't enable the bit below until we stop
- running STMT_INSERT_WORKING_NODE_NORMAL_FROM_BASE_NODE above */
- SVN_ERR(svn_sqlite__get_statement(
- &stmt, sdb,
- STMT_INSERT_WORKING_NODE_DATA_NORMAL_FROM_BASE_NODE_2));
-
- SVN_ERR(svn_sqlite__bindf(stmt, "is",
- mcb->pdh->wcroot->wc_id,
- mcb->local_relpath));
-
- SVN_ERR(svn_sqlite__step_done(stmt));
-#endif
#endif
}
@@ -8248,6 +8673,7 @@ make_copy_txn(void *baton,
{
/* Add a not present WORKING_NODE */
+#ifndef SVN_WC__NODES_ONLY
SVN_ERR(svn_sqlite__get_statement(
&stmt, sdb,
STMT_INSERT_WORKING_NODE_NOT_PRESENT_FROM_BASE_NODE));
@@ -8257,13 +8683,12 @@ make_copy_txn(void *baton,
mcb->local_relpath));
SVN_ERR(svn_sqlite__step_done(stmt));
+#endif
-
-#ifdef SVN_WC__NODE_DATA
-
+#ifdef SVN_WC__NODES
SVN_ERR(svn_sqlite__get_statement(
&stmt, sdb,
- STMT_INSERT_WORKING_NODE_DATA_NOT_PRESENT_FROM_BASE_NODE_1));
+ STMT_INSERT_WORKING_NODE_NOT_PRESENT_FROM_BASE));
SVN_ERR(svn_sqlite__bindf(stmt, "isi",
mcb->pdh->wcroot->wc_id,
@@ -8271,23 +8696,6 @@ make_copy_txn(void *baton,
(*mcb->local_relpath == '\0') ? 1 : 2));
SVN_ERR(svn_sqlite__step_done(stmt));
-
-#if 0
- /* ### NODE_DATA we can't enable the bit below until we stop
- running STMT_INSERT_WORKING_NODE_NORMAL_FROM_BASE_NODE above */
- SVN_ERR(svn_sqlite__get_statement(
- &stmt, sdb,
- STMT_INSERT_WORKING_NODE_DATA_NOT_PRESENT_FROM_BASE_NODE_2));
-
- SVN_ERR(svn_sqlite__bindf(stmt, "iss",
- mcb->pdh->wcroot->wc_id,
- mcb->local_relpath,
- (*mcb->local_relpath == '\0') ? NULL
- : svn_relpath_dirname(pibb->local_relpath,
- scratch_pool)));
-
- SVN_ERR(svn_sqlite__step_done(stmt));
-#endif
#endif
}
@@ -8322,16 +8730,18 @@ make_copy_txn(void *baton,
/* Remove the BASE_NODE if the caller asked us to do that */
if (mcb->remove_base)
{
+#ifndef SVN_WC__NODES_ONLY
SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
STMT_DELETE_BASE_NODE));
SVN_ERR(svn_sqlite__bindf(stmt, "is",
mcb->pdh->wcroot->wc_id,
mcb->local_relpath));
SVN_ERR(svn_sqlite__step_done(stmt));
+#endif
-#ifdef SVN_WC__NODE_DATA
+#ifdef SVN_WC__NODES
SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
- STMT_DELETE_NODE_DATA_BASE));
+ STMT_DELETE_BASE_NODE_1));
SVN_ERR(svn_sqlite__bindf(stmt, "is",
mcb->pdh->wcroot->wc_id,
mcb->local_relpath));
@@ -8445,6 +8855,10 @@ svn_wc__db_temp_elide_copyfrom(svn_wc__d
const char *local_relpath;
svn_sqlite__stmt_t *stmt;
svn_boolean_t have_row;
+#ifdef SVN_WC__NODES
+ svn_sqlite__stmt_t *stmt_node;
+ svn_boolean_t have_node_row;
+#endif
apr_int64_t original_repos_id;
const char *original_repos_relpath;
svn_revnum_t original_revision;
@@ -8464,10 +8878,29 @@ svn_wc__db_temp_elide_copyfrom(svn_wc__d
/* Examine the current WORKING_NODE row's copyfrom information. If there
is no WORKING node, then simply exit. */
+#ifndef SVN_WC__NODES_ONLY
SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
STMT_SELECT_WORKING_NODE));
SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
SVN_ERR(svn_sqlite__step(&have_row, stmt));
+#endif
+
+#ifdef SVN_WC__NODES
+ SVN_ERR(svn_sqlite__get_statement(&stmt_node, pdh->wcroot->sdb,
+ STMT_SELECT_WORKING_NODE_1));
+ SVN_ERR(svn_sqlite__bindf(stmt_node, "is",
+ pdh->wcroot->wc_id, local_relpath));
+ SVN_ERR(svn_sqlite__step(&have_node_row, stmt_node));
+#ifndef SVN_WC__NODES_ONLY
+ SVN_ERR(assert_working_rows_match(have_row, have_node_row, stmt, stmt_node,
+ local_relpath, scratch_pool));
+ SVN_ERR(svn_sqlite__reset(stmt_node));
+#else
+ stmt = stmt_node;
+ have_row = have_node_row;
+#endif
+#endif
+
if (!have_row)
return svn_error_return(svn_sqlite__reset(stmt));
@@ -8517,10 +8950,22 @@ svn_wc__db_temp_elide_copyfrom(svn_wc__d
/* The child's copyfrom information is derivable from the parent.
The data should be reset to null, indicating the derivation. */
+#ifndef SVN_WC__NODES_ONLY
SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
STMT_UPDATE_COPYFROM_TO_INHERIT));
SVN_ERR(svn_sqlite__bindf(stmt, "is", pdh->wcroot->wc_id, local_relpath));
SVN_ERR(svn_sqlite__update(NULL, stmt));
+#endif
+
+#ifdef SVN_WC__NODES
+ /* Should probably use the op_depth from query above and simplify this
+ query. */
+ SVN_ERR(svn_sqlite__get_statement(&stmt_node, pdh->wcroot->sdb,
+ STMT_UPDATE_COPYFROM_TO_INHERIT_1));
+ SVN_ERR(svn_sqlite__bindf(stmt_node, "is",
+ pdh->wcroot->wc_id, local_relpath));
+ SVN_ERR(svn_sqlite__update(NULL, stmt_node));
+#endif
return SVN_NO_ERROR;
}
@@ -8633,12 +9078,14 @@ svn_wc__db_temp_op_set_file_external(svn
SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
STMT_INSERT_NODE));
- SVN_ERR(svn_sqlite__bindf(stmt, "isisnnntnt",
+ SVN_ERR(svn_sqlite__bindf(stmt, "isisisntnt",
pdh->wcroot->wc_id,
local_relpath,
(apr_int64_t)0, /* op_depth == BASE */
svn_relpath_dirname(local_relpath,
scratch_pool),
+ repos_id,
+ repos_relpath,
presence_map, svn_wc__db_status_not_present,
kind_map, svn_wc__db_kind_file));
@@ -8812,6 +9259,7 @@ set_rev_relpath_txn(void *baton,
if (SVN_IS_VALID_REVNUM(rrb->rev))
{
+#ifndef SVN_WC__NODES_ONLY
SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
STMT_UPDATE_BASE_REVISION));
@@ -8820,6 +9268,17 @@ set_rev_relpath_txn(void *baton,
(apr_int64_t)rrb->rev));
SVN_ERR(svn_sqlite__step_done(stmt));
+#endif
+#ifdef SVN_WC__NODES
+ SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
+ STMT_UPDATE_BASE_REVISION_1));
+
+ SVN_ERR(svn_sqlite__bindf(stmt, "isi", rrb->pdh->wcroot->wc_id,
+ rrb->local_relpath,
+ (apr_int64_t)rrb->rev));
+
+ SVN_ERR(svn_sqlite__step_done(stmt));
+#endif
}
if (rrb->set_repos_relpath)
@@ -8828,6 +9287,7 @@ set_rev_relpath_txn(void *baton,
SVN_ERR(create_repos_id(&repos_id, rrb->repos_root_url, rrb->repos_uuid,
rrb->pdh->wcroot->sdb, scratch_pool));
+#ifndef SVN_WC__NODES_ONLY
SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
STMT_UPDATE_BASE_REPOS));
@@ -8837,6 +9297,18 @@ set_rev_relpath_txn(void *baton,
rrb->repos_relpath));
SVN_ERR(svn_sqlite__step_done(stmt));
+#endif
+#ifdef SVN_WC__NODES
+ SVN_ERR(svn_sqlite__get_statement(&stmt, sdb,
+ STMT_UPDATE_BASE_REPOS_1));
+
+ SVN_ERR(svn_sqlite__bindf(stmt, "isis", rrb->pdh->wcroot->wc_id,
+ rrb->local_relpath,
+ repos_id,
+ rrb->repos_relpath));
+
+ SVN_ERR(svn_sqlite__step_done(stmt));
+#endif
}
return SVN_NO_ERROR;
@@ -8850,7 +9322,6 @@ svn_wc__db_temp_op_set_rev_and_repos_rel
const char *repos_relpath,
const char *repos_root_url,
const char *repos_uuid,
- svn_boolean_t update_stub,
apr_pool_t *scratch_pool)
{
struct set_rev_relpath_baton baton;
@@ -8873,8 +9344,6 @@ svn_wc__db_temp_op_set_rev_and_repos_rel
SVN_ERR(flush_entries(db, baton.pdh, local_abspath, scratch_pool));
- SVN_ERR_ASSERT(!update_stub);
-
SVN_ERR(svn_sqlite__with_transaction(baton.pdh->wcroot->sdb,
set_rev_relpath_txn,
&baton, scratch_pool));
@@ -8909,6 +9378,7 @@ set_new_dir_to_incomplete_txn(void *bato
SVN_ERR(create_repos_id(&repos_id, dtb->repos_root_url, dtb->repos_uuid,
sdb, scratch_pool));
+#ifndef SVN_WC__NODES_ONLY
/* Delete the working node */
SVN_ERR(svn_sqlite__get_statement(&stmt, dtb->pdh->wcroot->sdb,
STMT_DELETE_WORKING_NODE));
@@ -8922,14 +9392,14 @@ set_new_dir_to_incomplete_txn(void *bato
SVN_ERR(svn_sqlite__bindf(stmt, "is", dtb->pdh->wcroot->wc_id,
dtb->local_relpath));
SVN_ERR(svn_sqlite__step_done(stmt));
+#endif
-#ifdef SVN_WC__NODE_DATA
+#ifdef SVN_WC__NODES
/* Delete the base and working node data */
SVN_ERR(svn_sqlite__get_statement(&stmt, dtb->pdh->wcroot->sdb,
- STMT_DELETE_NODE_DATA_LAYERS));
- SVN_ERR(svn_sqlite__bindf(stmt, "isi", dtb->pdh->wcroot->wc_id,
- dtb->local_relpath,
- (apr_int64_t)0));
+ STMT_DELETE_NODES));
+ SVN_ERR(svn_sqlite__bindf(stmt, "is", dtb->pdh->wcroot->wc_id,
+ dtb->local_relpath));
SVN_ERR(svn_sqlite__step_done(stmt));
#endif
@@ -8954,17 +9424,19 @@ set_new_dir_to_incomplete_txn(void *bato
#ifdef SVN_WC__NODES
-
/* Insert the incomplete base node */
SVN_ERR(svn_sqlite__get_statement(&stmt, dtb->pdh->wcroot->sdb,
STMT_INSERT_NODE));
SVN_ERR(svn_sqlite__bindf(stmt, "isis" /* 1 - 4 */
- "nnn" "sns", /* 5 - 7(n), 8, 9(n), 10 */
+ "isr" "sns", /* 5 - 7, 8, 9(n), 10 */
dtb->pdh->wcroot->wc_id, /* 1 */
dtb->local_relpath, /* 2 */
(apr_int64_t)0, /* op_depth == 0; BASE */
parent_relpath, /* 4 */
+ repos_id,
+ dtb->repos_relpath,
+ dtb->revision,
"incomplete", /* 8, presence */
"dir")); /* 10, kind */
@@ -8976,8 +9448,6 @@ set_new_dir_to_incomplete_txn(void *bato
#endif
-
-
return SVN_NO_ERROR;
}
Modified: subversion/branches/performance/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_wc/wc_db.h?rev=999098&r1=999097&r2=999098&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/branches/performance/subversion/libsvn_wc/wc_db.h Mon Sep 20 20:16:13 2010
@@ -618,7 +618,6 @@ svn_wc__db_base_add_symlink(svn_wc__db_t
svn_wc__db_status_absent
svn_wc__db_status_excluded
- svn_wc__db_status_not_present
If CONFLICT is not NULL, then it describes a conflict for this node. The
node will be record as conflicted (in ACTUAL).
@@ -642,6 +641,36 @@ svn_wc__db_base_add_absent_node(svn_wc__
apr_pool_t *scratch_pool);
+/* Create a node in the BASE tree that is present in name only.
+
+ The new node will be located at LOCAL_ABSPATH, and correspond to the
+ repository node described by <REPOS_RELPATH, REPOS_ROOT_URL, REPOS_UUID>
+ at revision REVISION.
+
+ The node's kind is described by KIND, and the reason for its absence
+ is 'svn_wc__db_status_not_present'.
+
+ If CONFLICT is not NULL, then it describes a conflict for this node. The
+ node will be record as conflicted (in ACTUAL).
+
+ Any work items that are necessary as part of this node construction may
+ be passed in WORK_ITEMS.
+
+ All temporary allocations will be made in SCRATCH_POOL.
+*/
+svn_error_t *
+svn_wc__db_base_add_not_present_node(svn_wc__db_t *db,
+ const char *local_abspath,
+ const char *repos_relpath,
+ const char *repos_root_url,
+ const char *repos_uuid,
+ svn_revnum_t revision,
+ svn_wc__db_kind_t kind,
+ const svn_skel_t *conflict,
+ const svn_skel_t *work_items,
+ apr_pool_t *scratch_pool);
+
+
/* Remove a node from the BASE tree.
The node to remove is indicated by LOCAL_ABSPATH from the local
@@ -2198,32 +2227,6 @@ svn_wc__db_temp_forget_directory(svn_wc_
const char *local_dir_abspath,
apr_pool_t *scratch_pool);
-
-svn_error_t *
-svn_wc__db_temp_is_dir_deleted(svn_boolean_t *not_present,
- svn_revnum_t *base_revision,
- svn_wc__db_t *db,
- const char *local_abspath,
- apr_pool_t *scratch_pool);
-
-#ifndef SVN_WC__SINGLE_DB
-/* For a deleted node, determine its keep_local flag. (This flag will
- go away once we have a consolidated administrative area) */
-svn_error_t *
-svn_wc__db_temp_determine_keep_local(svn_boolean_t *keep_local,
- svn_wc__db_t *db,
- const char *local_abspath,
- apr_pool_t *scratch_pool);
-
-/* For a deleted directory, set its keep_local flag. (This flag will
- go away once we have a consolidated administrative area) */
-svn_error_t *
-svn_wc__db_temp_set_keep_local(svn_wc__db_t *db,
- const char *local_abspath,
- svn_boolean_t keep_local,
- apr_pool_t *scratch_pool);
-#endif
-
/* Removes all references of LOCAL_ABSPATH from its working copy
using DB. */
svn_error_t *
@@ -2367,14 +2370,6 @@ svn_wc__db_temp_get_file_external(const
apr_pool_t *scratch_pool);
-#ifndef SVN_WC__SINGLE_DB
-/* Remove a stray "subdir" record in the BASE_NODE table. */
-svn_error_t *
-svn_wc__db_temp_remove_subdir_record(svn_wc__db_t *db,
- const char *local_abspath,
- apr_pool_t *scratch_pool);
-#endif
-
/* Set file external information on LOCAL_ABSPATH to REPOS_RELPATH
at PEG_REV with revision REV*/
svn_error_t *
@@ -2403,28 +2398,10 @@ svn_wc__db_temp_op_set_property_conflict
const char *prej_basename,
apr_pool_t *scratch_pool);
-#ifndef SVN_WC__SINGLE_DB
-/* Ensure that the parent stub of LOCAL_ABSPATH contains a BASE_NODE record with
- a normal status and optionally remove the WORKING_NODE record for the node;
- this assumes that the parent directory is in the incomplete state, or the
- node already exists (either as working or as base node).
-
- ### This function is a HACK with assumptions that aren't completely checked.
- ### Don't add new callers unless you exactly know what
- ### you are doing! This call is never needed once we get to a central db. */
-svn_error_t *
-svn_wc__db_temp_set_parent_stub_to_normal(svn_wc__db_t *db,
- const char *local_abspath,
- svn_boolean_t delete_working,
- apr_pool_t *scratch_pool);
-#endif
-
/* Sets a base nodes revision and/or repository relative path. If
LOCAL_ABSPATH's rev (REV) is valid, set is revision and if SET_REPOS_RELPATH
is TRUE set its repository relative path to REPOS_RELPATH (and make sure its
REPOS_ROOT_URL and REPOS_ROOT_UUID are still valid).
-
- ### TODO(SINGLE_DB): Remove the 'update_stub' argument.
*/
svn_error_t *
svn_wc__db_temp_op_set_rev_and_repos_relpath(svn_wc__db_t *db,
@@ -2434,7 +2411,6 @@ svn_wc__db_temp_op_set_rev_and_repos_rel
const char *repos_relpath,
const char *repos_root_url,
const char *repos_uuid,
- svn_boolean_t update_stub,
apr_pool_t *scratch_pool);
/* Tweak a locally added existing directory LOCAL_ABSPATH to have a base