-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_log
executable file
·699 lines (675 loc) · 16 KB
/
test_log
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
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
=======================Initialization=========================
The memory contains 10 blocks
******MEMORY DUMP BEGIN******
0:
1:
2:
3:
4:
5:
6:
7:
8:
9:
******MEMORY DUMP END******
=======================Schema=========================
Creating a schema
f1 STR20;
f2 STR20;
f3 INT;
f4 STR20;
The schema has 4 fields
The schema allows 2 tuples per block
The schema has field names:
f1 f2 f3 f4
The schema has field types:
STR20 STR20 INT STR20
The first field is of name f1
The second field is of type STR20
The field f3 is of type INT
The field f4 is at offset 3
Error testing:
getFieldName ERROR: offset -1 out of bound
getFieldName ERROR: offset 4 out of bound
getFieldType ERROR: offset -1 out of bound
getFieldType ERROR: offset 4 out of bound
getFieldOffset ERROR: field name test is not found
getFieldOffset ERROR: field name test is not found
Schema ERROR: repeated field names f4 at offset 3 and 4
Schema ERROR: empty field name at offset 4
Schema ERROR: at most 8 fields are allowed
Schema ERROR: size of field_names and size of field_types do not match
Schema ERROR: empty fields
=====================Relation & SchemaManager=========================
Creating table ExampleTable1
The table has name ExampleTable1
The table has schema:
f1 STR20;
f2 STR20;
f3 INT;
f4 STR20;
The table currently have 0 blocks
The table currently have 0 tuples
Error testing:
createRelation ERROR: ExampleTable1 already exists
createRelation ERROR: empty schema
Current schemas and relations:
ExampleTable1
f1 STR20;
f2 STR20;
f3 INT;
f4 STR20;
From the schema manager, the table ExampleTable1 exists: TRUE
From the schema manager, the table ExampleTable1 has schema:
f1 STR20;
f2 STR20;
f3 INT;
f4 STR20;
From the schema manager, the table ExampleTable1 has schema:
f1 STR20;
f2 STR20;
f3 INT;
f4 STR20;
Creating table ExampleTable2 with the same schema
After creating a realtion, current schemas and relations:
ExampleTable1
f1 STR20;
f2 STR20;
f3 INT;
f4 STR20;
ExampleTable2
f1 STR20;
f2 STR20;
f3 INT;
f4 STR20;
Creating table ExampleTable3 with a different schema
The schema has field names:
f1 f2 f3 f4
The schema has field types:
STR20 INT INT STR20 After creating a realtion, current schemas and relations:
ExampleTable1
f1 STR20;
f2 STR20;
f3 INT;
f4 STR20;
ExampleTable2
f1 STR20;
f2 STR20;
f3 INT;
f4 STR20;
ExampleTable3
f1 STR20;
f2 INT;
f3 INT;
f4 STR20;
Deleting table ExampleTable2
After deleting a realtion, current schemas and relations:
ExampleTable1
f1 STR20;
f2 STR20;
f3 INT;
f4 STR20;
ExampleTable3
f1 STR20;
f2 INT;
f3 INT;
f4 STR20;
Error testing:
The table ExampleTable2 exists: FALSE
createRelation ERROR: empty relation name
getSchema ERROR: relation ExampleTable2 does not exist
getRelation ERROR: relation ExampleTable2 does not exist
deleteRelation ERROR: relation ExampleTable2 does not exist
====================Tuple=============================
Created a tuple v11 21 31 v41 through the relation
The tuple is invalid? FALSE
The tuple has schema
f1 STR20;
f2 INT;
f3 INT;
f4 STR20;
A block can allow at most 2 such tuples
The tuple has fields:
v11 21 31 v41
The tuple has fields:
v11 21 31 v41
Error testing:
setField ERROR: field type not INT!
setField ERROR: offset -1 is out of bound!
setField ERROR: offset 4 is out of bound!
setField ERROR: field type not STR20!
setField ERROR: field name f5 not found
getField ERROR: offset -1 is out of bound!
getField ERROR: offset 4 is out of bound!
===================Block=============================
Clear the memory block 0
Set the tuple at offset 0 of the memory block 0
Now the memory block 0 contains:
v11 21 31 v41
The block is full? false
The block currently has 1 tuples
The tuple at offset 0 of the block is:
v11 21 31 v41
Append the same tuple to the memory block 0
Now the memory block 0 contains:
v11 21 31 v41
v11 21 31 v41
The block is full? true
The block currently has 2 tuples
The tuple at offset 0 of the block is:
v11 21 31 v41
Again the tuples in the memory block 0 are:
v11 21 31 v41
v11 21 31 v41
Erase the first tuple
Now the memory block 0 contains:
(hole)
v11 21 31 v41
Erase all the tuples in the block
Now the memory block 0 contains:
(hole)
(hole)
(Remove all tuples;) Set only the first tuple
Now the memory block 0 contains:
v11 21 31 v41
(Remove all tuples;) Set the same two tuples again
Now the memory block 0 contains:
v11 21 31 v41
v11 21 31 v41
Error testing:
setTuple ERROR: tuples' schemas do not match
setTuple ERROR: tuple offet -1 out of bound
setTuple ERROR: tuple offet 2 out of bound of the block
getTuple ERROR: tuple offet -1 out of bound
getTuple ERROR: tuple offet 2 out of bound of the block
nullTuple ERROR: tuple offet -1 out of bound
nullTuple ERROR: tuple offet 2 out of bound
appendTuple ERROR: the block is full
======How to append tuples to the end of the relation======
Now memory contains:
******MEMORY DUMP BEGIN******
0: v11 21 31 v41
v11 21 31 v41
1:
2:
3:
4:
5:
6:
7:
8:
9:
******MEMORY DUMP END******
The relation is empty
Get the handle to the memory block 5 and clear it
Write to the first block of the relation
Now the memory contains:
******MEMORY DUMP BEGIN******
0: v11 21 31 v41
v11 21 31 v41
1:
2:
3:
4:
5: v11 21 31 v41
6:
7:
8:
9:
******MEMORY DUMP END******
Now the relation contains:
******RELATION DUMP BEGIN******
f1 f2 f3 f4
0: v11 21 31 v41
******RELATION DUMP END******
Create the second tuple
v12 22 32 v42
Read the last block of the relation into memory block 5:
(The block is not full: Append it directly)
Write to the last block of the relation
*NOTE: The example here does not consider empty tuples (if any) in the block.
(The holes left after tuple deletion)
Now the memory contains:
******MEMORY DUMP BEGIN******
0: v11 21 31 v41
v11 21 31 v41
1:
2:
3:
4:
5: v11 21 31 v41
v12 22 32 v42
6:
7:
8:
9:
******MEMORY DUMP END******
Now the relation contains:
******RELATION DUMP BEGIN******
f1 f2 f3 f4
0: v11 21 31 v41
v12 22 32 v42
******RELATION DUMP END******
Create the third tuple
v13 23 33 v43
Read the last block of the relation into memory block 5:
(The block is full: Clear the memory block and append the tuple)
Write to a new block at the end of the relation
*NOTE: The example here does not consider empty tuples (if any) in the block.
(The holes left after tuple deletion)
Now the memory contains:
******MEMORY DUMP BEGIN******
0: v11 21 31 v41
v11 21 31 v41
1:
2:
3:
4:
5: v13 23 33 v43
6:
7:
8:
9:
******MEMORY DUMP END******
Now the relation contains:
******RELATION DUMP BEGIN******
f1 f2 f3 f4
0: v11 21 31 v41
v12 22 32 v42
1: v13 23 33 v43
******RELATION DUMP END******
======How to read and write bulk blocks======
First fill the relations with 10 more tuples
Read the last block of the relation into memory block 5:
(The block is not full: Append it directly)
Write to the last block of the relation
Read the last block of the relation into memory block 5:
(The block is full: Clear the memory block and append the tuple)
Write to a new block at the end of the relation
Read the last block of the relation into memory block 5:
(The block is not full: Append it directly)
Write to the last block of the relation
Read the last block of the relation into memory block 5:
(The block is full: Clear the memory block and append the tuple)
Write to a new block at the end of the relation
Read the last block of the relation into memory block 5:
(The block is not full: Append it directly)
Write to the last block of the relation
Read the last block of the relation into memory block 5:
(The block is full: Clear the memory block and append the tuple)
Write to a new block at the end of the relation
Read the last block of the relation into memory block 5:
(The block is not full: Append it directly)
Write to the last block of the relation
Read the last block of the relation into memory block 5:
(The block is full: Clear the memory block and append the tuple)
Write to a new block at the end of the relation
Read the last block of the relation into memory block 5:
(The block is not full: Append it directly)
Write to the last block of the relation
Read the last block of the relation into memory block 5:
(The block is full: Clear the memory block and append the tuple)
Write to a new block at the end of the relation
Now the relation contains:
******RELATION DUMP BEGIN******
f1 f2 f3 f4
0: v11 21 31 v41
v12 22 32 v42
1: v13 23 33 v43
v13 23 33 v43
2: v13 23 33 v43
v13 23 33 v43
3: v13 23 33 v43
v13 23 33 v43
4: v13 23 33 v43
v13 23 33 v43
5: v13 23 33 v43
v13 23 33 v43
6: v13 23 33 v43
******RELATION DUMP END******
Now the memory contains:
******MEMORY DUMP BEGIN******
0: v11 21 31 v41
v11 21 31 v41
1:
2:
3:
4:
5: v13 23 33 v43
6:
7:
8:
9:
******MEMORY DUMP END******
Read bulk blocks from the relation to memory block 3-9
Now the memory contains:
******MEMORY DUMP BEGIN******
0: v11 21 31 v41
v11 21 31 v41
1:
2:
3: v11 21 31 v41
v12 22 32 v42
4: v13 23 33 v43
v13 23 33 v43
5: v13 23 33 v43
v13 23 33 v43
6: v13 23 33 v43
v13 23 33 v43
7: v13 23 33 v43
v13 23 33 v43
8: v13 23 33 v43
v13 23 33 v43
9: v13 23 33 v43
******MEMORY DUMP END******
Write bulk blocks from the memory block 3-9 to the end of the relation
(May result in 'holes' in the relation)
Now the relation contains:
******RELATION DUMP BEGIN******
f1 f2 f3 f4
0: v11 21 31 v41
v12 22 32 v42
1: v13 23 33 v43
v13 23 33 v43
2: v13 23 33 v43
v13 23 33 v43
3: v13 23 33 v43
v13 23 33 v43
4: v13 23 33 v43
v13 23 33 v43
5: v13 23 33 v43
v13 23 33 v43
6: v13 23 33 v43
(hole)
7: v11 21 31 v41
v12 22 32 v42
8: v13 23 33 v43
v13 23 33 v43
9: v13 23 33 v43
v13 23 33 v43
10: v13 23 33 v43
v13 23 33 v43
11: v13 23 33 v43
v13 23 33 v43
12: v13 23 33 v43
v13 23 33 v43
13: v13 23 33 v43
******RELATION DUMP END******
Deleting the last 7 blocks of the relation
Now the relation contains:
******RELATION DUMP BEGIN******
f1 f2 f3 f4
0: v11 21 31 v41
v12 22 32 v42
1: v13 23 33 v43
v13 23 33 v43
2: v13 23 33 v43
v13 23 33 v43
3: v13 23 33 v43
v13 23 33 v43
4: v13 23 33 v43
v13 23 33 v43
5: v13 23 33 v43
v13 23 33 v43
6: v13 23 33 v43
(hole)
******RELATION DUMP END******
======How to delete tuples from the relation======
Reading the first block of the relation into memory block 1:
Now the memory contains:
******MEMORY DUMP BEGIN******
0: v11 21 31 v41
v11 21 31 v41
1: v11 21 31 v41
v12 22 32 v42
2:
3: v11 21 31 v41
v12 22 32 v42
4: v13 23 33 v43
v13 23 33 v43
5: v13 23 33 v43
v13 23 33 v43
6: v13 23 33 v43
v13 23 33 v43
7: v13 23 33 v43
v13 23 33 v43
8: v13 23 33 v43
v13 23 33 v43
9: v13 23 33 v43
******MEMORY DUMP END******
Deleting the tuple at offset 0 of the memory block 1
Now the memory contains:
******MEMORY DUMP BEGIN******
0: v11 21 31 v41
v11 21 31 v41
1: (hole)
v12 22 32 v42
2:
3: v11 21 31 v41
v12 22 32 v42
4: v13 23 33 v43
v13 23 33 v43
5: v13 23 33 v43
v13 23 33 v43
6: v13 23 33 v43
v13 23 33 v43
7: v13 23 33 v43
v13 23 33 v43
8: v13 23 33 v43
v13 23 33 v43
9: v13 23 33 v43
******MEMORY DUMP END******
Writing memory block 1 back to the first block of the relation
Now the relation contains:
******RELATION DUMP BEGIN******
f1 f2 f3 f4
0: (hole)
v12 22 32 v42
1: v13 23 33 v43
v13 23 33 v43
2: v13 23 33 v43
v13 23 33 v43
3: v13 23 33 v43
v13 23 33 v43
4: v13 23 33 v43
v13 23 33 v43
5: v13 23 33 v43
v13 23 33 v43
6: v13 23 33 v43
(hole)
******RELATION DUMP END******
Reading the last block of the relation into memory block 1:
Now the memory contains:
******MEMORY DUMP BEGIN******
0: v11 21 31 v41
v11 21 31 v41
1: v13 23 33 v43
(hole)
2:
3: v11 21 31 v41
v12 22 32 v42
4: v13 23 33 v43
v13 23 33 v43
5: v13 23 33 v43
v13 23 33 v43
6: v13 23 33 v43
v13 23 33 v43
7: v13 23 33 v43
v13 23 33 v43
8: v13 23 33 v43
v13 23 33 v43
9: v13 23 33 v43
******MEMORY DUMP END******
Emptying the tuples at the memory block 1
Now the memory contains:
******MEMORY DUMP BEGIN******
0: v11 21 31 v41
v11 21 31 v41
1: (hole)
(hole)
2:
3: v11 21 31 v41
v12 22 32 v42
4: v13 23 33 v43
v13 23 33 v43
5: v13 23 33 v43
v13 23 33 v43
6: v13 23 33 v43
v13 23 33 v43
7: v13 23 33 v43
v13 23 33 v43
8: v13 23 33 v43
v13 23 33 v43
9: v13 23 33 v43
******MEMORY DUMP END******
Writing memory block 1 back to the last block of the relation
Now the relation contains:
******RELATION DUMP BEGIN******
f1 f2 f3 f4
0: (hole)
v12 22 32 v42
1: v13 23 33 v43
v13 23 33 v43
2: v13 23 33 v43
v13 23 33 v43
3: v13 23 33 v43
v13 23 33 v43
4: v13 23 33 v43
v13 23 33 v43
5: v13 23 33 v43
v13 23 33 v43
6: (hole)
(hole)
******RELATION DUMP END******
Deleting the last block of the relation to remove trailing space
Now the relation contains:
******RELATION DUMP BEGIN******
f1 f2 f3 f4
0: (hole)
v12 22 32 v42
1: v13 23 33 v43
v13 23 33 v43
2: v13 23 33 v43
v13 23 33 v43
3: v13 23 33 v43
v13 23 33 v43
4: v13 23 33 v43
v13 23 33 v43
5: v13 23 33 v43
v13 23 33 v43
******RELATION DUMP END******
Error testing of Relation:
getBlock ERROR: block index -1 out of disk bound
getBlock ERROR: block index 6 out of disk bound
getBlock ERROR: block index -1 out of bound in memory
getBlock ERROR: block index 10 out of bound in memory
getBlocks ERROR: block index -1 out of disk bound
getBlocks ERROR: block index 6 out of disk bound
getBlocks ERROR: block index -1 out of bound in memory
getBlocks ERROR: block index 10 out of bound in memory
getBlocks ERROR: access to block out of memory bound10
getBlocks ERROR: block index 6 out of disk bound
setBlock ERROR: block index -1 out of bound in relation
setBlock ERROR: block index-1 out of bound in memory
setBlock ERROR: block index10 out of bound in memory
setBlocks ERROR: block index -1 out of bound in relation
setBlocks ERROR: block index -1 out of bound in memory
setBlocks ERROR: block index 10 out of bound in memory
setBlocks ERROR: access to block out of memory bound: 10
shrinkTrack ERROR: block index -1 out of disk bound
shrinkTrack ERROR: block index 6 out of disk bound
setBlock ERROR: The tuple at offest 0 of memory block 0 has a different schema.
setBlocks ERROR: The tuple at offest 0 of memory block 0 has a different schema.
===================Memory=============================
Reading the first block of the relation into memory block 9:
Now the memory contains:
******MEMORY DUMP BEGIN******
0: v11 21 31 v41
v11 21 31 v41
1: (hole)
(hole)
2:
3: v11 21 31 v41
v12 22 32 v42
4: v13 23 33 v43
v13 23 33 v43
5: v13 23 33 v43
v13 23 33 v43
6: v13 23 33 v43
v13 23 33 v43
7: v13 23 33 v43
v13 23 33 v43
8: v13 23 33 v43
v13 23 33 v43
9: (hole)
v12 22 32 v42
******MEMORY DUMP END******
Copy the memory block 9 to memory block 6-8:
(You might not need this function)
Now the memory contains:
******MEMORY DUMP BEGIN******
0: v11 21 31 v41
v11 21 31 v41
1: (hole)
(hole)
2:
3: v11 21 31 v41
v12 22 32 v42
4: v13 23 33 v43
v13 23 33 v43
5: v13 23 33 v43
v13 23 33 v43
6: (hole)
v12 22 32 v42
7: (hole)
v12 22 32 v42
8: (hole)
v12 22 32 v42
9: (hole)
v12 22 32 v42
******MEMORY DUMP END******
Get the tuples in memory block 6-9
(Can apply sorting and heap building to the tuples later):
v12 22 32 v42
v12 22 32 v42
v12 22 32 v42
v12 22 32 v42
Write the 'condensed' tuples to memory block 1-2:
Now the memory contains:
******MEMORY DUMP BEGIN******
0: v11 21 31 v41
v11 21 31 v41
1: v12 22 32 v42
v12 22 32 v42
2: v12 22 32 v42
v12 22 32 v42
3: v11 21 31 v41
v12 22 32 v42
4: v13 23 33 v43
v13 23 33 v43
5: v13 23 33 v43
v13 23 33 v43
6: (hole)
v12 22 32 v42
7: (hole)
v12 22 32 v42
8: (hole)
v12 22 32 v42
9: (hole)
v12 22 32 v42
******MEMORY DUMP END******
Error testing:
getBlock ERROR: block index -1 out of memory bound
getBlock ERROR: block index 10 out of memory bound
setBlock ERROR: block index -1 out of memory bound
setBlock ERROR: block index 10 out of memory bound
getTuples ERROR: block index -1 out of memory bound
getTuples ERROR: block index 10 out of memory bound
getTuples ERROR: num of blocks 0 too few
getTuples ERROR: access to block out of memory bound: 10
setTuples ERROR: block index -1 out of memory bound
setTuples ERROR: block index 10 out of memory bound
getTuples ERROR: schema at memory block 2 has a different schema
Real elapse time = 750 ms
Calculated elapse time = 692.16 ms
Calculated Disk I/Os = 44