Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
tarantool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
core
tarantool
Commits
e39b4c19
Commit
e39b4c19
authored
6 years ago
by
Kirill Yukhin
Browse files
Options
Downloads
Plain Diff
Merge branch '1.9' into 1.10
parents
8395287e
1d3a6cb0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/box/lua/load_cfg.lua
+18
-3
18 additions, 3 deletions
src/box/lua/load_cfg.lua
test/replication/misc.result
+24
-0
24 additions, 0 deletions
test/replication/misc.result
test/replication/misc.test.lua
+10
-0
10 additions, 0 deletions
test/replication/misc.test.lua
with
52 additions
and
3 deletions
src/box/lua/load_cfg.lua
+
18
−
3
View file @
e39b4c19
...
...
@@ -5,6 +5,21 @@ local json = require('json')
local
private
=
require
(
'box.internal'
)
local
urilib
=
require
(
'uri'
)
local
math
=
require
(
'math'
)
local
fiber
=
require
(
'fiber'
)
-- Function decorator that is used to prevent box.cfg() from
-- being called concurrently by different fibers.
local
lock
=
fiber
.
channel
(
1
)
local
function
locked
(
f
)
return
function
(
...
)
lock
:
put
(
true
)
local
status
,
err
=
pcall
(
f
,
...
)
lock
:
get
()
if
not
status
then
error
(
err
)
end
end
end
-- all available options
local
default_cfg
=
{
...
...
@@ -409,7 +424,7 @@ local function load_cfg(cfg)
-- Save new box.cfg
box
.
cfg
=
cfg
if
not
pcall
(
private
.
cfg_check
)
then
box
.
cfg
=
load_cfg
-- restore original box.cfg
box
.
cfg
=
locked
(
load_cfg
)
-- restore original box.cfg
return
box
.
error
()
-- re-throw exception from check_cfg()
end
-- Restore box members after initial configuration
...
...
@@ -423,7 +438,7 @@ local function load_cfg(cfg)
__newindex
=
function
(
table
,
index
)
error
(
'Attempt to modify a read-only table'
)
end
,
__call
=
reload_cfg
,
__call
=
locked
(
reload_cfg
)
,
})
private
.
cfg_load
()
for
key
,
fun
in
pairs
(
dynamic_cfg
)
do
...
...
@@ -439,7 +454,7 @@ local function load_cfg(cfg)
box
.
schema
.
upgrade
{
auto
=
true
}
end
end
box
.
cfg
=
load_cfg
box
.
cfg
=
locked
(
load_cfg
)
-- gh-810:
-- hack luajit default cpath
...
...
This diff is collapsed.
Click to expand it.
test/replication/misc.result
+
24
−
0
View file @
e39b4c19
...
...
@@ -23,6 +23,30 @@ box.cfg{replication = {'127.0.0.1:12345', box.cfg.listen}}
- error: 'Incorrect value for option ''replication'': failed to connect to one or
more replicas'
...
-- gh-3606 - Tarantool crashes if box.cfg.replication is updated concurrently
fiber = require('fiber')
---
...
c = fiber.channel(2)
---
...
f = function() fiber.create(function() pcall(box.cfg, {replication = {12345}}) c:put(true) end) end
---
...
f()
---
...
f()
---
...
c:get()
---
- true
...
c:get()
---
- true
...
box.cfg{replication_timeout = replication_timeout, replication_connect_timeout = replication_connect_timeout}
---
...
...
...
This diff is collapsed.
Click to expand it.
test/replication/misc.test.lua
+
10
−
0
View file @
e39b4c19
...
...
@@ -9,6 +9,16 @@ replication_timeout = box.cfg.replication_timeout
replication_connect_timeout
=
box
.
cfg
.
replication_connect_timeout
box
.
cfg
{
replication_timeout
=
0
.
05
,
replication_connect_timeout
=
0
.
05
,
replication
=
{}}
box
.
cfg
{
replication
=
{
'127.0.0.1:12345'
,
box
.
cfg
.
listen
}}
-- gh-3606 - Tarantool crashes if box.cfg.replication is updated concurrently
fiber
=
require
(
'fiber'
)
c
=
fiber
.
channel
(
2
)
f
=
function
()
fiber
.
create
(
function
()
pcall
(
box
.
cfg
,
{
replication
=
{
12345
}})
c
:
put
(
true
)
end
)
end
f
()
f
()
c
:
get
()
c
:
get
()
box
.
cfg
{
replication_timeout
=
replication_timeout
,
replication_connect_timeout
=
replication_connect_timeout
}
-- gh-3111 - Allow to rebootstrap a replica from a read-only master
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment