Offsets for MySQL 5.5.47, 5.6.28, MariaDB 5.5.47.
parent
051daf06a4
commit
94b7274600
|
@ -23,15 +23,33 @@ if [ $? = 0 ]; then
|
|||
fi
|
||||
|
||||
COMMAND_MEMBER=command
|
||||
THREAD_ID=thread_id
|
||||
SEC_CONTEXT=main_security_ctx
|
||||
USER=user
|
||||
HOST=host
|
||||
IP=ip
|
||||
PRIV_USER=priv_user
|
||||
DB=db
|
||||
|
||||
#in 5.6 command member is named m_command
|
||||
echo $MYVER | grep -P '^(5\.6|10\.)' > /dev/null
|
||||
echo $MYVER | grep -P '^(5\.6|5\.7|10\.)' > /dev/null
|
||||
if [ $? = 0 ]; then
|
||||
COMMAND_MEMBER=m_command
|
||||
fi
|
||||
#in 5.7 thread_id changed to m_thread_id. main_security_ctx changed to m_main_security_ctx
|
||||
echo $MYVER | grep -P '^(5\.7)' > /dev/null
|
||||
if [ $? = 0 ]; then
|
||||
THREAD_ID=m_thread_id
|
||||
SEC_CONTEXT=m_main_security_ctx
|
||||
USER=m_user
|
||||
HOST=m_host
|
||||
IP=m_ip
|
||||
PRIV_USER=m_priv_user
|
||||
DB=m_db
|
||||
fi
|
||||
|
||||
echo "set logging on" > offsets.gdb
|
||||
echo 'printf "{\"'$MYVER'\",\"'$MYMD5'\", %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d}", ((size_t)&((THD *)log_slow_statement)->query_id) - (size_t)log_slow_statement, ((size_t)&((THD *)log_slow_statement)->thread_id) - (size_t)log_slow_statement, ((size_t)&((THD *)log_slow_statement)->main_security_ctx) - (size_t)log_slow_statement, ((size_t)&((THD *)log_slow_statement)->'$COMMAND_MEMBER') - (size_t)log_slow_statement, ((size_t)&((THD *)log_slow_statement)->lex) - (size_t)log_slow_statement, (size_t)&((LEX*)log_slow_statement)->comment - (size_t) log_slow_statement, ((size_t)&((Security_context *)log_slow_statement)->user) - (size_t)log_slow_statement, ((size_t)&((Security_context *)log_slow_statement)->host) - (size_t)log_slow_statement, ((size_t)&((Security_context *)log_slow_statement)->ip) - (size_t)log_slow_statement, ((size_t)&((Security_context *)log_slow_statement)->priv_user) - (size_t)log_slow_statement, ((size_t)&((THD *)log_slow_statement)->db) - (size_t)log_slow_statement, ((size_t)&((THD *)log_slow_statement)->killed) - (size_t)log_slow_statement' >> offsets.gdb
|
||||
echo 'printf "{\"'$MYVER'\",\"'$MYMD5'\", %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d}", ((size_t)&((THD *)log_slow_statement)->query_id) - (size_t)log_slow_statement, ((size_t)&((THD *)log_slow_statement)->'$THREAD_ID') - (size_t)log_slow_statement, ((size_t)&((THD *)log_slow_statement)->'$SEC_CONTEXT') - (size_t)log_slow_statement, ((size_t)&((THD *)log_slow_statement)->'$COMMAND_MEMBER') - (size_t)log_slow_statement, ((size_t)&((THD *)log_slow_statement)->lex) - (size_t)log_slow_statement, (size_t)&((LEX*)log_slow_statement)->comment - (size_t) log_slow_statement, ((size_t)&((Security_context *)log_slow_statement)->'$USER') - (size_t)log_slow_statement, ((size_t)&((Security_context *)log_slow_statement)->'$HOST') - (size_t)log_slow_statement, ((size_t)&((Security_context *)log_slow_statement)->'$IP') - (size_t)log_slow_statement, ((size_t)&((Security_context *)log_slow_statement)->'$PRIV_USER') - (size_t)log_slow_statement, ((size_t)&((THD *)log_slow_statement)->'$DB') - (size_t)log_slow_statement, ((size_t)&((THD *)log_slow_statement)->killed) - (size_t)log_slow_statement' >> offsets.gdb
|
||||
|
||||
SYMPARAM=""
|
||||
if [ -n "$2" ]; then
|
||||
|
|
|
@ -21,6 +21,10 @@
|
|||
//64 bit offsets
|
||||
const ThdOffsets thd_offsets_arr[] =
|
||||
{
|
||||
//offsets for: /mysqlrpm/5.5.47/usr/sbin/mysqld (5.5.47)
|
||||
{"5.5.47","a35964c285630302290dc1ad31bddd93", 6144, 6192, 3816, 4312, 88, 2592, 96, 0, 32, 104, 120, 6264},
|
||||
//offsets for: /mysqlrpm/5.6.28/usr/sbin/mysqld (5.6.28)
|
||||
{"5.6.28","a88464e4d2cb6d11311179166613c015", 6992, 7040, 4000, 4520, 72, 2704, 96, 0, 32, 104, 136, 7128},
|
||||
//offsets for: /mysqlrpm/5.6.27/usr/sbin/mysqld (5.6.27)
|
||||
{"5.6.27","212c7e3701046857fa6d7f1404f427d9", 6992, 7040, 4000, 4520, 72, 2704, 96, 0, 32, 104, 136, 7128},
|
||||
//offsets for: /mysqlrpm/5.5.46/usr/sbin/mysqld (5.5.46)
|
||||
|
@ -415,6 +419,10 @@ const ThdOffsets thd_offsets_arr[] =
|
|||
//32 bit offsets
|
||||
const ThdOffsets thd_offsets_arr[] =
|
||||
{
|
||||
//offsets for: /mysqlrpm/5.5.47/usr/sbin/mysqld (5.5.47)
|
||||
{"5.5.47","669f76493658cd2758af28a1c391391a", 3872, 3900, 2368, 2748, 44, 1656, 60, 0, 20, 64, 60, 3956},
|
||||
//offsets for: /mysqlrpm/5.6.28/usr/sbin/mysqld (5.6.28)
|
||||
{"5.6.28","b108d8002c70f9e6bf57b6c47f1b4a74", 4676, 4704, 2660, 3052, 36, 1748, 60, 0, 20, 64, 72, 4776},
|
||||
//offsets for: /mysqlrpm/5.6.27/usr/sbin/mysqld (5.6.27)
|
||||
{"5.6.27","66d0b372d6eb134730c43bdb1c2ac4e5", 4672, 4700, 2660, 3052, 36, 1748, 60, 0, 20, 64, 72, 4772},
|
||||
//offsets for: /mysqlrpm/5.5.46/usr/sbin/mysqld (5.5.46)
|
||||
|
@ -789,6 +797,12 @@ const ThdOffsets thd_offsets_arr[] =
|
|||
//64 bit offsets
|
||||
const ThdOffsets thd_offsets_arr[] =
|
||||
{
|
||||
//offsets for: /mariadb/5.5.47/bin/mysqld (5.5.47-MariaDB)
|
||||
{"5.5.47-MariaDB","642990798709d79dcdc662104805b44b", 12032, 12096, 5800, 6904, 88, 2920, 8, 0, 16, 24, 152, 12168},
|
||||
//offsets for: /mariadb/10.1.9/bin/mysqld (10.1.9-MariaDB)
|
||||
{"10.1.9-MariaDB","f6a488fd8331d6201c0598fb6ff3fa9e", 13576, 13640, 6352, 7960, 88, 2960, 8, 0, 16, 24, 152, 13732},
|
||||
//offsets for: /mariadb/10.1.8/bin/mysqld (10.1.8-MariaDB)
|
||||
{"10.1.8-MariaDB","cf103655e354afa2bf43cc4899b65101", 13576, 13640, 6352, 7960, 88, 2960, 8, 0, 16, 24, 152, 13732},
|
||||
//offsets for: /mariadb/5.5.46/bin/mysqld (5.5.46-MariaDB)
|
||||
{"5.5.46-MariaDB","ec8c941f31086bed6cf9c7e97ed61c0a", 12032, 12096, 5800, 6904, 88, 2920, 8, 0, 16, 24, 152, 12168},
|
||||
//offsets for: /mariadb/10.0.21/bin/mysqld (10.0.21-MariaDB)
|
||||
|
@ -859,6 +873,12 @@ const ThdOffsets thd_offsets_arr[] =
|
|||
//32 bit offsets
|
||||
const ThdOffsets thd_offsets_arr[] =
|
||||
{
|
||||
//offsets for: /mariadb/5.5.47/bin/mysqld (5.5.47-MariaDB)
|
||||
{"5.5.47-MariaDB","5d7d4f995a41dc09e3a557e0a5529b11", 7276, 7312, 3460, 4468, 44, 1856, 4, 0, 8, 12, 84, 7372},
|
||||
//offsets for: /mariadb/10.1.9/bin/mysqld (10.1.9-MariaDB)
|
||||
{"10.1.9-MariaDB","3f2078219f1098a89a7b12978b33a7e3", 8460, 8496, 3808, 5268, 44, 1884, 4, 0, 8, 12, 84, 8572},
|
||||
//offsets for: /mariadb/10.1.8/bin/mysqld (10.1.8-MariaDB)
|
||||
{"10.1.8-MariaDB","aba39e89c42a58d6ed73f9fd96c75b42", 8460, 8496, 3808, 5268, 44, 1884, 4, 0, 8, 12, 84, 8572},
|
||||
//offsets for: /mariadb/5.5.46/bin/mysqld (5.5.46-MariaDB)
|
||||
{"5.5.46-MariaDB","df034940564625d2ad168799d47190d1", 7276, 7312, 3460, 4468, 44, 1856, 4, 0, 8, 12, 84, 7372},
|
||||
//offsets for: /mariadb/10.0.21/bin/mysqld (10.0.21-MariaDB)
|
||||
|
|
|
@ -307,6 +307,9 @@ static int (*trampoline_send_result_to_client)(Query_cache *pthis, THD *thd, ch
|
|||
#if MYSQL_VERSION_ID > 50505
|
||||
static bool (*trampoline_open_tables)(THD *thd, TABLE_LIST **start, uint *counter, uint flags,
|
||||
Prelocking_strategy *prelocking_strategy) = NULL;
|
||||
#elif defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100108
|
||||
static bool (*trampoline_open_tables)(THD *thd, const DDL_options_st &options, TABLE_LIST **start, uint *counter, uint flags,
|
||||
Prelocking_strategy *prelocking_strategy) = NULL;
|
||||
#else
|
||||
static int (*trampoline_open_tables)(THD *thd, TABLE_LIST **start, uint *counter, uint flags) = NULL;
|
||||
#endif
|
||||
|
@ -381,6 +384,18 @@ static bool audit_open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint
|
|||
|
||||
bool res;
|
||||
res = trampoline_open_tables (thd, start, counter, flags, prelocking_strategy);
|
||||
#elif defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100108
|
||||
static bool audit_open_tables(THD *thd, const DDL_options_st &options, TABLE_LIST **start, uint *counter, uint flags,
|
||||
Prelocking_strategy *prelocking_strategy)
|
||||
{
|
||||
bool res;
|
||||
res = trampoline_open_tables (thd, options, start, counter, flags, prelocking_strategy);
|
||||
#else
|
||||
static int audit_open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags)
|
||||
{
|
||||
int res;
|
||||
res = trampoline_open_tables (thd, start, counter, flags);
|
||||
#endif
|
||||
//only log if thread id or query id is non 0 (otherwise this is comming from startup activity)
|
||||
if(Audit_formatter::thd_inst_thread_id(thd) || Audit_formatter::thd_inst_query_id(thd))
|
||||
{
|
||||
|
@ -389,20 +404,8 @@ static bool audit_open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint
|
|||
}
|
||||
return res;
|
||||
}
|
||||
#else
|
||||
static int audit_open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags)
|
||||
{
|
||||
bool res;
|
||||
res = trampoline_open_tables (thd, start, counter, flags);
|
||||
//only log if thread id or query id is non 0 (otherwise this is comming from startup activity)
|
||||
if(Audit_formatter::thd_inst_thread_id(thd) || Audit_formatter::thd_inst_query_id(thd))
|
||||
{
|
||||
ThdSesData thd_data (thd);
|
||||
audit(&thd_data);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static unsigned int trampoline_open_tables_size =0;
|
||||
|
||||
|
||||
|
@ -509,15 +512,15 @@ void remove_hot_functions ()
|
|||
#if MYSQL_VERSION_ID > 50505
|
||||
target_function = (void *)*(bool (*)(THD *thd, TABLE_LIST **start, uint *counter, uint flags,
|
||||
Prelocking_strategy *prelocking_strategy)) &open_tables;
|
||||
remove_hot_patch_function(target_function,
|
||||
(void*) trampoline_open_tables, trampoline_open_tables_size, true);
|
||||
trampoline_open_tables_size=0;
|
||||
#elif defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100108
|
||||
target_function = (void *)*(bool (*)(THD *thd, const DDL_options_st &options, TABLE_LIST **start, uint *counter, uint flags,
|
||||
Prelocking_strategy *prelocking_strategy)) &open_tables;
|
||||
#else
|
||||
target_function = (void *)*(int (*)(THD *thd, TABLE_LIST **start, uint *counter, uint flags)) &open_tables;
|
||||
#endif
|
||||
remove_hot_patch_function(target_function,
|
||||
(void*) trampoline_open_tables, trampoline_open_tables_size, true);
|
||||
trampoline_open_tables_size=0;
|
||||
#endif
|
||||
|
||||
int (Query_cache::*pf_send_result_to_client)(THD *,char *, uint) = &Query_cache::send_result_to_client;
|
||||
target_function = *(void **) &pf_send_result_to_client;
|
||||
|
@ -1087,8 +1090,8 @@ static int set_com_status_vars_array ()
|
|||
size_t initial_offset = (size_t) com_status_vars[status_vars_index].value;
|
||||
status_vars_index =0;
|
||||
while (com_status_vars[status_vars_index].name != NullS)
|
||||
{
|
||||
int sql_command_idx = (com_status_vars[status_vars_index].value - (char*) (initial_offset)) / sizeof (ulong);
|
||||
{
|
||||
int sql_command_idx = ((size_t)(com_status_vars[status_vars_index].value) - (initial_offset)) / sizeof (ulong);
|
||||
if (sql_command_idx >=0 && sql_command_idx < MAX_COM_STATUS_VARS_RECORDS)
|
||||
{
|
||||
com_status_vars_array [sql_command_idx].name = com_status_vars[status_vars_index].name;
|
||||
|
@ -1493,20 +1496,18 @@ static void record_objs_string_update_extended(THD *thd, struct st_mysql_sys_var
|
|||
|
||||
#if MYSQL_VERSION_ID > 50505
|
||||
target_function = (void *)*(bool (*)(THD *thd, TABLE_LIST **start, uint *counter, uint flags,
|
||||
Prelocking_strategy *prelocking_strategy)) &open_tables;
|
||||
#elif defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 100108
|
||||
target_function = (void *)*(bool (*)(THD *thd, const DDL_options_st &options, TABLE_LIST **start, uint *counter, uint flags,
|
||||
Prelocking_strategy *prelocking_strategy)) &open_tables;
|
||||
if(do_hot_patch((void **)&trampoline_open_tables, &trampoline_open_tables_size,
|
||||
(void *)target_function, (void *)audit_open_tables, "open_tables"))
|
||||
{
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
#else
|
||||
target_function = (void *)*(int (*)(THD *thd, TABLE_LIST **start, uint *counter, uint flags)) &open_tables;
|
||||
if(do_hot_patch((void **)&trampoline_open_tables, &trampoline_open_tables_size,
|
||||
target_function = (void *)*(int (*)(THD *thd, TABLE_LIST **start, uint *counter, uint flags)) &open_tables;
|
||||
#endif
|
||||
if(do_hot_patch((void **)&trampoline_open_tables, &trampoline_open_tables_size,
|
||||
(void *)target_function, (void *)audit_open_tables, "open_tables"))
|
||||
{
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (set_com_status_vars_array () !=0)
|
||||
{
|
||||
DBUG_RETURN(1);
|
||||
|
|
Loading…
Reference in New Issue