1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Temporary commit of 10.0-merge

This commit is contained in:
Michael Widenius
2013-03-26 00:03:13 +02:00
parent 35bc8f9f43
commit 068c61978e
649 changed files with 88289 additions and 22802 deletions

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ static const TABLE_FIELD_TYPE field_types[]=
{
{
{ C_STRING_WITH_LEN("THREAD_ID") },
{ C_STRING_WITH_LEN("int(11)") },
{ C_STRING_WITH_LEN("bigint(20)") },
{ NULL, 0}
},
{
@@ -41,7 +41,7 @@ static const TABLE_FIELD_TYPE field_types[]=
},
{
{ C_STRING_WITH_LEN("PROCESSLIST_ID") },
{ C_STRING_WITH_LEN("int(11)") },
{ C_STRING_WITH_LEN("bigint(20)") },
{ NULL, 0}
},
{
@@ -81,7 +81,7 @@ static const TABLE_FIELD_TYPE field_types[]=
},
{
{ C_STRING_WITH_LEN("PARENT_THREAD_ID") },
{ C_STRING_WITH_LEN("int(11)") },
{ C_STRING_WITH_LEN("bigint(20)") },
{ NULL, 0}
},
{
@@ -129,6 +129,7 @@ table_threads::table_threads()
void table_threads::make_row(PFS_thread *pfs)
{
pfs_lock lock;
pfs_lock processlist_lock;
PFS_thread_class *safe_class;
m_row_exists= false;
@@ -142,7 +143,7 @@ void table_threads::make_row(PFS_thread *pfs)
m_row.m_thread_internal_id= pfs->m_thread_internal_id;
m_row.m_parent_thread_internal_id= pfs->m_parent_thread_internal_id;
m_row.m_thread_id= pfs->m_thread_id;
m_row.m_processlist_id= pfs->m_processlist_id;
m_row.m_name= safe_class->m_name;
m_row.m_name_length= safe_class->m_name_length;
@@ -166,12 +167,30 @@ void table_threads::make_row(PFS_thread *pfs)
m_row.m_command= pfs->m_command;
m_row.m_start_time= pfs->m_start_time;
/* Protect this reader against attribute changes. */
pfs->m_processlist_lock.begin_optimistic_lock(&processlist_lock);
/* FIXME: need to copy it ? */
m_row.m_processlist_state_ptr= pfs->m_processlist_state_ptr;
m_row.m_processlist_state_length= pfs->m_processlist_state_length;
/* FIXME: need to copy it ? */
m_row.m_processlist_info_ptr= pfs->m_processlist_info_ptr;
m_row.m_processlist_info_length= pfs->m_processlist_info_length;
if (! pfs->m_processlist_lock.end_optimistic_lock(& processlist_lock))
{
/*
Columns PROCESSLIST_STATE or PROCESSLIST_INFO are being
updated while we read them, and are unsafe to use.
Do not discard the entire row.
Do not loop waiting for a stable value.
Just return NULL values for these columns.
*/
m_row.m_processlist_state_length= 0;
m_row.m_processlist_info_length= 0;
}
m_row.m_enabled_ptr= &pfs->m_enabled;
if (pfs->m_lock.end_optimistic_lock(& lock))
@@ -200,20 +219,20 @@ int table_threads::read_row_values(TABLE *table,
switch(f->field_index)
{
case 0: /* THREAD_ID */
set_field_ulong(f, m_row.m_thread_internal_id);
set_field_ulonglong(f, m_row.m_thread_internal_id);
break;
case 1: /* NAME */
set_field_varchar_utf8(f, m_row.m_name, m_row.m_name_length);
break;
case 2: /* TYPE */
if (m_row.m_thread_id != 0)
if (m_row.m_processlist_id != 0)
set_field_varchar_utf8(f, "FOREGROUND", 10);
else
set_field_varchar_utf8(f, "BACKGROUND", 10);
break;
case 3: /* PROCESSLIST_ID */
if (m_row.m_thread_id != 0)
set_field_ulong(f, m_row.m_thread_id);
if (m_row.m_processlist_id != 0)
set_field_ulonglong(f, m_row.m_processlist_id);
else
f->set_null();
break;
@@ -239,7 +258,7 @@ int table_threads::read_row_values(TABLE *table,
f->set_null();
break;
case 7: /* PROCESSLIST_COMMAND */
if (m_row.m_thread_id != 0)
if (m_row.m_processlist_id != 0)
set_field_varchar_utf8(f, command_name[m_row.m_command].str,
command_name[m_row.m_command].length);
else
@@ -271,7 +290,7 @@ int table_threads::read_row_values(TABLE *table,
break;
case 11: /* PARENT_THREAD_ID */
if (m_row.m_parent_thread_internal_id != 0)
set_field_ulong(f, m_row.m_parent_thread_internal_id);
set_field_ulonglong(f, m_row.m_parent_thread_internal_id);
else
f->set_null();
break;