File: checkpoint_threshold.result

package info (click to toggle)
tarantool 2.6.0-1.4
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 85,412 kB
  • sloc: ansic: 513,775; cpp: 69,493; sh: 25,650; python: 19,190; perl: 14,973; makefile: 4,178; yacc: 1,329; sql: 1,074; pascal: 620; ruby: 190; awk: 18; lisp: 7
file content (118 lines) | stat: -rw-r--r-- 2,170 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
test_run = require('test_run').new()
---
...
fiber = require('fiber')
---
...
digest = require('digest')
---
...
default_threshold = box.cfg.checkpoint_wal_threshold
---
...
threshold = 10 * 1024
---
...
box.cfg{checkpoint_wal_threshold = threshold}
---
...
s = box.schema.space.create('test')
---
...
_ = s:create_index('pk')
---
...
box.snapshot()
---
- ok
...
test_run:cmd("setopt delimiter ';'")
---
- true
...
function put(size)
    s:auto_increment{digest.urandom(size)}
end;
---
...
function wait_checkpoint(signature)
    signature = signature or box.info.signature
    return test_run:wait_cond(function()
        local checkpoints = box.info.gc().checkpoints
        return signature == checkpoints[#checkpoints].signature
    end, 10)
end;
---
...
test_run:cmd("setopt delimiter ''");
---
- true
...
--
-- Check that checkpointing is triggered automatically once
-- the size of WAL files written since the last checkpoint
-- exceeds box.cfg.checkpoint_wal_threshold (gh-1082).
--
for i = 1, 3 do put(threshold / 3) end
---
...
wait_checkpoint()
---
- true
...
for i = 1, 5 do put(threshold / 5) end
---
...
wait_checkpoint()
---
- true
...
--
-- Check that WAL rows written while a checkpoint was created
-- are accounted as written after the checkpoint.
--
box.error.injection.set('ERRINJ_SNAP_COMMIT_DELAY', true)
---
- ok
...
-- This should trigger checkpointing, which will take quite
-- a while due to the injected delay.
for i = 1, 5 do put(threshold / 5) end
---
...
fiber.sleep(0)
---
...
-- Remember the future checkpoint signature.
signature = box.info.signature
---
...
-- Insert some records while the checkpoint is created.
for i = 1, 4 do put(threshold / 5) end
---
...
-- Disable the delay and wait for checkpointing to complete.
box.error.injection.set('ERRINJ_SNAP_COMMIT_DELAY', false)
---
- ok
...
wait_checkpoint(signature)
---
- true
...
-- Check that insertion of one more record triggers another
-- checkpoint, because it sums up with records written while
-- the previous checkpoint was created.
put(threshold / 5)
---
...
wait_checkpoint()
---
- true
...
box.cfg{checkpoint_wal_threshold = default_threshold}
---
...
s:drop()
---
...