~mdcallag/+junk/5.1-map

« back to all changes in this revision

Viewing changes to storage/innobase/trx/trx0trx.c

  • Committer: msvensson at pilot
  • Date: 2007-04-24 09:11:45 UTC
  • mfrom: (2469.1.106)
  • Revision ID: sp1r-msvensson@pilot.blaudden-20070424091145-10463
Merge pilot.blaudden:/home/msvensson/mysql/my51-m-mysql_upgrade
into  pilot.blaudden:/home/msvensson/mysql/mysql-5.1-maint

Show diffs side-by-side

added added

removed removed

Lines of Context:
101
101
{
102
102
        trx_t*  trx;
103
103
 
104
 
#ifdef UNIV_SYNC_DEBUG
105
104
        ut_ad(mutex_own(&kernel_mutex));
106
 
#endif /* UNIV_SYNC_DEBUG */
107
105
 
108
106
        trx = mem_alloc(sizeof(trx_t));
109
107
 
111
109
 
112
110
        trx->op_info = "";
113
111
 
114
 
        trx->type = TRX_USER;
 
112
        trx->is_purge = 0;
115
113
        trx->conc_state = TRX_NOT_STARTED;
116
114
        trx->start_time = time(NULL);
117
115
 
280
278
/*=====*/
281
279
        trx_t*  trx)    /* in, own: trx object */
