Skip to content
Snippets Groups Projects
Commit eceb9a28 authored by Konstantin Osipov's avatar Konstantin Osipov
Browse files

hot standby mode: fix broken read only mode during hot standby

Fix a bug when the server would enter read-write mode prematurely
in hot standby mode, and let the script continue and try to create
spaces/indexes.

The bug is a regression introduced by the patch which changed cfg.listen
to a dynamic option.

This is an *incompatible* change: box.cfg{} used to return before binding
to the primary port, this is no llonger the case.

Always bind to the listen port in box.cfg{} call, not in the background,
and leave local hot standby mode *before* leaving box.cfg{}.

This avoids tons of tricky race conditions in user scripts when box.cfg{}
has ended but the server is actually still read only. Except, thanks to
another bug in box_set_cluster_id(), it wasn't really read-only, because
box_set_cluster_id() would switch off read-only mode before local hot
standby has ended (so a superposition of two bugs).

The manifestation of this  was as follows:

Imagine the following script:
    box.cfg{listen = 3301}
    box.schema.space.create('tester')
    box.space.tester:create_index('primary')

The server would start in local hot standby mode. Save a snapshot.
Fall through to DDL. Then leave local hot standby and turn on
WAL. The created space will end up not being in the write
ahead log.

The problem wasn't noticable in most cases, since the server could
bind to the primary port quite quickly.

Fix the test runner to detect a local hot standby server as started.

Add a workaround for gh-721 until a complete patch is ready.
parent 659670e3
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment