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

Re: New file svn-restore-dumps.py

From: Martin Furter <mf_at_rola.ch>
Date: Mon, 16 Mar 2009 21:38:03 +0100 (CET)

On Fri, 13 Mar 2009, Mark Stead wrote:

> Ok, substantial changes. I've attached a patch, plus the whole file.
> Comments below.
>
> 2009/3/12 Martin Furter <mf_at_rola.ch>
>
>>
>> I didn't want to wait a night just to test it, so I replaced the
>> "svnadmin load repospath" by "wc -l". But that lead to the following error
>> on solaris:
>>
>> IOError: [Errno 11] Resource temporarily unavailable
>
>
> That's strange. Maybe the InputPipe classes are not working on
> Solaris/Unix. I've only been able to test on Windows - and there is a
> separate chunk of code for Unix. Please advise me if you have had success
> or problems on Unix.

On Linux it works when using svnadmin load so it's not a general UNIX
problem. I'll have a look at that later...

>> So I just commented out the whole command to find the following:
>>
>> 1) It is a bit too verbose, I got tons of "Ignoring dump file..." messages,
>> especially many for other repositories. Would be nice if those aren't
>> printed, except maybe when a new option '-v' is specified.
>
>
> Verbose mode added. Also added some additional diagnostics - when in
> verbose mode.

Nice :)

>> 2) I got an endless loop because nothing is loaded into the repository and
>> then the HEAD revision does not increase.
>
>
> Yeah, this is a quirk with how SVN operates. A new repository will have a
> revision of 0. Applying that dump of revision 0 to a new repository leaves
> the revision unchanged.

No, the problem was that I replaced "svnadmin load" by "wc -l" which
didn't load anything so HEAD was always 0 and started from r0 again.

>> The script scans the directory over and over until it doesn't find any
>> matching dumpfiles anymore. It would be better to scan the directory once
>> and store the list of dumps found in a list. Also the HEAD revision of the
>> repository can be read only once at the start of the script, since if
>> svnadmin fails the script will detect it, and if the dumps are labeled wrong
>> bad things happen anyway.
>> So I propose to change it this way:
>> - Read HEAD revision of the repos.
>> - Scan for dump files to load and put them into a list.
>> - Load all dump files.
>
>
> I've done the restructure. It scans the dumps, building a dict() keyed on
> the first revision number. It then loads the required dumps.

Almost perfect... ;)

I found another problem. If you have the following dump files:

rps.000000-000019.svndmp
rps.000020-000039.svndmp
rps.000020-000044.svndmp
rps.000040-000059.svndmp

It loads 0-19, 20-44, then fails because it can't find a dump file
starting with revision 45.

The attached version contains an enhanced scan_all_dump_files function. It
creates a graph of all dump files from HEAD+1 up to the highest revision,
then throws away all nodes which have only one or no connection. After
that it chooses a path from HEAD+1 to HIGHEST and ignores redundant
sub-paths.

I hope you like it, though it's much more complicated.

Martin

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1335268

Received on 2009-03-16 21:39:42 CET

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