~mysql/mysql-server/mysql-6.0

« back to all changes in this revision

Viewing changes to innobase/btr/ts/tsbtrins.c

  • Committer: monty at mysql
  • Date: 2001-02-17 12:19:19 UTC
  • mto: (554.1.1)
  • mto: This revision was merged to the branch mainline in revision 556.
  • Revision ID: sp1r-monty@donna.mysql.com-20010217121919-07904
Added Innobase to source distribution

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/************************************************************************
 
2
Test for the B-tree
 
3
 
 
4
(c) 1994-1997 Innobase Oy
 
5
 
 
6
Created 2/16/1996 Heikki Tuuri
 
7
*************************************************************************/
 
8
 
 
9
#include "os0proc.h"
 
10
#include "sync0sync.h"
 
11
#include "ut0mem.h"
 
12
#include "mem0mem.h"
 
13
#include "mem0pool.h"
 
14
#include "data0data.h"
 
15
#include "data0type.h"
 
16
#include "dict0dict.h"
 
17
#include "buf0buf.h"
 
18
#include "os0file.h"
 
19
#include "os0thread.h"
 
20
#include "fil0fil.h"
 
21
#include "fsp0fsp.h"
 
22
#include "rem0rec.h"
 
23
#include "rem0cmp.h"
 
24
#include "mtr0mtr.h"
 
25
#include "log0log.h"
 
26
#include "page0page.h"
 
27
#include "page0cur.h"
 
28
#include "trx0trx.h"
 
29
#include "dict0boot.h"
 
30
#include "trx0sys.h"
 
31
#include "dict0crea.h"
 
32
#include "btr0btr.h"
 
33
#include "btr0pcur.h"
 
34
#include "btr0cur.h"
 
35
#include "btr0sea.h"
 
36
#include "rem0rec.h"
 
37
#include "srv0srv.h"
 
38
#include "que0que.h"
 
39
#include "com0com.h"
 
40
#include "usr0sess.h"
 
41
#include "lock0lock.h"
 
42
#include "trx0roll.h"
 
43
#include "trx0purge.h"
 
44
#include "row0ins.h"
 
45
#include "row0upd.h"
 
46
#include "row0row.h"
 
47
#include "row0del.h"
 
48
#include "lock0lock.h"
 
49
#include "ibuf0ibuf.h"
 
50
 
 
51
os_file_t       files[1000];
 
52
 
 
53
mutex_t         ios_mutex;
 
54
ulint           ios;
 
55
ulint           n[10];
 
56
 
 
57
mutex_t         incs_mutex;
 
58
ulint           incs;
 
59
 
 
60
#define N_SPACES        2       /* must be >= 2 */
 
61
#define N_FILES         1
 
62
#define FILE_SIZE       8096    /* must be > 512 */
 
63
#define POOL_SIZE       1024
 
64
#define IBUF_SIZE       200
 
65
#define COUNTER_OFFSET  1500
 
66
 
 
67
#define LOOP_SIZE       150
 
68
#define N_THREADS       5
 
69
 
 
70
#define COUNT           1
 
71
 
 
72
ulint zero = 0;
 
73
 
 
74
buf_block_t*    bl_arr[POOL_SIZE];
 
75
 
 
76
ulint   dummy = 0;
 
77
 
 
78
byte    test_buf[8000];
 
79
 
 
80
/************************************************************************
 
81
Io-handler thread function. */
 
82
 
 
83
ulint
 
84
handler_thread(
 
85
/*===========*/
 
86
        void*   arg)
 
87
{
 
88
        ulint   segment;
 
89
        void*   mess;
 
90
        ulint   i;
 
91
        bool    ret;
 
92
        
 
93
        segment = *((ulint*)arg);
 
94
 
 
95
        printf("Io handler thread %lu starts\n", segment);
 
96
 
 
97
        for (i = 0;; i++) {
 
98
                ret = fil_aio_wait(segment, &mess);
 
99
                ut_a(ret);
 
100
 
 
101
                buf_page_io_complete((buf_block_t*)mess);
 
102
                
 
103
                mutex_enter(&ios_mutex);
 
104
                ios++;
 
105
                mutex_exit(&ios_mutex);
 
106
                
 
107
        }
 
108
 
 
109
        return(0);
 
110
}
 
111
 
 
112
/*************************************************************************
 
113
Creates the files for the file system test and inserts them to the file
 
114
system. */
 
115
 
 
116
void
 
117
create_files(void)
 
118
/*==============*/
 
119
{
 
120
        bool            ret;
 
121
        ulint           i, k;
 
122
        char            name[20];
 
123
        os_thread_t     thr[10];
 
124
        os_thread_id_t  id[10];
 
125
 
 
126
        printf("--------------------------------------------------------\n");
 
127
        printf("Create or open database files\n");
 
128
 
 
129
        strcpy(name, "tsfile00");
 
130
 
 
131
        for (k = 0; k < N_SPACES; k++) {
 
132
        for (i = 0; i < N_FILES; i++) {
 
133
 
 
134
                name[6] = (char)((ulint)'0' + k);
 
135
                name[7] = (char)((ulint)'0' + i);
 
136
        
 
137
                files[i] = os_file_create(name, OS_FILE_CREATE,
 
138
                                                OS_FILE_TABLESPACE, &ret);
 
139
                if (ret == FALSE) {
 
140
                        ut_a(os_file_get_last_error() ==
 
141
                                                OS_FILE_ALREADY_EXISTS);
 
142
        
 
143
                        files[i] = os_file_create(
 
144
                                name, OS_FILE_OPEN,
 
145
                                                OS_FILE_TABLESPACE, &ret);
 
146
                        ut_a(ret);
 
147
                } else {
 
148
                        if (k == 1) {
 
149
                                ut_a(os_file_set_size(files[i],
 
150
                                                8192 * IBUF_SIZE, 0));
 
151
                        } else {
 
152
                                ut_a(os_file_set_size(files[i],
 
153
                                                8192 * FILE_SIZE, 0));
 
154
                        }
 
155
                }
 
156
 
 
157
                ret = os_file_close(files[i]);
 
158
                ut_a(ret);
 
159
 
 
160
                if (i == 0) {
 
161
                        fil_space_create(name, k, OS_FILE_TABLESPACE);
 
162
                }
 
163
 
 
164
                ut_a(fil_validate());
 
165
 
 
166
                fil_node_create(name, FILE_SIZE, k);
 
167
        }
 
168
        }
 
169
 
 
170
        ios = 0;
 
171
 
 
172
        mutex_create(&ios_mutex);
 
173
        mutex_set_level(&ios_mutex, SYNC_NO_ORDER_CHECK);
 
174
        
 
175
        for (i = 0; i < 9; i++) {
 
176
                n[i] = i;
 
177
 
 
178
                thr[i] = os_thread_create(handler_thread, n + i, id + i);
 
179
        }
 
180
}
 
181
 
 
182
/************************************************************************
 
183
Inits space headers of spaces 0 and 1. */
 
184
 
 
185
void
 
186
init_spaces(void)
 
187
/*=============*/
 
188
{
 
189
        mtr_t   mtr;
 
190
 
 
191
        mtr_start(&mtr);
 
192
 
 
193
        fsp_header_init(0, FILE_SIZE * N_FILES, &mtr);          
 
194
        fsp_header_init(1, IBUF_SIZE, &mtr);            
 
195
 
 
196
        mtr_commit(&mtr);
 
197
}
 
198
 
 
199
/*********************************************************************
 
200
Test for table creation. */
 
201
 
 
202
ulint
 
203
test1(
 
204
/*==*/
 
205
        void*   arg)
 