282
280
{
283
 
#ifdef UNIV_SYNC_DEBUG
284
281
        ut_ad(mutex_own(&kernel_mutex));
285
 
#endif /* UNIV_SYNC_DEBUG */
286
282
 
287
283
        if (trx->declared_to_be_inside_innodb) {
288
284
                ut_print_timestamp(stderr);
406
402
{
407
403
        trx_t*  trx2;
408
404
 
409
 
#ifdef UNIV_SYNC_DEBUG
410
405
        ut_ad(mutex_own(&kernel_mutex));
411
 
#endif /* UNIV_SYNC_DEBUG */
412
406
 
413
407
        trx2 = UT_LIST_GET_FIRST(trx_sys->trx_list);
414
408
 
633
627
{
634
628
        trx_rseg_t*     rseg    = trx_sys->latest_rseg;
635
629
 
636
 
#ifdef UNIV_SYNC_DEBUG
637
630
        ut_ad(mutex_own(&kernel_mutex));
638
 
#endif /* UNIV_SYNC_DEBUG */
639
631
loop:
640
632
        /* Get next rseg in a round-robin fashion */
641
633
 
672
664
{
673
665
        trx_rseg_t*     rseg;
674
666
 
675
 
#ifdef UNIV_SYNC_DEBUG
676
667
        ut_ad(mutex_own(&kernel_mutex));
677
 
#endif /* UNIV_SYNC_DEBUG */
678
668
        ut_ad(trx->rseg == NULL);
679
669
 
680
 
        if (trx->type == TRX_PURGE) {
 
670
        if (trx->is_purge) {
681
671
                trx->id = ut_dulint_zero;
682
672
                trx->conc_state = TRX_ACTIVE;
683
673
                trx->start_time = time(NULL);
749
739
        ibool           must_flush_log  = FALSE;
750
740
        mtr_t           mtr;
751
741
 
752
 
#ifdef UNIV_SYNC_DEBUG
753
742
        ut_ad(mutex_own(&kernel_mutex));
754
 
#endif /* UNIV_SYNC_DEBUG */
755
743
 
756
744
        trx->must_flush_log_later = FALSE;
757
745
 
851
839
 
852
840
        ut_ad(trx->conc_state == TRX_ACTIVE
853
841
              || trx->conc_state == TRX_PREPARED);
854
 
#ifdef UNIV_SYNC_DEBUG
855
842
        ut_ad(mutex_own(&kernel_mutex));
856
 
#endif /* UNIV_SYNC_DEBUG */
857
843
 
858
844
        /* The following assignment makes the transaction committed in memory
859
845
        and makes its changes to data visible to other transactions.
1036
1022
        trx_sig_t*      sig;
1037
1023
        trx_sig_t*      next_sig;
1038
1024
 
1039
 
#ifdef UNIV_SYNC_DEBUG
1040
1025
        ut_ad(mutex_own(&kernel_mutex));
1041
 
#endif /* UNIV_SYNC_DEBUG */
1042
1026
 
1043
1027
        trx->que_state = TRX_QUE_COMMITTING;
1044
1028
 
1078
1062
{
1079
1063
        que_thr_t*      thr;
1080
1064
 
1081
 
#ifdef UNIV_SYNC_DEBUG
1082
1065
        ut_ad(mutex_own(&kernel_mutex));
1083
 
#endif /* UNIV_SYNC_DEBUG */
1084
1066
        ut_ad(trx->que_state == TRX_QUE_LOCK_WAIT);
1085
1067
 
1086
1068
        thr = UT_LIST_GET_FIRST(trx->wait_thrs);
1107
1089
{
1108
1090
        que_thr_t*      thr;
1109
1091
 
1110
 
#ifdef UNIV_SYNC_DEBUG
1111
1092
        ut_ad(mutex_own(&kernel_mutex));
1112
 
#endif /* UNIV_SYNC_DEBUG */
1113
1093
        ut_ad(trx->que_state == TRX_QUE_LOCK_WAIT);
1114
1094
 
1115
1095
        thr = UT_LIST_GET_FIRST(trx->wait_thrs);
1137
1117
        trx_sig_t*      sig;
1138
1118
        que_thr_t*      thr;
1139
1119
 
1140
 
#ifdef UNIV_SYNC_DEBUG
1141
1120
        ut_ad(mutex_own(&kernel_mutex));
1142
 
#endif /* UNIV_SYNC_DEBUG */
1143
1121
 
1144
1122
        sig = UT_LIST_GET_FIRST(trx->reply_signals);
1145
1123
 
1172
1150
{
1173
1151
        trx_sig_t*      sig;
1174
1152
 
1175
 
#ifdef UNIV_SYNC_DEBUG
1176
1153
        ut_ad(mutex_own(&kernel_mutex));
1177
 
#endif /* UNIV_SYNC_DEBUG */
1178
1154
 
1179
1155
        if (UT_LIST_GET_LEN(trx->signals) == 0) {
1180
1156
 
1260
1236
        trx_t*          receiver_trx;
1261
1237
 
1262
1238
        ut_ad(trx);
1263
 
#ifdef UNIV_SYNC_DEBUG
1264
1239
        ut_ad(mutex_own(&kernel_mutex));
1265
 
#endif /* UNIV_SYNC_DEBUG */
1266
1240
 
1267
1241
        if (!trx_sig_is_compatible(trx, type, sender)) {
1268
1242
                /* The signal is not compatible with the other signals in
1288
1262
        UT_LIST_ADD_LAST(signals, trx->signals, sig);
1289
1263
 
1290
1264
        sig->type = type;
1291
 
        sig->state = TRX_SIG_WAITING;
1292
1265
        sig->sender = sender;
1293
1266
        sig->receiver = receiver_thr;
1294
1267
 
1332
1305
/*====================*/
1333
1306
        trx_t*  trx)    /* in: trx */
1334
1307
{
1335
 
#ifdef UNIV_SYNC_DEBUG
1336
1308
        ut_ad(mutex_own(&kernel_mutex));
1337
 
#endif /* UNIV_SYNC_DEBUG */
1338
1309
        ut_ad(trx->handling_signals == TRUE);
1339
1310
 
1340
1311
        trx->handling_signals = FALSE;
1368
1339
        we can process immediately */
1369
1340
 
1370
1341
        ut_ad(trx);
1371
 
#ifdef UNIV_SYNC_DEBUG
1372
1342
        ut_ad(mutex_own(&kernel_mutex));
1373
 
#endif /* UNIV_SYNC_DEBUG */
1374
1343
 
1375
1344
        if (trx->handling_signals && (UT_LIST_GET_LEN(trx->signals) == 0)) {
1376
1345
 
1471
1440
        trx_t*  receiver_trx;
1472
1441
 
1473
1442
        ut_ad(sig);
1474
 
#ifdef UNIV_SYNC_DEBUG
1475
1443
        ut_ad(mutex_own(&kernel_mutex));
1476
 
#endif /* UNIV_SYNC_DEBUG */
1477
1444
 
1478
1445
        if (sig->receiver != NULL) {
1479
1446
                ut_ad((sig->receiver)->state == QUE_THR_SIG_REPLY_WAIT);
1501
1468
        trx_sig_t*      sig)    /* in, own: signal */
1502
1469
{
1503
1470
        ut_ad(trx && sig);
1504
 
#ifdef UNIV_SYNC_DEBUG
1505
1471
        ut_ad(mutex_own(&kernel_mutex));
1506
 
#endif /* UNIV_SYNC_DEBUG */
1507
1472
 
1508
1473
        ut_ad(sig->receiver == NULL);
1509
1474
 
1743
1708
                fputs(trx->op_info, f);
1744
1709
        }
1745
1710
 
1746
 
        if (trx->type != TRX_USER) {
 
1711
        if (trx->is_purge) {
1747
1712
                fputs(" purge trx", f);
1748
1713
        }
1749
1714
 
1820
1785
        dulint          lsn;
1821
1786
        mtr_t           mtr;
1822
1787
 
1823
 
#ifdef UNIV_SYNC_DEBUG
1824
1788
        ut_ad(mutex_own(&kernel_mutex));
1825
 
#endif /* UNIV_SYNC_DEBUG */
1826
1789
 
1827
1790
        rseg = trx->rseg;
1828
1791
 
1868
1831
                mutex_enter(&kernel_mutex);
1869
1832
        }
1870
1833
 
1871
 
#ifdef UNIV_SYNC_DEBUG
1872
1834
        ut_ad(mutex_own(&kernel_mutex));
1873
 
#endif /* UNIV_SYNC_DEBUG */
1874
1835
 
1875
1836
        /*--------------------------------------*/
1876
1837
        trx->conc_state = TRX_PREPARED;