You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by eh...@apache.org on 2010/08/17 16:42:42 UTC
svn commit: r986332 - in /subversion/trunk/subversion/libsvn_wc:
wc-queries.sql wc_db.c
Author: ehu
Date: Tue Aug 17 14:42:42 2010
New Revision: 986332
URL: http://svn.apache.org/viewvc?rev=986332&view=rev
Log:
Regarding NODE_DATA, split an INSERT query - for which the fields get spread
over 2 tables - across 2 queries wrapped in a transaction. Mark another one
which needs the same treatment.
* subversion/libsvn_wc/wc-queries.sql
(STMT_INSERT_WORKING_NODE_DATA_FROM_BASE_NODE_1,
STMT_INSERT_WORKING_NODE_DATA_FROM_BASE_NODE_2): Split from
STMT_INSERT_WORKING_NODE_FROM_BASE_NODE
(STMT_APPLY_CHANGES_TO_BASE): Mark for split up.
Modified:
subversion/trunk/subversion/libsvn_wc/wc-queries.sql
subversion/trunk/subversion/libsvn_wc/wc_db.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=986332&r1=986331&r2=986332&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Tue Aug 17 14:42:42 2010
@@ -482,6 +482,11 @@ WHERE wc_id = ?1 AND local_dir_relpath L
/* translated_size and last_mod_time are not mentioned here because they will
be tweaked after the working-file is installed.
### what to do about file_external? */
+/* ### NODE_DATA the fields 'presence', 'kind', 'properties', 'changed_rev',
+ 'changed_date', 'changed_author', 'depth', 'symlink_target' - but not:
+ 'repos_id', 'repos_relpath', 'dav_cache' - will move to the NODE_DATA
+ table, meaning we can't use this query anymore; we need 2, wrapped in a
+ transaction. */
INSERT OR REPLACE INTO BASE_NODE (
wc_id, local_relpath, parent_relpath, presence, kind, revnum, changed_rev,
changed_author, properties, repos_id, repos_relpath, checksum, changed_date,
@@ -498,6 +503,25 @@ SELECT wc_id, local_relpath, parent_relp
symlink_target, last_mod_time FROM BASE_NODE
WHERE wc_id = ?1 AND local_relpath = ?2;
+-- STMT_INSERT_WORKING_NODE_DATA_FROM_BASE_NODE_1
+/* ### NODE_DATA This statement and the statement below (_2) need to
+ be executed in a single transaction */
+INSERT INTO NODE_DATA (
+ wc_id, local_relpath, op_depth, parent_relpath, presence, kind, checksum,
+ changed_revision, changed_date, changed_author, depth, symlink_target )
+SELECT wc_id, local_relpath, ?4 as op_depth, parent_relpath, ?3 AS presence,
+ kind, checksum, changed_revision, changed_date,
+ changed_author, depth, symlink_target
+FROM NODE_DATA
+WHERE wc_id = ?1 AND local_relpath = ?2 and op_depth = 0;
+
+-- STMT_INSERT_WORKING_NODE_DATA_FROM_BASE_NODE_2
+INSERT INTO WORKING_NODE (
+ wc_id, local_relpath, parent_relpath, translated_size, last_mod_time )
+SELECT wc_id, local_relpath, parent_relpath, translated_size, last_mod_time
+FROM BASE_NODE
+WHERE wc_id = ?1 AND local_relpath = ?2;
+
-- STMT_INSERT_WORKING_NODE_NORMAL_FROM_BASE_NODE
INSERT INTO WORKING_NODE (
wc_id, local_relpath, parent_relpath, presence, kind, checksum,
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=986332&r1=986331&r2=986332&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Tue Aug 17 14:42:42 2010
@@ -165,11 +165,12 @@ typedef struct insert_base_baton_t {
typedef struct {
- /* common to all insertions into WORKING */
+ /* common to all insertions into WORKING (including NODE_DATA) */
svn_wc__db_status_t presence;
svn_wc__db_kind_t kind;
apr_int64_t wc_id;
const char *local_relpath;
+ apr_int64_t op_depth;
/* common to all "normal" presence insertions */
const apr_hash_t *props;
@@ -764,6 +765,53 @@ blank_iwb(insert_working_baton_t *piwb)
value, but... meh. We'll avoid them if ORIGINAL_REPOS_RELPATH==NULL. */
}
+/* */
+static svn_error_t *
+copy_working_from_base(void *baton,
+ svn_sqlite__db_t *sdb,
+ apr_pool_t *scratch_pool)
+{
+ const insert_working_baton_t *piwb = baton;
+ svn_sqlite__stmt_t *stmt;
+
+#ifdef SVN_WC__NODE_DATA
+ /* Insert NODE_DATA stuff */
+ 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,
+ piwb->local_relpath,
+ presence_map, piwb->presence,
+ piwb->op_depth));
+ 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
+
+ /* Run the sequence below instead, which copies all the columns, including
+ those with the restrictions
+
+ ### REMOVE when fully migrating to NODE_DATA */
+
+ 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));
+
+ return SVN_NO_ERROR;
+}
+
+
static svn_error_t *
insert_incomplete_working_children(svn_sqlite__db_t *sdb,
apr_int64_t wc_id,
@@ -4621,6 +4669,8 @@ db_working_actual_remove(svn_wc__db_t *d
}
+
+
/* Insert a working node for LOCAL_ABSPATH with presence=STATUS. */
static svn_error_t *
db_working_insert(svn_wc__db_status_t status,
@@ -4631,6 +4681,9 @@ db_working_insert(svn_wc__db_status_t st
svn_wc__db_pdh_t *pdh;
const char *local_relpath;
svn_sqlite__stmt_t *stmt;
+#ifdef SVN_WC__NODE_DATA
+ insert_working_baton_t iwb;
+#endif
SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,
@@ -4638,11 +4691,19 @@ db_working_insert(svn_wc__db_status_t st
scratch_pool, scratch_pool));
VERIFY_USABLE_PDH(pdh);
- SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
- STMT_INSERT_WORKING_NODE_FROM_BASE_NODE));
- SVN_ERR(svn_sqlite__bindf(stmt, "ist", pdh->wcroot->wc_id, local_relpath,
- presence_map, status));
- SVN_ERR(svn_sqlite__step_done(stmt));
+ /* Update WORKING_NODE and NODE_DATA transactionally */
+ blank_iwb(&iwb);
+
+ iwb.wc_id = pdh->wcroot->wc_id;
+ iwb.local_relpath = local_relpath;
+ iwb.presence = status;
+ /* ### NODE_DATA we temporary store 1 or 2 */
+ iwb.op_depth = (*local_relpath == '\0') ? 1 : 2;
+
+ SVN_ERR(svn_sqlite__with_transaction(pdh->wcroot->sdb,
+ copy_working_from_base, &iwb,
+ scratch_pool));
+
flush_entries(pdh);
@@ -4656,13 +4717,16 @@ db_working_insert(svn_wc__db_status_t st
VERIFY_USABLE_PDH(pdh);
/* ### Should the parent stub have a full row like this? */
- SVN_ERR(svn_sqlite__get_statement(
- &stmt, pdh->wcroot->sdb,
- STMT_INSERT_WORKING_NODE_FROM_BASE_NODE));
- SVN_ERR(svn_sqlite__bindf(stmt, "ist",
- pdh->wcroot->wc_id, local_relpath,
- presence_map, status));
- SVN_ERR(svn_sqlite__step_done(stmt));
+ blank_iwb(&iwb);
+
+ iwb.wc_id = pdh->wcroot->wc_id;
+ iwb.local_relpath = local_relpath;
+ iwb.presence = status;
+ iwb.op_depth = 2; /* the stub is a child */
+
+ SVN_ERR(svn_sqlite__with_transaction(pdh->wcroot->sdb,
+ copy_working_from_base, &iwb,
+ scratch_pool));
flush_entries(pdh);
}
Re: svn commit: r986332 - in /subversion/trunk/subversion/libsvn_wc:
wc-queries.sql wc_db.c
Posted by Erik Huelsmann <eh...@gmail.com>.
>>
>> Modified:
>> subversion/trunk/subversion/libsvn_wc/wc-queries.sql
>> subversion/trunk/subversion/libsvn_wc/wc_db.c
>
> Your log message doesn't describe any changes in wc_db.c
Prop-edited now. Thanks.
Bye,
Erik.
RE: svn commit: r986332 - in /subversion/trunk/subversion/libsvn_wc: wc-queries.sql wc_db.c
Posted by Bert Huijben <be...@vmoo.com>.
> -----Original Message-----
> From: ehu@apache.org [mailto:ehu@apache.org]
> Sent: dinsdag 17 augustus 2010 7:43
> To: commits@subversion.apache.org
> Subject: svn commit: r986332 - in /subversion/trunk/subversion/libsvn_wc:
> wc-queries.sql wc_db.c
>
> Author: ehu
> Date: Tue Aug 17 14:42:42 2010
> New Revision: 986332
>
> URL: http://svn.apache.org/viewvc?rev=986332&view=rev
> Log:
> Regarding NODE_DATA, split an INSERT query - for which the fields get
> spread
> over 2 tables - across 2 queries wrapped in a transaction. Mark another one
> which needs the same treatment.
>
> * subversion/libsvn_wc/wc-queries.sql
> (STMT_INSERT_WORKING_NODE_DATA_FROM_BASE_NODE_1,
> STMT_INSERT_WORKING_NODE_DATA_FROM_BASE_NODE_2): Split from
> STMT_INSERT_WORKING_NODE_FROM_BASE_NODE
> (STMT_APPLY_CHANGES_TO_BASE): Mark for split up.
>
> Modified:
> subversion/trunk/subversion/libsvn_wc/wc-queries.sql
> subversion/trunk/subversion/libsvn_wc/wc_db.c
Your log message doesn't describe any changes in wc_db.c
Bert