206
{
 
207
        sess_t*         sess;
 
208
        com_endpoint_t* com_endpoint;
 
209
        mem_heap_t*     heap;
 
210
        dict_index_t*   index;  
 
211
        dict_table_t*   table;
 
212
        que_fork_t*     fork;
 
213
        que_thr_t*      thr;
 
214
        trx_t*          trx;
 
215
 
 
216
        UT_NOT_USED(arg);
 
217
 
 
218
        printf("-------------------------------------------------\n");
 
219
        printf("TEST 1. CREATE TABLE WITH 3 COLUMNS AND WITH 3 INDEXES\n");
 
220
 
 
221
        heap = mem_heap_create(512);
 
222
 
 
223
        com_endpoint = (com_endpoint_t*)heap;   /* This is a dummy non-NULL
 
224
                                                value */
 
225
        mutex_enter(&kernel_mutex);     
 
226
 
 
227
        sess = sess_open(ut_dulint_zero, com_endpoint, (byte*)"user1", 6);
 
228
        
 
229
        trx = sess->trx;
 
230
 
 
231
        mutex_exit(&kernel_mutex);
 
232
 
 
233
        ut_a(trx_start(trx, ULINT_UNDEFINED));  
 
234
 
 
235
        table = dict_mem_table_create("TS_TABLE1", 0, 3);
 
236
 
 
237
        dict_mem_table_add_col(table, "COL1", DATA_VARCHAR,
 
238
                                                DATA_ENGLISH, 10, 0);
 
239
        dict_mem_table_add_col(table, "COL2", DATA_VARCHAR,
 
240
                                                DATA_ENGLISH, 10, 0);
 
241
        dict_mem_table_add_col(table, "COL3", DATA_VARCHAR,
 
242
                                                DATA_ENGLISH, 100, 0);
 
243
        /*------------------------------------*/
 
244
        /* CREATE TABLE */
 
245
 
 
246
        fork = que_fork_create(NULL, NULL, QUE_FORK_EXECUTE, heap);
 
247
        fork->trx = trx;
 
248
 
 
249
        thr = que_thr_create(fork, fork, heap);
 
250
 
 
251
        thr->child = tab_create_graph_create(fork, thr, table, heap);
 
252
 
 
253
        mutex_enter(&kernel_mutex);     
 
254
 
 
255
        que_graph_publish(fork, trx->sess);
 
256
 
 
257
        trx->graph = fork;
 
258
 
 
259
        ut_a(thr == que_fork_start_command(fork, SESS_COMM_EXECUTE, 0));
 
260
        
 
261
        mutex_exit(&kernel_mutex);
 
262
 
 
263
        que_run_threads(thr);
 
264
 
 
265
/*      dict_table_print_by_name("SYS_TABLES");
 
266
        dict_table_print_by_name("SYS_COLUMNS"); */
 
267
        /*-------------------------------------*/
 
268
        /* CREATE CLUSTERED INDEX */
 
269
        
 
270
        index = dict_mem_index_create("TS_TABLE1", "IND1", 0,
 
271
                                        DICT_UNIQUE | DICT_CLUSTERED, 1);
 
272
        dict_mem_index_add_field(index, "COL1", 0);
 
273
 
 
274
        ut_a(mem_heap_validate(index->heap));
 
275
 
 
276
        fork = que_fork_create(NULL, NULL, QUE_FORK_EXECUTE, heap);
 
277
        fork->trx = trx;
 
278
 
 
279
        thr = que_thr_create(fork, fork, heap);
 
280
 
 
281
        thr->child = ind_create_graph_create(fork, thr, index, heap);
 
282
 
 
283
        mutex_enter(&kernel_mutex);     
 
284
 
 
285
        que_graph_publish(fork, trx->sess);
 
286
 
 
287
        trx->graph = fork;
 
288
 
 
289
        ut_a(thr == que_fork_start_command(fork, SESS_COMM_EXECUTE, 0));
 
290
        
 
291
        mutex_exit(&kernel_mutex);
 
292
 
 
293
        que_run_threads(thr);
 
294
 
 
295
/*      dict_table_print_by_name("SYS_INDEXES");
 
296
        dict_table_print_by_name("SYS_FIELDS"); */
 
297
 
 
298
        /*-------------------------------------*/
 
299
        /* CREATE SECONDARY INDEX */
 
300
        
 
301
        index = dict_mem_index_create("TS_TABLE1", "IND2", 0, 0, 1);
 
302
 
 
303
        dict_mem_index_add_field(index, "COL2", 0);
 
304
 
 
305
        ut_a(mem_heap_validate(index->heap));
 
306
 
 
307
        fork = que_fork_create(NULL, NULL, QUE_FORK_EXECUTE, heap);
 
308
        fork->trx = trx;
 
309
 
 
310
        thr = que_thr_create(fork, fork, heap);
 
311
 
 
312
        thr->child = ind_create_graph_create(fork, thr, index, heap);
 
313
 
 
314
        mutex_enter(&kernel_mutex);     
 
315
 
 
316
        que_graph_publish(fork, trx->sess);
 
317
 
 
318
        trx->graph = fork;
 
319
 
 
320
        ut_a(thr == que_fork_start_command(fork, SESS_COMM_EXECUTE, 0));
 
321
        
 
322
        mutex_exit(&kernel_mutex);
 
323
 
 
324
        que_run_threads(thr);
 
325
 
 
326
/*      dict_table_print_by_name("SYS_INDEXES");
 
327
        dict_table_print_by_name("SYS_FIELDS"); */
 
328
 
 
329
        /*-------------------------------------*/
 
330
        /* CREATE ANOTHER SECONDARY INDEX */
 
331
        
 
332
        index = dict_mem_index_create("TS_TABLE1", "IND3", 0, 0, 1);
 
333
 
 
334
        dict_mem_index_add_field(index, "COL2", 0);
 
335
 
 
336
        ut_a(mem_heap_validate(index->heap));
 
337
 
 
338
        fork = que_fork_create(NULL, NULL, QUE_FORK_EXECUTE, heap);
 
339
        fork->trx = trx;
 
340
 
 
341
        thr = que_thr_create(fork, fork, heap);
 
342
 
 
343
        thr->child = ind_create_graph_create(fork, thr, index, heap);
 
344
 
 
345
        mutex_enter(&kernel_mutex);     
 
346
 
 
347
        que_graph_publish(fork, trx->sess);
 
348
 
 
349
        trx->graph = fork;
 
350
 
 
351
        ut_a(thr == que_fork_start_command(fork, SESS_COMM_EXECUTE, 0));
 
352
        
 
353
        mutex_exit(&kernel_mutex);
 
354
 
 
355
        que_run_threads(thr);
 
356
 
 
357
#ifdef notdefined
 
358
        /*-------------------------------------*/
 
359
        /* CREATE YET ANOTHER SECONDARY INDEX */
 
360
        
 
361
        index = dict_mem_index_create("TS_TABLE1", "IND4", 0, 0, 1);
 
362
 
 
363
        dict_mem_index_add_field(index, "COL2", 0);
 
364
 
 
365
        ut_a(mem_heap_validate(index->heap));
 
366
 
 
367
        fork = que_fork_create(NULL, NULL, QUE_FORK_EXECUTE, heap);
 
368
        fork->trx = trx;
 
369
 
 
370
        thr = que_thr_create(fork, fork, heap);
 
371
 
 
372
        thr->child = ind_create_graph_create(fork, thr, index, heap);
 
373
 
 
374
        mutex_enter(&kernel_mutex);     
 
375
 
 
376
        que_graph_publish(fork, trx->sess);
 
377
 
 
378
        trx->graph = fork;
 
379
 
 
380
        ut_a(thr == que_fork_start_command(fork, SESS_COMM_EXECUTE, 0));
 
381
        
 
382
        mutex_exit(&kernel_mutex);
 
383
 
 
384
        que_run_threads(thr);
 
385
#endif
 
386
/*      dict_table_print_by_name("SYS_INDEXES");
 
387
        dict_table_print_by_name("SYS_FIELDS"); */
 
388
 
 
389
        return(0);
 
390
}
 
