You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Kamesh Jayachandran <ka...@collab.net> on 2006/11/15 10:12:36 UTC
[PATCH][merge-tracking] Reduce one query to sqlite while retrieveing
the mergeinfo.
Hi All,
Find the attached patch and log.
With regards
Kamesh Jayachandran
Re: [PATCH][merge-tracking] Reduce one query to sqlite while retrieveing the mergeinfo.
Posted by Daniel Rall <dl...@collab.net>.
On Wed, 15 Nov 2006, Kamesh Jayachandran wrote:
...
> Reduce one query to sqlite.
>
> * subversion/libsvn_fs_util/merge-info-sqlite-index.c
> (parse_mergeinfo_from_db):
> changing the name of the arg 'rev' to 'lastmerged_rev'.
> Don't deduce the 'lastchanged_rev' as the caller himself would give it
> as 'lastmerged_rev'.
> (get_merge_info_for_path):
> Don't get the count of records rather get the lastmerged_rev itself.
Thanks Kamesh! Committed to the branch in r22309.
- Dan
p.s. Remember that -- long-term -- we're probably going to scrap this
schema, so right now it's most efficient to focus our efforts on
getting a comprehensive, end-to-end solution working by building the
remaining unfinished pieces of functionality.
Re: [PATCH][merge-tracking] Reduce one query to sqlite while retrieveing
the mergeinfo.
Posted by Kamesh Jayachandran <ka...@collab.net>.
This has been committed by Daniel Rall already.
With regards
Kamesh Jayachandran
Hyrum K. Wright wrote:
> Kamesh Jayachandran wrote:
>
>> Hi All,
>> Find the attached patch and log.
>>
>
> Ping...
>
> Has anybody had a chance to look at this patch yet?
>
> -Hyrum
>
>
>> ------------------------------------------------------------------------
>>
>> [[[
>> Reduce one query to sqlite.
>>
>> * subversion/libsvn_fs_util/merge-info-sqlite-index.c
>> (parse_mergeinfo_from_db):
>> changing the name of the arg 'rev' to 'lastmerged_rev'.
>> Don't deduce the 'lastchanged_rev' as the caller himself would give it
>> as 'lastmerged_rev'.
>> (get_merge_info_for_path):
>> Don't get the count of records rather get the lastmerged_rev itself.
>>
>> Patch by: Kamesh Jayachandran <ka...@collab.net>
>> ]]]
>>
>>
>> ------------------------------------------------------------------------
>>
>> Index: subversion/libsvn_fs_util/merge-info-sqlite-index.c
>> ===================================================================
>> --- subversion/libsvn_fs_util/merge-info-sqlite-index.c (revision 22305)
>> +++ subversion/libsvn_fs_util/merge-info-sqlite-index.c (working copy)
>> @@ -268,28 +268,13 @@
>> static svn_error_t *
>> parse_mergeinfo_from_db(sqlite3 *db,
>> const char *path,
>> - svn_revnum_t rev,
>> + svn_revnum_t lastmerged_rev,
>> apr_hash_t **result,
>> apr_pool_t *pool)
>> {
>> sqlite3_stmt *stmt;
>> - sqlite_int64 lastchanged_rev;
>> int sqlite_result;
>>
>> - SQLITE_ERR(sqlite3_prepare(db, "SELECT MAX(revision) from mergeinfo_changed"
>> - " where path = ? and revision <= ?;",
>> - -1, &stmt, NULL), db);
>> - SQLITE_ERR(sqlite3_bind_text(stmt, 1, path, -1, SQLITE_TRANSIENT), db);
>> - SQLITE_ERR(sqlite3_bind_int64(stmt, 2, rev), db);
>> - sqlite_result = sqlite3_step(stmt);
>> - if (sqlite_result != SQLITE_ROW)
>> - return svn_error_create(SVN_ERR_FS_SQLITE_ERROR, NULL,
>> - sqlite3_errmsg(db));
>> -
>> - lastchanged_rev = sqlite3_column_int64(stmt, 0);
>> -
>> - SQLITE_ERR(sqlite3_finalize(stmt), db);
>> -
>> SQLITE_ERR(sqlite3_prepare(db,
>> "SELECT mergedfrom, mergedrevstart,"
>> "mergedrevend from mergeinfo "
>> @@ -297,7 +282,7 @@
>> "order by mergedfrom;",
>> -1, &stmt, NULL), db);
>> SQLITE_ERR(sqlite3_bind_text(stmt, 1, path, -1, SQLITE_TRANSIENT), db);
>> - SQLITE_ERR(sqlite3_bind_int64(stmt, 2, lastchanged_rev), db);
>> + SQLITE_ERR(sqlite3_bind_int64(stmt, 2, lastmerged_rev), db);
>> sqlite_result = sqlite3_step(stmt);
>>
>> /* It is possible the mergeinfo changed because of a delete, and
>> @@ -403,7 +388,7 @@
>> apr_hash_t *path_mergeinfo;
>> sqlite3_stmt *stmt;
>> int sqlite_result;
>> - sqlite_int64 count;
>> + sqlite_int64 lastmerged_rev;
>>
>> path_mergeinfo = apr_hash_get(cache, path, APR_HASH_KEY_STRING);
>> if (path_mergeinfo != NULL)
>> @@ -415,7 +400,7 @@
>>
>> /* See if we have a mergeinfo_changed record for this path. If not,
>> then it can't have mergeinfo. */
>> - SQLITE_ERR(sqlite3_prepare(db, "SELECT COUNT(*) from mergeinfo_changed"
>> + SQLITE_ERR(sqlite3_prepare(db, "SELECT MAX(revision) from mergeinfo_changed"
>> " where path = ? and revision <= ?;",
>> -1, &stmt, NULL), db);
>>
>> @@ -426,14 +411,15 @@
>> return svn_error_create(SVN_ERR_FS_SQLITE_ERROR, NULL,
>> sqlite3_errmsg(db));
>>
>> - count = sqlite3_column_int64(stmt, 0);
>> + lastmerged_rev = sqlite3_column_int64(stmt, 0);
>> SQLITE_ERR(sqlite3_finalize(stmt), db);
>>
>> /* If we've got mergeinfo data, transform it from the db into a
>> mergeinfo hash */
>> - if (count > 0)
>> + if (lastmerged_rev > 0)
>> {
>> - SVN_ERR(parse_mergeinfo_from_db(db, path, rev, &path_mergeinfo, pool));
>> + SVN_ERR(parse_mergeinfo_from_db(db, path, lastmerged_rev,
>> + &path_mergeinfo, pool));
>> if (path_mergeinfo)
>> {
>> if (result)
>> @@ -446,7 +432,7 @@
>> }
>>
>> /* If this path has no mergeinfo, and we are asked to, check our parent */
>> - if (count == 0 && include_parents)
>> + if (lastmerged_rev == 0 && include_parents)
>> {
>> svn_stringbuf_t *parentpath;
>>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [PATCH][merge-tracking] Reduce one query to sqlite while retrieveing
the mergeinfo.
Posted by "Hyrum K. Wright" <hy...@mail.utexas.edu>.
Kamesh Jayachandran wrote:
> Hi All,
> Find the attached patch and log.
Ping...
Has anybody had a chance to look at this patch yet?
-Hyrum
> ------------------------------------------------------------------------
>
> [[[
> Reduce one query to sqlite.
>
> * subversion/libsvn_fs_util/merge-info-sqlite-index.c
> (parse_mergeinfo_from_db):
> changing the name of the arg 'rev' to 'lastmerged_rev'.
> Don't deduce the 'lastchanged_rev' as the caller himself would give it
> as 'lastmerged_rev'.
> (get_merge_info_for_path):
> Don't get the count of records rather get the lastmerged_rev itself.
>
> Patch by: Kamesh Jayachandran <ka...@collab.net>
> ]]]
>
>
> ------------------------------------------------------------------------
>
> Index: subversion/libsvn_fs_util/merge-info-sqlite-index.c
> ===================================================================
> --- subversion/libsvn_fs_util/merge-info-sqlite-index.c (revision 22305)
> +++ subversion/libsvn_fs_util/merge-info-sqlite-index.c (working copy)
> @@ -268,28 +268,13 @@
> static svn_error_t *
> parse_mergeinfo_from_db(sqlite3 *db,
> const char *path,
> - svn_revnum_t rev,
> + svn_revnum_t lastmerged_rev,
> apr_hash_t **result,
> apr_pool_t *pool)
> {
> sqlite3_stmt *stmt;
> - sqlite_int64 lastchanged_rev;
> int sqlite_result;
>
> - SQLITE_ERR(sqlite3_prepare(db, "SELECT MAX(revision) from mergeinfo_changed"
> - " where path = ? and revision <= ?;",
> - -1, &stmt, NULL), db);
> - SQLITE_ERR(sqlite3_bind_text(stmt, 1, path, -1, SQLITE_TRANSIENT), db);
> - SQLITE_ERR(sqlite3_bind_int64(stmt, 2, rev), db);
> - sqlite_result = sqlite3_step(stmt);
> - if (sqlite_result != SQLITE_ROW)
> - return svn_error_create(SVN_ERR_FS_SQLITE_ERROR, NULL,
> - sqlite3_errmsg(db));
> -
> - lastchanged_rev = sqlite3_column_int64(stmt, 0);
> -
> - SQLITE_ERR(sqlite3_finalize(stmt), db);
> -
> SQLITE_ERR(sqlite3_prepare(db,
> "SELECT mergedfrom, mergedrevstart,"
> "mergedrevend from mergeinfo "
> @@ -297,7 +282,7 @@
> "order by mergedfrom;",
> -1, &stmt, NULL), db);
> SQLITE_ERR(sqlite3_bind_text(stmt, 1, path, -1, SQLITE_TRANSIENT), db);
> - SQLITE_ERR(sqlite3_bind_int64(stmt, 2, lastchanged_rev), db);
> + SQLITE_ERR(sqlite3_bind_int64(stmt, 2, lastmerged_rev), db);
> sqlite_result = sqlite3_step(stmt);
>
> /* It is possible the mergeinfo changed because of a delete, and
> @@ -403,7 +388,7 @@
> apr_hash_t *path_mergeinfo;
> sqlite3_stmt *stmt;
> int sqlite_result;
> - sqlite_int64 count;
> + sqlite_int64 lastmerged_rev;
>
> path_mergeinfo = apr_hash_get(cache, path, APR_HASH_KEY_STRING);
> if (path_mergeinfo != NULL)
> @@ -415,7 +400,7 @@
>
> /* See if we have a mergeinfo_changed record for this path. If not,
> then it can't have mergeinfo. */
> - SQLITE_ERR(sqlite3_prepare(db, "SELECT COUNT(*) from mergeinfo_changed"
> + SQLITE_ERR(sqlite3_prepare(db, "SELECT MAX(revision) from mergeinfo_changed"
> " where path = ? and revision <= ?;",
> -1, &stmt, NULL), db);
>
> @@ -426,14 +411,15 @@
> return svn_error_create(SVN_ERR_FS_SQLITE_ERROR, NULL,
> sqlite3_errmsg(db));
>
> - count = sqlite3_column_int64(stmt, 0);
> + lastmerged_rev = sqlite3_column_int64(stmt, 0);
> SQLITE_ERR(sqlite3_finalize(stmt), db);
>
> /* If we've got mergeinfo data, transform it from the db into a
> mergeinfo hash */
> - if (count > 0)
> + if (lastmerged_rev > 0)
> {
> - SVN_ERR(parse_mergeinfo_from_db(db, path, rev, &path_mergeinfo, pool));
> + SVN_ERR(parse_mergeinfo_from_db(db, path, lastmerged_rev,
> + &path_mergeinfo, pool));
> if (path_mergeinfo)
> {
> if (result)
> @@ -446,7 +432,7 @@
> }
>
> /* If this path has no mergeinfo, and we are asked to, check our parent */
> - if (count == 0 && include_parents)
> + if (lastmerged_rev == 0 && include_parents)
> {
> svn_stringbuf_t *parentpath;
Merge Tracking: What's next?
Posted by Daniel Rall <dl...@collab.net>.
Heya Kamesh! With Madan working on propogation of merge history
during copy/move and me working on the merge conflict resolution
callback, I was hoping you'd be up for tackling the next major piece
of the end-to-end puzzle: eliding on the client-side, within the
working copy.
When setting merge info on a path within a WC, typically from an
'update', 'merge', or 'merge --record-only' operation, we need to
elide merge info on child paths up the tree as far as they need to go.
If you're up for this, would you send a description of specifically
how you think it should work to the dev list?
Thanks, Dan