-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pack: skip unavailable configs from etcd and tcs
@TarantoolBot document Title: pack: skip configs from etcd and tcs This patch fixes the `tt pack` error if `etcd` or `tcs` are unavailable during package creation. Part of #1038
- Loading branch information
1 parent
ea54ff6
commit 8a9a78d
Showing
11 changed files
with
258 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
test/integration/pack/test_bundles/vshard_app/instances.enabled/test_app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../test_app |
75 changes: 75 additions & 0 deletions
75
test/integration/pack/test_bundles/vshard_app/test_app/config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
credentials: | ||
users: | ||
client: | ||
password: 'secret' | ||
roles: [super] | ||
replicator: | ||
password: 'secret' | ||
roles: [replication] | ||
storage: | ||
password: 'secret' | ||
roles: [sharding] | ||
|
||
iproto: | ||
advertise: | ||
peer: | ||
login: replicator | ||
sharding: | ||
login: storage | ||
|
||
sharding: | ||
bucket_count: 3000 | ||
|
||
groups: | ||
storages: | ||
app: | ||
module: storage | ||
sharding: | ||
roles: [storage] | ||
replication: | ||
failover: manual | ||
replicasets: | ||
storage-001: | ||
leader: storage-001-a | ||
instances: | ||
storage-001-a: | ||
iproto: | ||
listen: | ||
- uri: localhost:3301 | ||
storage-001-b: | ||
iproto: | ||
listen: | ||
- uri: localhost:3302 | ||
storage-002: | ||
leader: storage-002-a | ||
instances: | ||
storage-002-a: | ||
iproto: | ||
listen: | ||
- uri: localhost:3303 | ||
storage-002-b: | ||
iproto: | ||
listen: | ||
- uri: localhost:3304 | ||
routers: | ||
app: | ||
module: router | ||
sharding: | ||
roles: [router] | ||
replicasets: | ||
router-001: | ||
instances: | ||
router-001-a: | ||
iproto: | ||
listen: | ||
- uri: localhost:3305 | ||
config: | ||
etcd: | ||
endpoints: | ||
- http://localhost:2379 | ||
prefix: /test_app | ||
username: client | ||
password: secret | ||
http: | ||
request: | ||
timeout: 3 |
11 changes: 11 additions & 0 deletions
11
test/integration/pack/test_bundles/vshard_app/test_app/instances.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
storage-001-a: | ||
|
||
storage-001-b: | ||
|
||
storage-002-a: | ||
|
||
storage-002-b: | ||
|
||
router-001-a: | ||
|
34 changes: 34 additions & 0 deletions
34
test/integration/pack/test_bundles/vshard_app/test_app/router.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
local vshard = require('vshard') | ||
local log = require('log') | ||
|
||
-- Bootstrap the vshard router. | ||
while true do | ||
local ok, err = vshard.router.bootstrap({ | ||
if_not_bootstrapped = true, | ||
}) | ||
if ok then | ||
break | ||
end | ||
log.info(('Router bootstrap error: %s'):format(err)) | ||
end | ||
|
||
-- Put data into the cluster. | ||
function put(id, name, age) | ||
local bucket_id = vshard.router.bucket_id_mpcrc32({id}) | ||
vshard.router.callrw(bucket_id, 'put', {id, bucket_id, name, age}) | ||
end | ||
|
||
-- Get data from the cluster. | ||
function get(id) | ||
local bucket_id = vshard.router.bucket_id_mpcrc32({id}) | ||
return vshard.router.callro(bucket_id, 'get', {id}) | ||
end | ||
|
||
-- Put sample data. | ||
function put_sample_data() | ||
put(1, 'Elizabeth', 12) | ||
put(2, 'Mary', 46) | ||
put(3, 'David', 33) | ||
put(4, 'William', 81) | ||
put(5, 'Jack', 35) | ||
end |
56 changes: 56 additions & 0 deletions
56
test/integration/pack/test_bundles/vshard_app/test_app/storage.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
local vshard = require('vshard') | ||
|
||
-- Create 'customers' space. | ||
box.once('customers', function() | ||
box.schema.create_space('customers', { | ||
format = {{ | ||
name = 'id', | ||
type = 'unsigned' | ||
}, { | ||
name = 'bucket_id', | ||
type = 'unsigned' | ||
}, { | ||
name = 'name', | ||
type = 'string' | ||
}, { | ||
name = 'age', | ||
type = 'number' | ||
}} | ||
}) | ||
box.space.customers:create_index('primary_index', { | ||
parts = {{ | ||
field = 1, | ||
type = 'unsigned' | ||
}} | ||
}) | ||
box.space.customers:create_index('bucket_id', { | ||
parts = {{ | ||
field = 2, | ||
type = 'unsigned' | ||
}}, | ||
unique = false | ||
}) | ||
box.space.customers:create_index('age', { | ||
parts = {{ | ||
field = 4, | ||
type = 'number' | ||
}}, | ||
unique = false | ||
}) | ||
end) | ||
|
||
-- Put data to the 'customers' space. | ||
-- Function should be called by the router. | ||
function put(id, bucket_id, name, age) | ||
box.space.customers:insert({id, bucket_id, name, age}) | ||
end | ||
|
||
-- Get data from the 'customers' space. | ||
-- Function should be called by the router. | ||
function get(id) | ||
local tuple = box.space.customers:get(id) | ||
if tuple == nil then | ||
return nil | ||
end | ||
return {tuple.id, tuple.name, tuple.age} | ||
end |
11 changes: 11 additions & 0 deletions
11
test/integration/pack/test_bundles/vshard_app/test_app/test_app-scm-1.rockspec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package = 'test_app' | ||
version = 'scm-1' | ||
source = { | ||
url = '/dev/null', | ||
} | ||
dependencies = { | ||
'vshard == 0.1.25' | ||
} | ||
build = { | ||
type = 'none'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
env: | ||
bin_dir: bin | ||
inc_dir: include | ||
instances_enabled: instances.enabled | ||
restart_on_failure: false | ||
tarantoolctl_layout: false | ||
modules: | ||
directory: modules | ||
app: | ||
run_dir: var/run | ||
log_dir: var/log | ||
wal_dir: var/lib | ||
memtx_dir: var/lib | ||
vinyl_dir: var/lib | ||
ee: | ||
credential_path: "" | ||
templates: | ||
- path: templates | ||
repo: | ||
rocks: "" | ||
distfiles: distfiles |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters