Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is enable_wal needed in standby server? #144

Closed
DeoLeung opened this issue Jul 10, 2020 · 13 comments
Closed

Is enable_wal needed in standby server? #144

DeoLeung opened this issue Jul 10, 2020 · 13 comments

Comments

@DeoLeung
Copy link

Hi,

I'm making a slave db and found this parameter in the document.

without it, the streaming seems to be ok, but strange that the slave db size is about 2x of the master(investigating)

my question is, is it required for slave db to maintain a usable pgroonga index?

@kou kou changed the title [question] enable_wal Is enable_wal needed in standby server? Jul 14, 2020
@kou
Copy link
Member

kou commented Jul 14, 2020

without it, the streaming seems to be ok

Does it mean that you can do full text search with PGroonga index on standby server with pgroonga.enable_wal = off?

If it's yes, could you show EXPLAIN SELECT ... on your standby server?

but strange that the slave db size is about 2x of the master(investigating)

How did you calculate the DB size on the master server and the standby server?

You can't calculate the DB size for PGroonga with the standard PostgreSQL way. See also: #15

is it required for slave db to maintain a usable pgroonga index?

Yes. pgroonga.enable_wal = on is required as documented.

@DeoLeung
Copy link
Author

yes, explain on the standby server(pg12) is

show pgroonga.enable_wal; -- off, on both master/slave
explain select * from "data-xxx"
where extra &` 'string @ "121号楼"';
Index Scan using "data-xxx_extra_idx" on "data-xxx"  (cost=0.00..8196.64 rows=206 width=1687)
  Index Cond: (extra &` 'string @ "121号楼"'::text)

same as master

for the size , I did du -h on the path

# master, around 3.7k files under 16386
5.4G    /xxx/base/16386
18M     /xxx/base/26334
8.0M    /xxx/base/1
5.5G    /xxx/base

# slave, around 6k files under 16386
17G     /xxx/base/16386
17G     /xxx/base

I will do a file list diff on it later

@kou
Copy link
Member

kou commented Jul 14, 2020

It's strange...

Do you use streaming replication https://pgroonga.github.io/reference/streaming-replication.html or logical replication https://pgroonga.github.io/reference/logical-replication.html ?

@DeoLeung
Copy link
Author

I use repmgr, it shall be streaming replica

is it because the index exists before I did the first base backup?

let me double check with new created table.

@DeoLeung
Copy link
Author

DeoLeung commented Jul 14, 2020

I tried the entries example, and got ERROR: pgroonga: object isn't found: <Sources61623> on slave now

if I add the enable_wal now, does master restart required? and do I need to re-do a new slave base backup?


without a restart of master, I added pgroonga.enable_wal = on , did a new base backup, creating new table on master still got the above error on slave

@kou
Copy link
Member

kou commented Jul 14, 2020

I added pgroonga.enable_wal = on

Does it mean that you added pgroonga.enable_wal = on to postgresql.conf?
If it's yes, you need to restart your master server and standby servers.

If you used SET pgroonga.enable_wal = on, you don't need to restart them. But the configuration isn't persisted. You also need add pgroonga.enable_wal = on to postgresql.conf.

You don't need to re-run base backup after you enable pgroonga.enable_wal. You just need to REINDEX INDEX ${PGROONGA_INDEX}. It recreates the PGroonga index with full WAL and the recreated PGroonga index will work on standby servers well.

@DeoLeung
Copy link
Author

DeoLeung commented Jul 18, 2020

Finally got a low traffic chance to restart the server, it seems not working, I still got the error.

from the log I can see each time recreate/ reindex it does switch the object

xxx                         | 2020-07-18 06:39:03.992 UTC [97] STATEMENT:  SELECT title FROM entries WHERE title %% 'replication';
xxx                         | 2020-07-18 06:39:05.405 UTC [97] ERROR:  pgroonga: object isn't found: <Sources69233>
xxx                         | 2020-07-18 06:39:05.405 UTC [97] STATEMENT:  SELECT title FROM entries WHERE title %% 'replication';
xxx                         | 2020-07-18 06:40:14.643 UTC [97] ERROR:  pgroonga: object isn't found: <Sources69234>
xxx                         | 2020-07-18 06:40:14.643 UTC [97] STATEMENT:  SELECT title FROM entries WHERE title %% 'replication';
xxx                         | 2020-07-18 06:40:17.660 UTC [97] ERROR:  pgroonga: object isn't found: <Sources69234>
xxx                         | 2020-07-18 06:40:17.660 UTC [97] STATEMENT:  SELECT title FROM entries WHERE title %% 'replication';
xxx                         | 2020-07-18 06:41:57.280 UTC [97] ERROR:  pgroonga: object isn't found: <Sources69235>
xxxx                        | 2020-07-18 06:41:57.280 UTC [97] STATEMENT:  SELECT title FROM entries WHERE title %% 'replication';
xxx                         | 2020-07-18 06:41:58.789 UTC [97] ERROR:  pgroonga: object isn't found: <Sources69235>
xxx                         | 2020-07-18 06:41:58.789 UTC [97] STATEMENT:  SELECT title FROM entries WHERE title %% 'replication';

@kou
Copy link
Member

kou commented Jul 18, 2020

Um...
Could you provide an instruction to reproduce this case on my environment?

@DeoLeung
Copy link
Author

I tried to reproduce it using the docker images with fresh database...and it works...

so I wonder would it be possible that my production master was created using 2.2.5 and later replaced with 2.2.6 image.

since the database is not that large, I would try later just dump and restore to a new database to see if it's ok

@zyp-rgb
Copy link

zyp-rgb commented Aug 21, 2020

Um...
Could you provide an instruction to reproduce this case on my environment?

here is a repo reproducing the case
https://github.com/zyp-rgb/pgroonga-fail-reproduce

@kou
Copy link
Member

kou commented Sep 3, 2020

@zyp-rgb Thanks. We found that postgresql-12-pgroonga package isn't build with WAL support.
We've uploaded postgresql-12-pgdg-pgroonga 2.2.6-2. (Note that package name is changed. -pgdg is added to show the package is for PostgreSQL provided by PGDG.)

Could you update your Docker image and try again?

@zyp-rgb
Copy link

zyp-rgb commented Sep 10, 2020

@zyp-rgb Thanks. We found that postgresql-12-pgroonga package isn't build with WAL support.
We've uploaded postgresql-12-pgdg-pgroonga 2.2.6-2. (Note that package name is changed. -pgdg is added to show the package is for PostgreSQL provided by PGDG.)

Could you update your Docker image and try again?

That would work!!
Thank you very much

@kou
Copy link
Member

kou commented Sep 10, 2020

Thanks for confirming this.
I close this.

@kou kou closed this as completed Sep 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants