~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/pbxt/src/xaction_xt.cc

Merge Paul

Show diffs side-by-side

added added

removed removed

Lines of Context:
1221
1221
                        /* Write and flush the transaction log:
1222
1222
                         * We only flush if this was not a temp table.
1223
1223
                         */
1224
 
                        if (!xt_xlog_log_data(thread, sizeof(XTXactEndEntryDRec), (XTXactLogBufferDPtr) &entry, thread->st_non_temp_opened ? XT_XLOG_NO_WRITE_NO_FLUSH : xt_db_flush_log_at_trx_commit)) {
 
1224
                        if (!xt_xlog_log_data(thread, sizeof(XTXactEndEntryDRec), (XTXactLogBufferDPtr) &entry, thread->st_non_temp_updated ? xt_db_flush_log_at_trx_commit : XT_XLOG_NO_WRITE_NO_FLUSH)) {
1225
1225
                                ok = FALSE;
1226
1226
                                status = XT_LOG_ENT_ABORT;
1227
1227
                                /* Make sure this is done, if we failed to log
1337
1337
                /* Don't get too far ahead of the sweeper! */
1338
1338
                if (writer) {
1339
1339
#ifdef XT_WAIT_FOR_CLEANUP
1340
 
                        xtXactID        wait_xn_id;
1341
 
                        
1342
 
                        /* This is the transaction that was committed 3 transactions ago: */
1343
 
                        wait_xn_id = thread->st_prev_xact[thread->st_last_xact];
1344
 
                        thread->st_prev_xact[thread->st_last_xact] = xn_id;
1345
 
                        /* This works because XT_MAX_XACT_BEHIND == 2! */
1346
 
                        ASSERT_NS((thread->st_last_xact + 1) % XT_MAX_XACT_BEHIND == (thread->st_last_xact ^ 1));
1347
 
                        thread->st_last_xact ^= 1;
1348
 
                        while (xt_xn_is_before(db->db_xn_to_clean_id, wait_xn_id) && (db->db_sw_faster & XT_SW_TOO_FAR_BEHIND)) {
 
1340
                        if (db->db_sw_faster & XT_SW_TOO_FAR_BEHIND) {
 
1341
                                /* Set a maximum wait time (1/100s) */
 
1342
                                xtWord8         then = xt_trace_clock() + (xtWord8) 100000;
 
1343
                                xtXactID        wait_xn_id;
 
1344
                                
 
1345
                                /* This is the transaction that was committed 3 transactions ago: */
 
1346
                                wait_xn_id = thread->st_prev_xact[thread->st_last_xact];
 
1347
                                thread->st_prev_xact[thread->st_last_xact] = xn_id;
 
1348
                                /* This works because XT_MAX_XACT_BEHIND == 2! */
 
1349
                                ASSERT_NS((thread->st_last_xact + 1) % XT_MAX_XACT_BEHIND == (thread->st_last_xact ^ 1));
 
1350
                                thread->st_last_xact ^= 1;
 
1351
 
 
1352
                                while (xt_xn_is_before(db->db_xn_to_clean_id, wait_xn_id) && (db->db_sw_faster & XT_SW_TOO_FAR_BEHIND)) {
 
1353
                                        if (xt_trace_clock() >= then)
 
1354
                                                break;
1349
1355
#ifdef XT_SWEEPER_SORT_XACTS
1350
 
                                if (!xn_get_xact_start(db, wait_xn_id, thread, NULL, NULL))
1351
 
                                        break;
 
1356
                                        if (!xn_get_xact_start(db, wait_xn_id, thread, NULL, NULL))
 
1357
                                                break;
1352
1358
#endif
1353
 
                                xt_critical_wait();
 
1359
                                        xt_critical_wait();
 
1360
                                }
1354
1361
                        }
1355
1362
#else
1356
1363
                        if ((db->db_sw_faster & XT_SW_TOO_FAR_BEHIND) != 0) {