1
1
/*****************************************************************************
3
Copyright (c) 2007, 2009, Innobase Oy. All Rights Reserved.
3
Copyright (c) 2007, 2010, Innobase Oy. All Rights Reserved.
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
29
29
*******************************************************/
31
31
#include "config.h"
32
/* Found during the build of 5.5.3 on Linux 2.4 and early 2.6 kernels:
33
The includes "univ.i" -> "my_global.h" cause a different path
34
to be taken further down with pthread functions and types,
35
so they must come first.
36
From the symptoms, this is related to bug#46587 in the MySQL bug DB.
33
40
#if !defined(BUILD_DRIZZLE)
34
41
# include <mysql/plugin.h>
447
456
row->trx_weight = (ullint) ut_conv_dulint_to_longlong(TRX_WEIGHT(trx));
449
if (trx->mysql_thd != NULL) {
450
row->trx_mysql_thread_id
451
#if defined(BUILD_DRIZZLE)
452
= session_get_thread_id(trx->mysql_thd);
454
= thd_get_thread_id(trx->mysql_thd);
458
if (trx->mysql_thd == NULL) {
457
459
/* For internal transactions e.g., purge and transactions
458
460
being recovered at startup there is no associated MySQL
459
461
thread data structure. */
460
462
row->trx_mysql_thread_id = 0;
463
row->trx_query = NULL;
463
if (trx->mysql_query_str != NULL) {
465
if (strlen(trx->mysql_query_str)
466
> TRX_I_S_TRX_QUERY_MAX_LEN) {
468
char query[TRX_I_S_TRX_QUERY_MAX_LEN + 1];
470
memcpy(query, trx->mysql_query_str,
471
TRX_I_S_TRX_QUERY_MAX_LEN);
472
query[TRX_I_S_TRX_QUERY_MAX_LEN] = '\0';
474
row->trx_query = ha_storage_put_memlim(
475
cache->storage, query,
476
TRX_I_S_TRX_QUERY_MAX_LEN + 1,
477
MAX_ALLOWED_FOR_STORAGE(cache));
480
row->trx_query = ha_storage_put_str_memlim(
481
cache->storage, trx->mysql_query_str,
482
MAX_ALLOWED_FOR_STORAGE(cache));
467
row->trx_mysql_thread_id = session_get_thread_id(trx->mysql_thd);
468
stmt = innobase_get_stmt(trx->mysql_thd, &stmt_len);
472
char query[TRX_I_S_TRX_QUERY_MAX_LEN + 1];
474
if (stmt_len > TRX_I_S_TRX_QUERY_MAX_LEN) {
475
stmt_len = TRX_I_S_TRX_QUERY_MAX_LEN;
478
memcpy(query, stmt, stmt_len);
479
query[stmt_len] = '\0';
481
row->trx_query = ha_storage_put_memlim(
482
cache->storage, stmt, stmt_len + 1,
483
MAX_ALLOWED_FOR_STORAGE(cache));
485
485
if (row->trx_query == NULL) {