Skip to content
Snippets Groups Projects
Commit b9f678a4 authored by Roman Tsisyk's avatar Roman Tsisyk
Browse files

Add a test case for #806

parent 9adbd5c9
No related merge requests found
......@@ -169,6 +169,27 @@ box.info.vclock[11]
---
- null
...
-------------------------------------------------------------
gh-806: cant prune old replicas by deleting their server ids
-------------------------------------------------------------
box.space._schema:insert{'test', 1}
---
- ['test', 1]
...
cluster_len = box.space._cluster:len()
---
...
for id, lsn in pairs(box.info.vclock) do if id ~= box.info.server.id then box.space._cluster:delete{id} end end
---
...
box.space._cluster:len() < cluster_len
---
- true
...
box.snapshot()
---
- ok
...
box.schema.user.revoke('guest', 'replication')
---
...
......@@ -174,6 +174,7 @@ replica.admin('box.info.vclock[%d]' % replica_id)
replica.admin('box.info.vclock[%d]' % replica_id2)
replica_id3 = 11
# Tuple is read-only
server.admin("box.space._cluster:update(%d, {{'=', 1, %d}})" %
(replica_id2, replica_id3))
replica.wait_lsn(master_id, master.get_lsn(master_id))
......@@ -186,6 +187,28 @@ replica.admin('box.info.vclock[%d]' % replica_id3)
replica.stop()
replica.cleanup(True)
print '-------------------------------------------------------------'
print 'gh-806: cant prune old replicas by deleting their server ids'
print '-------------------------------------------------------------'
# Rotate xlog
master.restart()
master.admin("box.space._schema:insert{'test', 1}")
# Prune old replicas
master.admin("cluster_len = box.space._cluster:len()")
# Delete from _cluster for replicas with lsn=0 is safe
master.admin('for id, lsn in pairs(box.info.vclock) do'
' if id ~= box.info.server.id then box.space._cluster:delete{id} end '
'end');
master.admin("box.space._cluster:len() < cluster_len")
# Save a snapshot without removed replicas in vclock
master.admin("box.snapshot()")
# Master is not crashed then recovering xlog with {replica_id: 0} in header
master.restart()
# Cleanup
sys.stdout.pop_filter()
......
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