[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r33653 - branches/fs-rep-sharing/subversion/libsvn_fs_fs

From: Hyrum K. Wright <hyrum_wright_at_mail.utexas.edu>
Date: Wed, 15 Oct 2008 22:27:06 +0200

Greg Stein wrote:
> On Wed, Oct 15, 2008 at 7:26 AM, <hwright_at_tigris.org> wrote:
>> ...
>> +++ branches/fs-rep-sharing/subversion/libsvn_fs_fs/rep-cache.c Wed Oct 15 07:26:35 2008 (r33653)
>> @@ -36,7 +36,8 @@ const char *upgrade_sql[] = { NULL,
>> " revision integer not null, "
>> " offset integer not null, "
>> " size integer not null, "
>> - " expanded_size integer not null); "
>> + " expanded_size integer not null, "
>> + " reuse_count not null); "
>
> Should put an "integer" in there.
>
>> APR_EOL_STR
>> "create unique index i_hash on rep_cache(hash); "
>> APR_EOL_STR
>> @@ -155,8 +156,8 @@ svn_fs_fs__set_rep_reference(svn_fs_t *f
>>
>> SVN_ERR(svn_sqlite__prepare(&stmt, ffd->rep_cache,
>> "insert into rep_cache (hash, revision, offset, size, "
>> - "expanded_size) "
>> - "values (?, ?, ?, ?, ?);", pool));
>> + "expanded_size, reuse_count) "
>> + "values (?, ?, ?, ?, ?, 0);", pool));
>> SVN_ERR(svn_sqlite__bind_text(stmt, 1, svn_checksum_to_cstring(rep->checksum,
>> pool)));
>> SVN_ERR(svn_sqlite__bind_int64(stmt, 2, rep->revision));
>
> I think when you're binding multiple values, it is clearer to use :1,
> :2, etc style of syntax rather than just a question mark.
>
>> @@ -167,3 +168,40 @@ svn_fs_fs__set_rep_reference(svn_fs_t *f
>> SVN_ERR(svn_sqlite__step(&have_row, stmt));
>> return svn_sqlite__finalize(stmt);
>> }
>> +
>> +svn_error_t *
>> +svn_fs_fs__inc_rep_reuse(svn_fs_t *fs,
>> + representation_t *rep,
>> + apr_pool_t *pool)
>> +{
>> + fs_fs_data_t *ffd = fs->fsap_data;
>> + svn_boolean_t have_row;
>> + svn_sqlite__stmt_t *stmt;
>> +
>> + /* Fetch the current count. */
>> + SVN_ERR(svn_sqlite__prepare(&stmt, ffd->rep_cache,
>> + "select reuse_count from rep_cache where hash = ?", pool));
>> + SVN_ERR(svn_sqlite__bind_text(stmt, 1, svn_checksum_to_cstring(rep->checksum,
>> + pool)));
>> + SVN_ERR(svn_sqlite__step(&have_row, stmt));
>> +
>> + if (!have_row)
>> + return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL,
>> + _("Representation for hash '%s' not found"),
>> + svn_checksum_to_cstring_display(rep->checksum,
>> + pool));
>> +
>> + rep->reuse_count = svn_sqlite__column_int(stmt, 0) + 1;
>> + SVN_ERR(svn_sqlite__finalize(stmt));
>> +
>> + /* Update the reuse_count. */
>> + SVN_ERR(svn_sqlite__prepare(&stmt, ffd->rep_cache,
>> + "update rep_cache set reuse_count = ? where hash = ?",
>> + pool));
>> + SVN_ERR(svn_sqlite__bind_int64(stmt, 1, rep->reuse_count));
>> + SVN_ERR(svn_sqlite__bind_text(stmt, 2, svn_checksum_to_cstring(rep->checksum,
>> + pool)));
>
> Same here.

Fixed in r33665.

Thanks,
-Hyrum

Received on 2008-10-15 22:27:25 CEST

This is an archived mail posted to the Subversion Dev mailing list.