391
 
 
392
/*********************************************************************
 
393
Another test for inserts. */
 
394
 
 
395
ulint
 
396
test2_1(
 
397
/*====*/
 
398
        void*   arg)
 
399
{
 
400
        ulint           tm, oldtm;
 
401
        sess_t*         sess;
 
402
        com_endpoint_t* com_endpoint;
 
403
        mem_heap_t*     heap;
 
404
        que_fork_t*     fork;
 
405
        dict_table_t*   table;
 
406
        que_thr_t*      thr;
 
407
        trx_t*          trx;
 
408
        ulint           i;
 
409
        byte            buf[100];
 
410
        ins_node_t*     node;
 
411
        ulint           count = 0;
 
412
        ulint           rnd;
 
413
        dtuple_t*       row;
 
414
        dict_index_t*   index;
 
415
/*      dict_tree_t*    tree;
 
416
        dtuple_t*       entry;
 
417
        btr_pcur_t      pcur;
 
418
        mtr_t           mtr; */
 
419
        
 
420
        printf("-------------------------------------------------\n");
 
421
        printf("TEST 2.1. MASSIVE ASCENDING INSERT\n");
 
422
 
 
423
        heap = mem_heap_create(512);
 
424
 
 
425
        com_endpoint = (com_endpoint_t*)heap;   /* This is a dummy non-NULL
 
426
                                                value */
 
427
        mutex_enter(&kernel_mutex);     
 
428
 
 
429
        sess = sess_open(ut_dulint_zero, com_endpoint, (byte*)"user1", 6);
 
430
        
 
431
        trx = sess->trx;
 
432
 
 
433
        mutex_exit(&kernel_mutex);
 
434
loop:
 
435
        ut_a(trx_start(trx, ULINT_UNDEFINED));  
 
436
 
 
437
        /*-------------------------------------*/
 
438
        /* MASSIVE INSERT */
 
439
        fork = que_fork_create(NULL, NULL, QUE_FORK_INSERT, heap);
 
440
        fork->trx = trx;
 
441
 
 
442
        thr = que_thr_create(fork, fork, heap);
 
443
 
 
444
        table = dict_table_get("TS_TABLE1", trx);
 
445
 
 
446
        row = dtuple_create(heap, 3 + DATA_N_SYS_COLS);
 
447
 
 
448
        dict_table_copy_types(row, table);
 
449
 
 
450
        node = ins_node_create(fork, thr, row, table, heap);
 
451
        
 
452
        thr->child = node;
 
453
 
 
454
        row_ins_init_sys_fields_at_sql_compile(node->row, node->table, heap);
 
455
        row_ins_init_sys_fields_at_sql_prepare(node->row, node->table, trx);
 
456
 
 
457
        node->init_all_sys_fields = FALSE;
 
458
 
 
459
        mutex_enter(&kernel_mutex);     
 
460
 
 
461
        que_graph_publish(fork, trx->sess);
 
462
 
 
463
        trx->graph = fork;
 
464
 
 
465
        mutex_exit(&kernel_mutex);
 
466
 
 
467
        rnd = 0;
 
468
 
 
469
        log_print();
 
470
        
 
471
        oldtm = ut_clock();
 
472
 
 
473
        for (i = 0; i < *((ulint*)arg); i++) {
 
474
 
 
475
                dtuple_gen_test_tuple3(row, rnd, DTUPLE_TEST_FIXED30, buf);
 
476
 
 
477
                mutex_enter(&kernel_mutex);     
 
478
 
 
479
                ut_a(
 
480
                thr == que_fork_start_command(fork, SESS_COMM_EXECUTE, 0));
 
481
 
 
482
                mutex_exit(&kernel_mutex);
 
483
 
 
484
                que_run_threads(thr);
 
485
 
 
486
                if (i % 5000 == 0) {
 
487
                        /* ibuf_print(); */
 
488
                        /* buf_print(); */
 
489
 
 
490
                        /* buf_print_io(); */
 
491
                        /*
 
492
                        tm = ut_clock();
 
493
                        printf("Wall time for %lu inserts %lu milliseconds\n",
 
494
                                                        i, tm - oldtm); */
 
495
                }
 
496
 
 
497
                rnd = rnd + 1;
 
498
        }
 
499
 
 
500
        tm = ut_clock();
 
501
        printf("Wall time for %lu inserts %lu milliseconds\n", i, tm - oldtm);
 
502
 
 
503
        log_print();
 
504
 
 
505
/*      dict_table_print_by_name("TS_TABLE1"); */
 
506
 
 
507
/*      ibuf_print(); */
 
508
 
 
509
        index = index;
 
510
 
 
511
        index = dict_table_get_first_index(table);
 
512
 
 
513
        if (zero) {
 
514
                btr_search_index_print_info(index);
 
515
        }
 
516
 
 
517
        btr_validate_tree(dict_index_get_tree(index));
 
518
        
 
519
#ifdef notdefined
 
520
        index = dict_table_get_next_index(index);
 
521
 
 
522
        if (zero) {
 
523
                btr_search_index_print_info(index);
 
524
        }
 
525
 
 
526
        btr_validate_tree(dict_index_get_tree(index));
 
527
 
 
528
        index = dict_table_get_next_index(index);
 
529
 
 
530
/*      btr_search_index_print_info(index); */
 
531
 
 
532
        btr_validate_tree(dict_index_get_tree(index));
 
533
 
 
534
/*      dict_table_print_by_name("TS_TABLE1"); */
 
535
 
 
536
        /* Check inserted entries */
 
537
 
 
538
        btr_search_print_info();
 
539
 
 
540
        entry = dtuple_create(heap, 1);
 
541
        dtuple_gen_search_tuple3(entry, 0, buf);
 
542
 
 
543
        mtr_start(&mtr);
 
544
        
 
545
        index = dict_table_get_first_index(table);
 
546
        tree = dict_index_get_tree(index);
 
547
 
 
548
        btr_pcur_open(index, entry, PAGE_CUR_L, BTR_SEARCH_LEAF, &pcur, &mtr);
 
549
        ut_a(btr_pcur_is_before_first_in_tree(&pcur, &mtr));
 
550
 
 
551
        for (i = 0; i < *((ulint*)arg); i++) {
 
552
                ut_a(btr_pcur_move_to_next(&pcur, &mtr));
 
553
 
 
554
                dtuple_gen_search_tuple3(entry, i, buf);
 
555
 
 
556
                ut_a(0 == cmp_dtuple_rec(entry, btr_pcur_get_rec(&pcur)));
 
557
        }       
 
558
 
 
559
        ut_a(!btr_pcur_move_to_next(&pcur, &mtr));
 
560
        ut_a(btr_pcur_is_after_last_in_tree(&pcur, &mtr));
 
561
 
 
562
        btr_pcur_close(&pcur);
 
563
        mtr_commit(&mtr);
 
564
        
 
565
        printf("Validating tree\n");
 
566
        btr_validate_tree(tree);
 
567
        printf("Validated\n");
 
568
#endif
 
569
        /*-------------------------------------*/
 
570
        /* ROLLBACK */
 
571
        
 
572
#ifdef notdefined
 
573
/*      btr_validate_tree(tree); */
 
574
 
 
575
        fork = que_fork_create(NULL, NULL, QUE_FORK_EXECUTE, heap);
 
576
        fork->trx = trx;
 
577
 
 
578
        thr = que_thr_create(fork, fork, heap);
 
579
 
 
580
        thr->child = roll_node_create(fork, thr, heap);
 
581
 
 
582
        mutex_enter(&kernel_mutex);     
 
583
 
 
584
        que_graph_publish(fork, trx->sess);
 
585
 
 
586
        trx->graph = fork;
 
587
 
 
588
        ut_a(thr == que_fork_start_command(fork, SESS_COMM_EXECUTE, 0));
 
589
        
 
590
        mutex_exit(&kernel_mutex);
 
591
 
 
592
        oldtm = ut_clock();
 
593
 
 
594
        que_run_threads(thr);
 
595
 
 
596
        tm = ut_clock();
 
597
        printf("Wall time for rollback of %lu inserts %lu milliseconds\n",
 
598
                i, tm - oldtm);
 
599
 
 
600
        os_thread_sleep(1000000);
 
601
 
 
602
/*      dict_table_print_by_name("TS_TABLE1"); */
 
603
 
 
604
        dtuple_gen_search_tuple3(entry, 0, buf);
 
605
 
 
606
        mtr_start(&mtr);
 
607
        
 
608
        btr_pcur_open(index, entry, PAGE_CUR_L, BTR_SEARCH_LEAF, &pcur, &mtr);
 
609
        ut_a(btr_pcur_is_before_first_in_tree(&pcur, &mtr));
 
610
 
 
611
        ut_a(!btr_pcur_move_to_next(&pcur, &mtr));
 
612
        
 
613
        ut_a(btr_pcur_is_after_last_in_tree(&pcur, &mtr));
 
614
 
 
615
        btr_pcur_close(&pcur);
 
616
        mtr_commit(&mtr);
 
617
 
 
618
        btr_search_print_info();
 
619
#endif
 
620
        /*-------------------------------------*/
 
621
        /* COMMIT */
 
622
        fork = que_fork_create(NULL, NULL, QUE_FORK_EXECUTE, heap);
 
623
        fork->trx = trx;
 
624
 
 
625
        thr = que_thr_create(fork, fork, heap);
 
626
 
 
627
        thr->child = commit_node_create(fork, thr, heap);
 
628
 
 
629
        mutex_enter(&kernel_mutex);     
 
630
 
 
631
        que_graph_publish(fork, trx->sess);
 
632
 
 
633
        trx->graph = fork;
 
634
 
 
635
        ut_a(thr == que_fork_start_command(fork, SESS_COMM_EXECUTE, 0));
 
636
        
 
637
        mutex_exit(&kernel_mutex);
 
638
 
 
639
        oldtm = ut_clock();
 
640
        
 
641
        que_run_threads(thr);
 
642
 
 
643
        tm = ut_clock();
 
644
        printf("Wall time for commit %lu milliseconds\n", tm - oldtm);
 
645
        /*-------------------------------------*/
 
646
 
 
647
        count++;
 
648
/*      btr_validate_tree(tree); */
 
649
 
 
650
        if (count < 1) {
 
651
                goto loop;
 
652
        }
 
653
 
 
654
        mem_heap_free(heap);
 
655
 
 
656
        return(0);
 
657
}
 
658
 
 
659
/********************************************************************
 
660
Main test function. */
 
661
 
 
662
void 
 
663
main(void) 
 
664
/*======*/
 
665
{
 
666
        ulint   tm, oldtm;
 
667
        os_thread_id_t  id[10];
 
668
        ulint   n1000[10];
 
669
        ulint   i;
 
670
        ulint   n5000   = 500;
 
671
        ulint   n2;
 
672
 
 
673
/*      buf_debug_prints = TRUE; */
 
674
        log_do_write = TRUE;
 
675
        
 
676
        srv_boot("initfile");
 
677
        os_aio_init(576, 9, 100);
 
678
        fil_init(25);
 
679
        buf_pool_init(POOL_SIZE, POOL_SIZE);
 
680
        fsp_init();
 
681
        log_init();
 
682
        lock_sys_create(1024);
 
683
 
 
684
        create_files();
 
685
 
 
686
        init_spaces();
 
687
 
 
688
        sess_sys_init_at_db_start();
 
689
        
 
690
        trx_sys_create();
 
691
        
 
692
        dict_create();
 
693
 
 
694
/*      os_thread_sleep(500000); */
 
695
 
 
696
        oldtm = ut_clock();
 
697
        
 
698
        ut_rnd_set_seed(19);
 
699
 
 
700
        test1(NULL);
 
701
        
 
702
/*      for (i = 0; i < 2; i++) {
 
703
 
 
704
                n1000[i] = i;
 
705
                id[i] = id[i];
 
706
 
 
707
                os_thread_create(test10mt, n1000 + i, id + i);
 
708
        }
 
709
*/
 
710
        i = 4;
 
711
        
 
712
        n1000[i] = i;
 
713
        id[i] = id[i];
 
714
 
 
715
/*      os_thread_create(test10_4, n1000 + i, id + i); */
 
716
 
 
717
        i = 5;
 
718
        
 
719
/*      test10mt(&i);
 
720
 
 
721
        i = 6;
 
722
 
 
723
        test10mt(&i);
 
724
 
 
725
        trx_purge();
 
726
        printf("%lu pages purged\n", purge_sys->n_pages_handled);
 
727
        
 
728
        dict_table_print_by_name("TS_TABLE1"); */
 
729
 
 
730
/*      os_thread_create(test_measure_cont, &n3, id + 0); */
 
731
 
 
732
/*      mem_print_info(); */
 
733
        
 
734
/*      dict_table_print_by_name("TS_TABLE1"); */
 
735
 
 
736
        log_flush_up_to(ut_dulint_zero);
 
737
 
 
738
        os_thread_sleep(500000);
 
739
 
 
740
        n2 = 10000;
 
741
 
 
742
        test2_1(&n2);
 
743
 
 
744
/*      test9A(&n2);
 
745
        test9(&n2); */
 
746
        
 
747
/*      test6(&n2); */
 
748
 
 
749
/*      test2(&n2); */
 
750
 
 
751
/*      test2_2(&n2); */
 
752
 
 
753
/*      mem_print_info(); */
 
754
 
 
755
        for (i = 0; i < 2; i++) {
 
756
 
 
757
                n1000[i] = 1000 + 10 * i;
 
758
                id[i] = id[i];
 
759
 
 
760
/*              os_thread_create(test2mt, n1000 + i, id + i);
 
761
                os_thread_create(test2_1mt, n1000 + i, id + i);
 
762
                os_thread_create(test2_2mt, n1000 + i, id + i); */
 
763
        }
 
764
 
 
765
        n2 = 2000;
 
766
 
 
767
/*      test2mt(&n2); */
 
768
 
 
769
/*      buf_print();
 
770
        ibuf_print();
 
771
        rw_lock_list_print_info();
 
772
        mutex_list_print_info();
 
773
        
 
774
        dict_table_print_by_name("TS_TABLE1"); */
 
775
 
 
776
/*      mem_print_info(); */
 
777
        
 
778
        n2 = 1000;
 
779
 
 
780
/*      test4_1();
 
781
        test4_2();
 
782
 
 
783
        for (i = 0; i < 2; i++) {
 
784
                n1000[i] = i;
 
785
                id[i] = id[i];
 
786
                os_thread_create(test4mt, n1000 + i, id + i);
 
787
        }
 
788
 
 
789
        n2 = 4;
 
790
        test4mt(&n2);
 
791
        test4mt(&n2);
 
792
        test4_2();
 
793
        lock_print_info(); */
 
794
 
 
795
/*      test7(&n2); */
 
796
 
 
797
/*      os_thread_sleep(25000000); */
 
798
 
 
799
        tm = ut_clock();
 
800
        printf("Wall time for test %lu milliseconds\n", tm - oldtm);
 
801
        printf("TESTS COMPLETED SUCCESSFULLY!\n");
 
802