~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/trx/trx0i_s.c

  • Committer: Andrew Hutchings
  • Date: 2010-12-15 18:59:55 UTC
  • mto: This revision was merged to the branch mainline in revision 2006.
  • Revision ID: andrew@linuxjedi.co.uk-20101215185955-q12lkja8hdnpjqg7
Make the test look for drizzleadmin failure instead of success as this test is not possible to fix for success on our FreeBSD 8.0 box

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (C) 2007, 2010, Innobase Oy. All Rights Reserved.
 
3
Copyright (c) 2007, 2010, Innobase Oy. All Rights Reserved.
4
4
 
5
5
This program is free software; you can redistribute it and/or modify it under
6
6
the terms of the GNU General Public License as published by the Free Software
41
41
# include <mysql/plugin.h>
42
42
#endif
43
43
 
 
44
#include "mysql_addons.h"
 
45
 
44
46
#include "buf0buf.h"
45
47
#include "dict0dict.h"
46
48
#include "ha0storage.h"
62
64
#include "ut0mem.h"
63
65
#include "ut0ut.h"
64
66
 
65
 
#include <drizzled/session.h>
66
 
 
67
67
/** Initial number of rows in the table cache */
68
68
#define TABLE_CACHE_INITIAL_ROWSNUM     1024
69
69
 
420
420
        return(row);
421
421
}
422
422
 
423
 
#ifdef UNIV_DEBUG
424
 
/*******************************************************************//**
425
 
Validates a row in the locks cache.
426
 
@return TRUE if valid */
427
 
static
428
 
ibool
429
 
i_s_locks_row_validate(
430
 
/*===================*/
431
 
        const i_s_locks_row_t*  row)    /*!< in: row to validate */
432
 
{
433
 
        ut_ad(row->lock_trx_id != 0);
434
 
        ut_ad(row->lock_mode != NULL);
435
 
        ut_ad(row->lock_type != NULL);
436
 
        ut_ad(row->lock_table != NULL);
437
 
        ut_ad(row->lock_table_id != 0);
438
 
 
439
 
        if (row->lock_space == ULINT_UNDEFINED) {
440
 
                /* table lock */
441
 
                ut_ad(!strcmp("TABLE", row->lock_type));
442
 
                ut_ad(row->lock_index == NULL);
443
 
                ut_ad(row->lock_data == NULL);
444
 
                ut_ad(row->lock_page == ULINT_UNDEFINED);
445
 
                ut_ad(row->lock_rec == ULINT_UNDEFINED);
446
 
        } else {
447
 
                /* record lock */
448
 
                ut_ad(!strcmp("RECORD", row->lock_type));
449
 
                ut_ad(row->lock_index != NULL);
450
 
                ut_ad(row->lock_data != NULL);
451
 
                ut_ad(row->lock_page != ULINT_UNDEFINED);
452
 
                ut_ad(row->lock_rec != ULINT_UNDEFINED);
453
 
        }
454
 
 
455
 
        return(TRUE);
456
 
}
457
 
#endif /* UNIV_DEBUG */
458
 
 
459
423
/*******************************************************************//**
460
424
Fills i_s_trx_row_t object.
461
425
If memory can not be allocated then FALSE is returned.
486
450
        row->trx_id = trx->id;
487
451
        row->trx_started = (ib_time_t) trx->start_time;
488
452
        row->trx_state = trx_get_que_state_str(trx);
489
 
        row->requested_lock_row = requested_lock_row;
490
 
        ut_ad(requested_lock_row == NULL
491
 
              || i_s_locks_row_validate(requested_lock_row));
492
453
 
493
454
        if (trx->wait_lock != NULL) {
 
455
 
494
456
                ut_a(requested_lock_row != NULL);
 
457
 
 
458
                row->requested_lock_row = requested_lock_row;
495
459
                row->trx_wait_started = (ib_time_t) trx->wait_started;
496
460
        } else {
 
461
 
497
462
                ut_a(requested_lock_row == NULL);
 
463
 
 
464
                row->requested_lock_row = NULL;
498
465
                row->trx_wait_started = 0;
499
466
        }
500
467
 
509
476
                goto thd_done;
510
477
        }
511
478
 
512
 
        row->trx_mysql_thread_id = trx->session()->getSessionId();
513
 
        stmt= trx->mysql_thd->getQueryStringCopy(stmt_len);
 
479
        row->trx_mysql_thread_id = session_get_thread_id(trx->mysql_thd);
 
480
        stmt = innobase_get_stmt(trx->mysql_thd, &stmt_len);
514
481
 
515
482
        if (stmt != NULL) {
516
483
 
523
490
                memcpy(query, stmt, stmt_len);
524
491
                query[stmt_len] = '\0';
525
492
 
526
 
                row->trx_query = static_cast<const char *>(ha_storage_put_memlim(
 
493
                row->trx_query = ha_storage_put_memlim(
527
494
                        cache->storage, stmt, stmt_len + 1,
528
 
                        MAX_ALLOWED_FOR_STORAGE(cache)));
 
495
                        MAX_ALLOWED_FOR_STORAGE(cache));
529
496
 
530
497
                if (row->trx_query == NULL) {
531
498
 
850
817
        row->lock_table_id = lock_get_table_id(lock);
851
818
 
852
819
        row->hash_chain.value = row;
853
 
        ut_ad(i_s_locks_row_validate(row));
854
820
 
855
821
        return(TRUE);
856
822
}
871
837
                                                relevant blocking lock
872
838
                                                row in innodb_locks */
873
839
{
874
 
        ut_ad(i_s_locks_row_validate(requested_lock_row));
875
 
        ut_ad(i_s_locks_row_validate(blocking_lock_row));
876
 
 
877
840
        row->requested_lock_row = requested_lock_row;
878
841
        row->blocking_lock_row = blocking_lock_row;
879
842
 
945
908
                                        or ULINT_UNDEFINED if the lock
946
909
                                        is a table lock */
947
910
{
948
 
        ut_ad(i_s_locks_row_validate(row));
949
911
#ifdef TEST_NO_LOCKS_ROW_IS_EVER_EQUAL_TO_LOCK_T
950
912
        return(0);
951
913
#else
1003
965
                /* auxiliary variable */
1004
966
                hash_chain,
1005
967
                /* assertion on every traversed item */
1006
 
                ut_ad(i_s_locks_row_validate(hash_chain->value)),
 
968
                ,
1007
969
                /* this determines if we have found the lock */
1008
970
                locks_row_eq_lock(hash_chain->value, lock, heap_no));
1009
971
 
1043
1005
        dst_row = search_innodb_locks(cache, lock, heap_no);
1044
1006
        if (dst_row != NULL) {
1045
1007
 
1046
 
                ut_ad(i_s_locks_row_validate(dst_row));
1047
1008
                return(dst_row);
1048
1009
        }
1049
1010
#endif
1081
1042
        } /* for()-loop */
1082
1043
#endif
1083
1044
 
1084
 
        ut_ad(i_s_locks_row_validate(dst_row));
1085
1045
        return(dst_row);
1086
1046
}
1087
1047