Edgewall Software
Modify

Opened 14 years ago

Last modified 14 years ago

#9979 new defect

[PATCH] Single changeset resync fails if changesets are missing

Reported by: barry@… Owned by:
Priority: normal Milestone: next-major-releases
Component: version control Version: 0.12-stable
Severity: normal Keywords: patch resync
Cc: Thijs Triemstra, peter.westwood@… Branch:
Release Notes:
API Changes:
Internal Changes:

Description

When running repository resync repo rev the operation fails if the revision you are trying to resync is missing from the revisions table. Attached patch "fixes" that, maybe not in the most elegant or correct way. Improvements welcome.

Attachments (1)

9979.diff (2.8 KB ) - added by anonymous 14 years ago.

Download all attachments as: .zip

Change History (7)

by anonymous, 14 years ago

Attachment: 9979.diff added

comment:1 by Thijs Triemstra, 14 years ago

Cc: Thijs Triemstra added
Keywords: patch added
Summary: Single changeset resync fails if changesets are missing[PATCH] Single changeset resync fails if changesets are missing

comment:2 by Christian Boos, 14 years ago

If the revision is missing for whatever reason, a sync should normally be enough (not resync, but sync).

repository sync <repos> [rev]

    Resume synchronization of repositories

    It works like `resync`, except that it doesn't clear the already
    synchronized changesets, so it's a better way to resume an interrupted
    `resync`.

    See `resync` help for detailed usage.

Or do you happen to have a situation where sync doesn't work?

Btw, thanks for providing a patch, that shows you're willing to help fix the problem! Note we never use REPLACE INTO as that's not portable (SQLite does it differently and PostgreSQL doesn't support that at all). What we usually do in this case is a UPDATE/SELECT/INSERT sequence, see source:tags/trac-0.12/trac/cache.py@:176-186#L169 for example.

comment:3 by barry@…, 14 years ago

Replying to cboos:

Or do you happen to have a situation where sync doesn't work?

Btw, thanks for providing a patch, that shows you're willing to help fix the problem! Note we never use REPLACE INTO as that's not portable (SQLite does it differently and PostgreSQL doesn't support that at all). What we usually do in this case is a UPDATE/SELECT/INSERT sequence, see source:tags/trac-0.12/trac/cache.py@:176-186#L169 for example.

Sync doesn't work either. I am working on http://plugins.trac.wordpress.org/ There are quite a few missing revisions from trac. (4645 - 13076). I am not sure how it happened, but resyncing the entire repo takes about 10 hours, so I am trying to avoid it. It also suffers from sqlite locking problems during the resync so I have to take down the entire site.

Trac [/home/trac/trac-environs/wp-plugins]> repository sync "(default)" 5001
5001 resynced on (default).

http://plugins.trac.wordpress.org/changeset/5001

Blank.

With my patch, I can run:

Trac [/home/trac/trac-environs/wp-plugins]> repository resync "(default)" 5000
5000 resynced on (default).

http://plugins.trac.wordpress.org/changeset/5000

As you can see the metadata is there now, but the node_change entries are missing. Related #9980

I just want to completely resync revisions 4645 - 13076 from SVN without resyncing the other 300+k revisions. Completely resyncing all of the data associated with a particular revision seems to be generally useful as well.

Regarding REPLACE - I kind of figured that after I uploaded the patch. If we decide this is useful I can redo the patch.

comment:4 by Christian Boos, 14 years ago

Keywords: resync added
Milestone: next-major-0.1X

Ok, thanks for the feedback. As you're using MySQL, chances are that you had this problem in the past due to #8067.

In the past, I once wrote a something similar (#1271), but failed to integrate it at that time. Vitaly updated it for 0.9, this might still be a good starting point, see attachment:trac-0.9stable-r2652.resync-ranges.patch:ticket:1271.

in reply to:  4 comment:5 by barry@…, 14 years ago

Replying to cboos:

Ok, thanks for the feedback. As you're using MySQL, chances are that you had this problem in the past due to #8067.

We are using sqlite, I am not sure yet when/how it broke. I haven't looked at the old databases yet to see if the problem is old or new.

In the past, I once wrote a something similar (#1271), but failed to integrate it at that time. Vitaly updated it for 0.9, this might still be a good starting point, see attachment:trac-0.9stable-r2652.resync-ranges.patch:ticket:1271.

Thanks for the link - I will check it out.

comment:6 by peter.westwood@…, 14 years ago

Cc: peter.westwood@… added

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The ticket will remain with no owner.
The ticket will be disowned.
as The resolution will be set. Next status will be 'closed'.
The owner will be changed from (none) to anonymous. Next status will be 'assigned'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.