Re: [HACKERS] [patch] reorder tablespaces in basebackup tar streamfor backup_label
От | Michael Banck |
---|---|
Тема | Re: [HACKERS] [patch] reorder tablespaces in basebackup tar streamfor backup_label |
Дата | |
Msg-id | 1489689490.4779.14.camel@credativ.de обсуждение исходный текст |
Ответ на | Re: [HACKERS] [patch] reorder tablespaces in basebackup tar streamfor backup_label (Michael Paquier <michael.paquier@gmail.com>) |
Ответы |
Re: [HACKERS] [patch] reorder tablespaces in basebackup tar streamfor backup_label
|
Список | pgsql-hackers |
Hi, sorry, it took me a while to get back to this. Am Freitag, den 03.03.2017, 15:44 +0900 schrieb Michael Paquier: > On Wed, Feb 22, 2017 at 9:23 PM, Bernd Helmle <mailings@oopsware.de> wrote: > > The comment in the code says explicitely to add the base directory to > > the end of the list, not sure if that is out of a certain reason. > > > > I'd say this is an oversight in the implementation. I'm currently > > working on a tool using the streaming protocol directly and i've > > understood it exactly the way, that the default tablespace is the first > > one in the stream. > > > > So +1 for the patch. > > Commit 507069de has switched the main directory from the beginning to > the end of the list, and the thread about this commit is here: > https://www.postgresql.org/message-id/AANLkTikgmZRkBuQ%2B_hcwPBv7Cd7xW48Ev%3DUBHA-k4v0W%40mail.gmail.com > > + /* Add a node for the base directory at the beginning. This way, the > + * backup_label file is always the first file to be sent. */ > ti = palloc0(sizeof(tablespaceinfo)); > ti->size = opt->progress ? sendDir(".", 1, true, tablespaces, > true) : -1; > - tablespaces = lappend(tablespaces, ti); > + tablespaces = lcons(ti, tablespaces); > So, the main directory is located at the end on purpose. When using > --wal-method=fetch the WAL segments are part of the main tarball, so > if you send the main tarball first you would need to generate a second > tarball with the WAL segments that have been generated between the > moment the main tarball has finished until the end of the last > tablespace taken if you want to have a consistent backup. Ah, thanks for pointing that out, I've missed that in my testing. > Your patch would work with the stream mode though. Or, if not requesting the "WAL" option of the replication protocol's BASE_BACKUP command. I agree it doesn't make sense to start messing with fetch mode, but I don't think we guarantee any ordering of tablespaces (to wit, Bernd was pretty sure it was the other way around all the time), neither do I think having the main tablespace be the first for non-WAL/stream and the last for WAL/fetch would be confusing personally, though I understand this is debatable. So I've updated the patch to only switch the main tablespace to be first in case WAL isn't included, please find it attached. Michael -- Michael Banck Projektleiter / Senior Berater Tel.: +49 2166 9901-171 Fax: +49 2166 9901-100 Email: michael.banck@credativ.de credativ GmbH, HRB Mönchengladbach 12080 USt-ID-Nummer: DE204566209 Trompeterallee 108, 41189 Mönchengladbach Geschäftsführung: Dr. Michael Meskes, Jörg Folz, Sascha Heuer -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Вложения
В списке pgsql-hackers по дате отправления: