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

[PATCH] rep-cache.db insert optimization (was: Re: [PATCH] svnadmin build-repcache command)

From: Denis Kovalchuk <denis.kovalchuk_at_visualsvn.com>
Date: Thu, 26 Mar 2020 21:49:59 +0300

>
> Well, maybe. The code _appears_ to take a roundabout approach, but I'm
>> not sure that's actually a bug: there might be a difference between
>> «INSERT OR IGNORE» on the one hand, and the current behaviour («INSERT
>> OR FAIL» plus a C check) on the other.
>>
>> Is «INSERT OR IGNORE» supported by all SQLite versions we support?
>>
>
> Yes, INSERT OR IGNORE supported by all versions. I plan to start a separate
> thread about this topic.
>

As mentioned above, I think we can optimize the insert statement for the
case
of a constraint violation. Now we use the 'FAIL' conflict resolution
algorithm [1]
and explicitly handle SVN_ERR_SQLITE_CONSTRAINT error in
svn_fs_fs__set_rep_reference(). Because of this, we have an extra
svn_fs_fs__get_rep_reference() call.

As far as I know, svn_sqlite__step() in svn_sqlite__insert() is the only
place where
the error can occur. Based on this, I suggest to use the 'IGNORE' conflict
resolution
algorithm [1] and remove the SVN_ERR_SQLITE_CONSTRAINT handling, because
the error should not occur now. It seems to me the change is quite safe,
because
the behavior is well covered by tests.

I've attached a patch.

[1] https://www.sqlite.org/lang_conflict.html

Regards,
Denis Kovalchuk

Received on 2020-03-26 19:50:22 CET

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.