File: tree_pk_multipart.result

package info (click to toggle)
tarantool 2.6.0-1.4
  • links: PTS, VCS
  • area: main
  • in suites: sid, 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 (544 lines) | stat: -rw-r--r-- 17,001 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
--
-- Insert test
--
env = require('test_run')
---
...
test_run = env.new()
---
...
space = box.schema.space.create('tweedledum')
---
...
-- Multipart primary key (sender nickname, receiver nickname, message id)
i1 = space:create_index('primary', { type = 'tree', parts = {1, 'string', 2, 'string', 3, 'unsigned'}, unique = true })
---
...
space:insert{'Vincent', 'Jules', 0, 'Do you know what they call a - a - a Quarter Pounder with cheese in Paris?'}
---
- ['Vincent', 'Jules', 0, 'Do you know what they call a - a - a Quarter Pounder with
    cheese in Paris?']
...
space:insert{'Jules', 'Vincent', 0, 'They don`t call it a Quarter Pounder with cheese?'}
---
- ['Jules', 'Vincent', 0, 'They don`t call it a Quarter Pounder with cheese?']
...
space:insert{'Vincent', 'Jules', 1, 'No man, they got the metric system. They wouldn`t know what the f--k a Quarter Pounder is.'}
---
- ['Vincent', 'Jules', 1, 'No man, they got the metric system. They wouldn`t know
    what the f--k a Quarter Pounder is.']
...
space:insert{'Jules', 'Vincent', 1, 'Then what do they call it?'}
---
- ['Jules', 'Vincent', 1, 'Then what do they call it?']
...
space:insert{'Vincent', 'Jules', 2, 'They call it a `Royale` with cheese.'}
---
- ['Vincent', 'Jules', 2, 'They call it a `Royale` with cheese.']
...
space:insert{'Jules', 'Vincent', 2, 'A `Royale` with cheese!'}
---
- ['Jules', 'Vincent', 2, 'A `Royale` with cheese!']
...
space:insert{'Vincent', 'Jules', 3, 'That`s right.'}
---
- ['Vincent', 'Jules', 3, 'That`s right.']
...
space:insert{'Jules', 'Vincent', 3, 'What do they call a Big Mac?'}
---
- ['Jules', 'Vincent', 3, 'What do they call a Big Mac?']
...
space:insert{'Vincent', 'Jules', 4, 'A Big Mac`s a Big Mac, but they call it `Le Big Mac.`'}
---
- ['Vincent', 'Jules', 4, 'A Big Mac`s a Big Mac, but they call it `Le Big Mac.`']
...
space:insert{'Jules', 'Vincent', 4, '`Le Big Mac!`'}
---
- ['Jules', 'Vincent', 4, '`Le Big Mac!`']
...
space:insert{'Vincent', 'Jules', 5, 'Ha, ha, ha.'}
---
- ['Vincent', 'Jules', 5, 'Ha, ha, ha.']
...
space:insert{'Jules', 'Vincent', 5, 'What do they call a `Whopper`?'}
---
- ['Jules', 'Vincent', 5, 'What do they call a `Whopper`?']
...
space:insert{'Vincent', 'Jules', 6, 'I dunno, I didn`t go into Burger King.'}
---
- ['Vincent', 'Jules', 6, 'I dunno, I didn`t go into Burger King.']
...
space:insert{'The Wolf!', 'Vincent', 0, 'Jimmie, lead the way. Boys, get to work.'}
---
- ['The Wolf!', 'Vincent', 0, 'Jimmie, lead the way. Boys, get to work.']
...
space:insert{'Vincent', 'The Wolf!', 0, 'A please would be nice.'}
---
- ['Vincent', 'The Wolf!', 0, 'A please would be nice.']
...
space:insert{'The Wolf!', 'Vincent', 1, 'Come again?'}
---
- ['The Wolf!', 'Vincent', 1, 'Come again?']
...
space:insert{'Vincent', 'The Wolf!', 1, 'I said a please would be nice.'}
---
- ['Vincent', 'The Wolf!', 1, 'I said a please would be nice.']
...
space:insert{'The Wolf!', 'Vincent', 2, 'Get it straight buster - I`m not here to say please, I`m here to tell you what to do and if self-preservation is an instinct you possess you`d better fucking do it and do it quick. I`m here to help - if my help`s not appreciated then lotsa luck, gentlemen.'}
---
- ['The Wolf!', 'Vincent', 2, 'Get it straight buster - I`m not here to say please,
    I`m here to tell you what to do and if self-preservation is an instinct you possess
    you`d better fucking do it and do it quick. I`m here to help - if my help`s not
    appreciated then lotsa luck, gentlemen.']
...
space:insert{'The Wolf!', 'Vincent', 3, 'I don`t mean any disrespect, I just don`t like people barking orders at me.'}
---
- ['The Wolf!', 'Vincent', 3, 'I don`t mean any disrespect, I just don`t like people
    barking orders at me.']
...
space:insert{'Vincent', 'The Wolf!', 2, 'If I`m curt with you it`s because time is a factor. I think fast, I talk fast and I need you guys to act fast if you wanna get out of this. So, pretty please... with sugar on top. Clean the fucking car.'}
---
- ['Vincent', 'The Wolf!', 2, 'If I`m curt with you it`s because time is a factor.
    I think fast, I talk fast and I need you guys to act fast if you wanna get out
    of this. So, pretty please... with sugar on top. Clean the fucking car.']
...
--
-- Select test
--
-- Select by one entry
space.index['primary']:get{'Vincent', 'Jules', 0}
---
- ['Vincent', 'Jules', 0, 'Do you know what they call a - a - a Quarter Pounder with
    cheese in Paris?']
...
space.index['primary']:get{'Jules', 'Vincent', 0}
---
- ['Jules', 'Vincent', 0, 'They don`t call it a Quarter Pounder with cheese?']
...
space.index['primary']:get{'Vincent', 'Jules', 1}
---
- ['Vincent', 'Jules', 1, 'No man, they got the metric system. They wouldn`t know
    what the f--k a Quarter Pounder is.']
...
space.index['primary']:get{'Jules', 'Vincent', 1}
---
- ['Jules', 'Vincent', 1, 'Then what do they call it?']
...
space.index['primary']:get{'Vincent', 'Jules', 2}
---
- ['Vincent', 'Jules', 2, 'They call it a `Royale` with cheese.']
...
space.index['primary']:get{'Jules', 'Vincent', 2}
---
- ['Jules', 'Vincent', 2, 'A `Royale` with cheese!']
...
space.index['primary']:get{'Vincent', 'Jules', 3}
---
- ['Vincent', 'Jules', 3, 'That`s right.']
...
space.index['primary']:get{'Jules', 'Vincent', 3}
---
- ['Jules', 'Vincent', 3, 'What do they call a Big Mac?']
...
space.index['primary']:get{'Vincent', 'Jules', 4}
---
- ['Vincent', 'Jules', 4, 'A Big Mac`s a Big Mac, but they call it `Le Big Mac.`']
...
space.index['primary']:get{'Jules', 'Vincent', 4}
---
- ['Jules', 'Vincent', 4, '`Le Big Mac!`']
...
space.index['primary']:get{'Vincent', 'Jules', 5}
---
- ['Vincent', 'Jules', 5, 'Ha, ha, ha.']
...
space.index['primary']:get{'Jules', 'Vincent', 5}
---
- ['Jules', 'Vincent', 5, 'What do they call a `Whopper`?']
...
space.index['primary']:get{'Vincent', 'Jules', 6}
---
- ['Vincent', 'Jules', 6, 'I dunno, I didn`t go into Burger King.']
...
space.index['primary']:get{'The Wolf!', 'Vincent', 0}
---
- ['The Wolf!', 'Vincent', 0, 'Jimmie, lead the way. Boys, get to work.']
...
space.index['primary']:get{'Vincent', 'The Wolf!', 0}
---
- ['Vincent', 'The Wolf!', 0, 'A please would be nice.']
...
space.index['primary']:get{'The Wolf!', 'Vincent', 1}
---
- ['The Wolf!', 'Vincent', 1, 'Come again?']
...
space.index['primary']:get{'Vincent', 'The Wolf!', 1}
---
- ['Vincent', 'The Wolf!', 1, 'I said a please would be nice.']
...
space.index['primary']:get{'The Wolf!', 'Vincent', 2}
---
- ['The Wolf!', 'Vincent', 2, 'Get it straight buster - I`m not here to say please,
    I`m here to tell you what to do and if self-preservation is an instinct you possess
    you`d better fucking do it and do it quick. I`m here to help - if my help`s not
    appreciated then lotsa luck, gentlemen.']
...
space.index['primary']:get{'The Wolf!', 'Vincent', 3}
---
- ['The Wolf!', 'Vincent', 3, 'I don`t mean any disrespect, I just don`t like people
    barking orders at me.']
...
space.index['primary']:get{'Vincent', 'The Wolf!', 2}
---
- ['Vincent', 'The Wolf!', 2, 'If I`m curt with you it`s because time is a factor.
    I think fast, I talk fast and I need you guys to act fast if you wanna get out
    of this. So, pretty please... with sugar on top. Clean the fucking car.']
...
-- Select all messages from Vincent to Jules
space.index['primary']:select({'Vincent', 'Jules'})
---
- - ['Vincent', 'Jules', 0, 'Do you know what they call a - a - a Quarter Pounder
      with cheese in Paris?']
  - ['Vincent', 'Jules', 1, 'No man, they got the metric system. They wouldn`t know
      what the f--k a Quarter Pounder is.']
  - ['Vincent', 'Jules', 2, 'They call it a `Royale` with cheese.']
  - ['Vincent', 'Jules', 3, 'That`s right.']
  - ['Vincent', 'Jules', 4, 'A Big Mac`s a Big Mac, but they call it `Le Big Mac.`']
  - ['Vincent', 'Jules', 5, 'Ha, ha, ha.']
  - ['Vincent', 'Jules', 6, 'I dunno, I didn`t go into Burger King.']
...
-- Select all messages from Jules to Vincent
space.index['primary']:select({'Jules', 'Vincent'})
---
- - ['Jules', 'Vincent', 0, 'They don`t call it a Quarter Pounder with cheese?']
  - ['Jules', 'Vincent', 1, 'Then what do they call it?']
  - ['Jules', 'Vincent', 2, 'A `Royale` with cheese!']
  - ['Jules', 'Vincent', 3, 'What do they call a Big Mac?']
  - ['Jules', 'Vincent', 4, '`Le Big Mac!`']
  - ['Jules', 'Vincent', 5, 'What do they call a `Whopper`?']
...
-- Select all messages from Vincent to The Wolf
space.index['primary']:select({'Vincent', 'The Wolf!'})
---
- - ['Vincent', 'The Wolf!', 0, 'A please would be nice.']
  - ['Vincent', 'The Wolf!', 1, 'I said a please would be nice.']
  - ['Vincent', 'The Wolf!', 2, 'If I`m curt with you it`s because time is a factor.
      I think fast, I talk fast and I need you guys to act fast if you wanna get out
      of this. So, pretty please... with sugar on top. Clean the fucking car.']
...
-- Select all messages from The Wolf to Vincent
space.index['primary']:select({'The Wolf!', 'Vincent'})
---
- - ['The Wolf!', 'Vincent', 0, 'Jimmie, lead the way. Boys, get to work.']
  - ['The Wolf!', 'Vincent', 1, 'Come again?']
  - ['The Wolf!', 'Vincent', 2, 'Get it straight buster - I`m not here to say please,
      I`m here to tell you what to do and if self-preservation is an instinct you
      possess you`d better fucking do it and do it quick. I`m here to help - if my
      help`s not appreciated then lotsa luck, gentlemen.']
  - ['The Wolf!', 'Vincent', 3, 'I don`t mean any disrespect, I just don`t like people
      barking orders at me.']
...
-- Select all Vincent messages
space.index['primary']:select({'Vincent'})
---
- - ['Vincent', 'Jules', 0, 'Do you know what they call a - a - a Quarter Pounder
      with cheese in Paris?']
  - ['Vincent', 'Jules', 1, 'No man, they got the metric system. They wouldn`t know
      what the f--k a Quarter Pounder is.']
  - ['Vincent', 'Jules', 2, 'They call it a `Royale` with cheese.']
  - ['Vincent', 'Jules', 3, 'That`s right.']
  - ['Vincent', 'Jules', 4, 'A Big Mac`s a Big Mac, but they call it `Le Big Mac.`']
  - ['Vincent', 'Jules', 5, 'Ha, ha, ha.']
  - ['Vincent', 'Jules', 6, 'I dunno, I didn`t go into Burger King.']
  - ['Vincent', 'The Wolf!', 0, 'A please would be nice.']
  - ['Vincent', 'The Wolf!', 1, 'I said a please would be nice.']
  - ['Vincent', 'The Wolf!', 2, 'If I`m curt with you it`s because time is a factor.
      I think fast, I talk fast and I need you guys to act fast if you wanna get out
      of this. So, pretty please... with sugar on top. Clean the fucking car.']
...
--
-- Delete test
--
-- Delete some messages from the The Wolf and Vincent dialog
space:delete{'The Wolf!', 'Vincent', 0}
---
- ['The Wolf!', 'Vincent', 0, 'Jimmie, lead the way. Boys, get to work.']
...
space:delete{'The Wolf!', 'Vincent', 3}
---
- ['The Wolf!', 'Vincent', 3, 'I don`t mean any disrespect, I just don`t like people
    barking orders at me.']
...
space:delete{'Vincent', 'The Wolf!', 0}
---
- ['Vincent', 'The Wolf!', 0, 'A please would be nice.']
...
space:update({'Vincent', 'The Wolf!', 1}, {{ '=', 1, 'Updated' }, {'=', 5, 'New'}})
---
- error: Attempt to modify a tuple field which is part of index 'primary' in space
    'tweedledum'
...
space:update({'Updated', 'The Wolf!', 1}, {{ '=', 1, 'Vincent'}, { '#', 5, 1 }})
---
...
-- Checking Vincent's last messages
space.index['primary']:select({'Vincent', 'The Wolf!'})
---
- - ['Vincent', 'The Wolf!', 1, 'I said a please would be nice.']
  - ['Vincent', 'The Wolf!', 2, 'If I`m curt with you it`s because time is a factor.
      I think fast, I talk fast and I need you guys to act fast if you wanna get out
      of this. So, pretty please... with sugar on top. Clean the fucking car.']
...
-- Checking The Wolf's last messages
space.index['primary']:select({'The Wolf!', 'Vincent'})
---
- - ['The Wolf!', 'Vincent', 1, 'Come again?']
  - ['The Wolf!', 'Vincent', 2, 'Get it straight buster - I`m not here to say please,
      I`m here to tell you what to do and if self-preservation is an instinct you
      possess you`d better fucking do it and do it quick. I`m here to help - if my
      help`s not appreciated then lotsa luck, gentlemen.']
...
-- try to delete nonexistent message
space:delete{'Vincent', 'The Wolf!', 3}
---
...
-- try to delete patrial defined key
space:delete{'Vincent', 'The Wolf!'}
---
- error: Invalid key part count in an exact match (expected 3, got 2)
...
-- try to delete by invalid key
space:delete{'The Wolf!', 'Vincent', 1, 'Come again?'}
---
- error: Invalid key part count in an exact match (expected 3, got 4)
...
--
-- Update test
--
space:update({'The Wolf!', 'Vincent', 1}, {{'=', 4, '<ooops>'}})
---
- ['The Wolf!', 'Vincent', 1, '<ooops>']
...
space:update({'Vincent', 'The Wolf!', 1}, {{'=', 4, '<ooops>'}})
---
- ['Vincent', 'The Wolf!', 1, '<ooops>']
...
-- Checking Vincent's last messages
space.index['primary']:select({'Vincent', 'The Wolf!'})
---
- - ['Vincent', 'The Wolf!', 1, '<ooops>']
  - ['Vincent', 'The Wolf!', 2, 'If I`m curt with you it`s because time is a factor.
      I think fast, I talk fast and I need you guys to act fast if you wanna get out
      of this. So, pretty please... with sugar on top. Clean the fucking car.']
...
-- Checking The Wolf's last messages
space.index['primary']:select({'The Wolf!', 'Vincent'})
---
- - ['The Wolf!', 'Vincent', 1, '<ooops>']
  - ['The Wolf!', 'Vincent', 2, 'Get it straight buster - I`m not here to say please,
      I`m here to tell you what to do and if self-preservation is an instinct you
      possess you`d better fucking do it and do it quick. I`m here to help - if my
      help`s not appreciated then lotsa luck, gentlemen.']
...
-- try to update a nonexistent message
space:update({'Vincent', 'The Wolf!', 4}, {{'=', 4, '<ooops>'}})
---
...
-- try to update patrial defined key
space:update({'Vincent', 'The Wolf!'}, {{'=', 4, '<ooops>'}})
---
- error: Invalid key part count in an exact match (expected 3, got 2)
...
-- try to update by invalid key
space:update({'The Wolf!', 'Vincent', 1, 'Come again?'}, {{'=', 4, '<ooops>'}})
---
- error: Invalid key part count in an exact match (expected 3, got 4)
...
space:len()
---
- 17
...
space:truncate()
---
...
space:len()
---
- 0
...
-- A test case for Bug#1051006 Tree iterators return garbage
--if an index is modified between calls
--
space.index['primary']:drop()
---
...
i1 = space:create_index('primary', { type = 'tree', parts = {1, 'string'}, unique = true })
---
...
i2 = space:create_index('second', { type  = 'tree', parts = {2, 'string', 3, 'string'}, unique = true })
---
...
space:insert{'a', 'a', 'a'}
---
- ['a', 'a', 'a']
...
space:insert{'d', 'd', 'd'}
---
- ['d', 'd', 'd']
...
space:insert{'e', 'e', 'e'}
---
- ['e', 'e', 'e']
...
space:insert{'b', 'b', 'b'}
---
- ['b', 'b', 'b']
...
space:insert{'c', 'c', 'c'}
---
- ['c', 'c', 'c']
...
t = {}
---
...
gen, param, state = space.index['second']:pairs(nil, { iterator = box.index.GE })
---
...
test_run:cmd("setopt delimiter ';'")
---
- true
...
for i = 1, 2 do
    state, v = gen(param, state)
    table.insert(t, v)
end;
---
...
test_run:cmd("setopt delimiter ''");
---
- true
...
t
---
- - ['a', 'a', 'a']
  - ['b', 'b', 'b']
...
space:truncate()
---
...
v
---
- ['b', 'b', 'b']
...
collectgarbage('collect')
---
- 0
...
v
---
- ['b', 'b', 'b']
...
param, v = gen(param, state)
---
...
v
---
- null
...
collectgarbage('collect')
---
- 0
...
v
---
- null
...
t = {}
---
...
test_run:cmd("setopt delimiter ';'")
---
- true
...
for i = 1, 3 do
    param, v = gen(param, state)
    table.insert(t, v)
end;
---
...
test_run:cmd("setopt delimiter ''");
---
- true
...
t
---
- []
...
space:drop()
---
...
space = nil
---
...
-- Bug #1082356
-- Space #19, https://bugs.launchpad.net/tarantool/+bug/1082356
space = box.schema.space.create('tweedledum')
---
...
-- Multipart primary key (sender nickname, receiver nickname, message id)
i1 = space:create_index('primary', { type = 'tree', parts = {1, 'unsigned', 3, 'unsigned'}, unique = true })
---
...
space:insert{1, 1}
---
- error: Tuple field 3 required by space format is missing
...
space:replace{1, 1}
---
- error: Tuple field 3 required by space format is missing
...
space:drop()
---
...
-- test deletion of data one by one
space = box.schema.space.create('test')
---
...
i1 = space:create_index('primary', { type = 'tree', parts = {1, 'string'}, unique = true })
---
...
i2 = space:create_index('second', { type  = 'tree', parts = {2, 'string', 3, 'string'}, unique = true })
---
...
test_run:cmd("setopt delimiter ';'")
---
- true
...
for i = 1, 100 do
    v = tostring(i)
    space:insert{v, string.rep(v, 2) , string.rep(v, 3)}
end;
---
...
local pk = space.index[0]
while pk:len() > 0 do
    local state, t
    for state, t in pk:pairs() do
        local key = {}
        for _k2, parts in ipairs(pk.parts) do
            table.insert(key, t[parts.fieldno])
        end
        space:delete(key)
    end
end;
---
...
test_run:cmd("setopt delimiter ''");
---
- true
...
space:drop()
---
...
space = nil
---
...