Skip to content

Commit d7581eb

Browse files
Satbekvakhov
authored andcommitted
Fix is_master_only options. Now it runs on master correctly.
When `is_master_only` was true, expirationd worked only on replica. It was not correct. Now it works only on master when `is_master_only` true. (cherry picked from commit a411f3e16b81bd8f2e9fc7af073c95768f1020e5)
1 parent 9c403d5 commit d7581eb

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
66
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
77

8-
## [Unreleased]
8+
## Unreleased
99

1010
### Added
1111

1212
### Changed
1313

1414
### Fixed
1515

16+
- Fix `is_master_only` option. Now it runs on master correctly.
17+
1618
## 1.6.0 - 2024-03-25
1719

1820
The release introduces a role for Tarantool 3.0.

roles/expirationd.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ local function load_task(task_conf, task_name)
248248

249249
fiber.name(role_name .. ":" .. task_name)
250250

251-
local skip = task_conf.is_master_only and not box.info.ro
251+
local skip = task_conf.is_master_only and box.info.ro
252252
if skip then
253253
return
254254
end

test/unit/tarantool_role_test.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
local expirationd = require('expirationd')
2+
local fiber = require('fiber')
23
local t = require('luatest')
34
local helpers = require('test.helper')
45

@@ -551,6 +552,9 @@ end
551552
function g.test_apply_config_skip_is_master_only(cg)
552553
local task_name = "apply_config_test"
553554

555+
t.assert_equals(box.info.ro, false)
556+
box.cfg{read_only=true}
557+
554558
cg.role.apply({
555559
[task_name] = {
556560
space = g.space.id,
@@ -559,7 +563,10 @@ function g.test_apply_config_skip_is_master_only(cg)
559563
},
560564
}, {is_master = false})
561565

566+
fiber.yield()
562567
helpers.retrying({}, function()
563568
t.assert_equals(#expirationd.tasks(), 0)
564569
end)
570+
571+
box.cfg{read_only=false}
565572
end

0 commit comments

Comments
 (0)