Export single projects from the database

680 views
Skip to first unread message

Philipp Altmann

unread,
Jan 10, 2012, 3:20:48 PM1/10/12
to Repo and Gerrit Discussion
Hi,

has anybody ever exported a single project to another Gerrit instance
and dump the correct database sets which are involved with this
project?

Cheers,
Philipp

Shawn Pearce

unread,
Jan 10, 2012, 3:30:18 PM1/10/12
to Philipp Altmann, Repo and Gerrit Discussion
On Tue, Jan 10, 2012 at 12:20, Philipp Altmann <alt...@gmail.com> wrote:
> has anybody ever exported a single project to another Gerrit instance
> and dump the correct database sets which are involved with this
> project?

I've done this once to split the Gerrit project and its related
siblings to gerrit-review.googlesource.com. :-)

I made a backup of the full source server, restored that to a new
empty PostgreSQL database, then used SQL to delete any change rows
that I didn't where (WHERE dest_project_name NOT LIKE 'tools/%'). I
cleaned up the other tables by looking for tables that have a
change_id column and deleting any rows where change_id NOT IN (SELECT
change_id FROM changes). Only took a few minutes.

The problem with loading this into an existing server is the change_id
values may conflict with other changes already on that server. So its
pretty difficult to pick up and move those changes to an existing
server. You could find out the max change_id of the incoming set, go
manually bump the destination server's change_id_seq to reserve
sufficient id space, then bump all of the old change_ids by some base
value so they are in a unique space in the destination... and finally
load the rows to the destination. No its not easy.

Philipp Altmann

unread,
Jan 12, 2012, 5:31:31 AM1/12/12
to Repo and Gerrit Discussion
> The problem with loading this into an existing server is the change_id
> values may conflict with other changes already on that server. So its
> pretty difficult to pick up and move those changes to an existing
> server. You could find out the max change_id of the incoming set, go
> manually bump the destination server's change_id_seq to reserve
> sufficient id space, then bump all of the old change_ids by some base
> value so they are in a unique space in the destination... and finally
> load the rows to the destination. No its not easy.

This sounds like Gerrit needs an import / export feature :).
I think that's important for the future because when you are working
in different teams with different Gerrit instances and you will move
one project to another team you would like to import the hole Gerrit
project history.
There are any plans for this?

Cheers,
Philipp

Edwin Kempin

unread,
Jan 12, 2012, 5:44:14 AM1/12/12
to Philipp Altmann, Repo and Gerrit Discussion
2012/1/12 Philipp Altmann <alt...@gmail.com>
There is the idea to get rid of the database and to store the review data directly in the git repositories.
When this is done, you can simply move git repositories on the filesystem from one Gerrit Server to another Gerrit Server (no export/import feature needed).
It's not known yet, when this can be expected to be ready.
 

Cheers,
Philipp

--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

Saša Živkov

unread,
Jan 25, 2012, 1:08:27 PM1/25/12
to Philipp Altmann, Repo and Gerrit Discussion
On Thu, Jan 12, 2012 at 11:31 AM, Philipp Altmann <alt...@gmail.com> wrote:
>> The problem with loading this into an existing server is the change_id
>> values may conflict with other changes already on that server. So its
>> pretty difficult to pick up and move those changes to an existing
>> server. You could find out the max change_id of the incoming set, go
>> manually bump the destination server's change_id_seq to reserve
>> sufficient id space, then bump all of the old change_ids by some base
>> value so they are in a unique space in the destination... and finally
>> load the rows to the destination. No its not easy.
>
> This sounds like Gerrit needs an import / export feature :).

Yes, this would be a useful feature.

> I think that's important for the future because when you are working
> in different teams with different Gerrit instances and you will move
> one project to another team you would like to import the hole Gerrit
> project history.
> There are any plans for this?

I think no. But contributions are welcome ;-)

Reply all
Reply to author
Forward
0 new messages