1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00
This commit is contained in:
Sergei Golubchik
2016-07-28 15:52:12 +02:00
parent 51ed64a520
commit 15f60c1a73
976 changed files with 148320 additions and 35656 deletions

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2008, 2015, 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
@@ -19,7 +19,7 @@
*/
#include "my_global.h"
#include "my_pthread.h"
#include "my_thread.h"
#include "pfs_instr.h"
#include "pfs_column_types.h"
#include "pfs_column_values.h"
@@ -27,6 +27,8 @@
#include "table_setup_objects.h"
#include "table_helper.h"
#include "pfs_global.h"
#include "pfs_buffer_container.h"
#include "field.h"
THR_LOCK table_setup_objects::m_table_lock;
@@ -34,7 +36,7 @@ static const TABLE_FIELD_TYPE field_types[]=
{
{
{ C_STRING_WITH_LEN("OBJECT_TYPE") },
{ C_STRING_WITH_LEN("enum(\'TABLE\')") },
{ C_STRING_WITH_LEN("enum(\'EVENT\',\'FUNCTION\',\'PROCEDURE\',\'TABLE\',\'TRIGGER\'") },
{ NULL, 0}
},
{
@@ -72,11 +74,11 @@ table_setup_objects::m_share=
table_setup_objects::write_row,
table_setup_objects::delete_all_rows,
table_setup_objects::get_row_count,
1000, /* records */
sizeof(PFS_simple_index),
&m_table_lock,
&m_field_def,
false /* checked */
false, /* checked */
false /* perpetual */
};
int update_derived_flags()
@@ -86,6 +88,7 @@ int update_derived_flags()
return HA_ERR_OUT_OF_MEM;
update_table_share_derived_flags(thread);
update_program_share_derived_flags(thread);
update_table_derived_flags();
return 0;
}
@@ -138,7 +141,9 @@ int table_setup_objects::write_row(TABLE *table, unsigned char *buf,
}
/* Reject illegal enum values in OBJECT_TYPE */
if (object_type != OBJECT_TYPE_TABLE)
if (object_type < FIRST_OBJECT_TYPE ||
object_type > LAST_OBJECT_TYPE ||
object_type == OBJECT_TYPE_TEMPORARY_TABLE)
return HA_ERR_NO_REFERENCED_ROW;
/* Reject illegal enum values in ENABLED */
@@ -169,7 +174,7 @@ int table_setup_objects::delete_all_rows(void)
ha_rows table_setup_objects::get_row_count(void)
{
return setup_object_count();
return global_setup_object_container.get_row_count();
}
table_setup_objects::table_setup_objects()
@@ -187,17 +192,14 @@ int table_setup_objects::rnd_next(void)
{
PFS_setup_object *pfs;
for (m_pos.set_at(&m_next_pos);
m_pos.m_index < setup_object_max;
m_pos.next())
m_pos.set_at(&m_next_pos);
PFS_setup_object_iterator it= global_setup_object_container.iterate(m_pos.m_index);
pfs= it.scan_next(& m_pos.m_index);
if (pfs != NULL)
{
pfs= &setup_object_array[m_pos.m_index];
if (pfs->m_lock.is_populated())
{
make_row(pfs);
m_next_pos.set_after(&m_pos);
return 0;
}
make_row(pfs);
m_next_pos.set_after(&m_pos);
return 0;
}
return HA_ERR_END_OF_FILE;
@@ -209,9 +211,8 @@ int table_setup_objects::rnd_pos(const void *pos)
set_position(pos);
DBUG_ASSERT(m_pos.m_index < setup_object_max);
pfs= &setup_object_array[m_pos.m_index];
if (pfs->m_lock.is_populated())
pfs= global_setup_object_container.get(m_pos.m_index);
if (pfs != NULL)
{
make_row(pfs);
return 0;
@@ -222,7 +223,7 @@ int table_setup_objects::rnd_pos(const void *pos)
void table_setup_objects::make_row(PFS_setup_object *pfs)
{
pfs_lock lock;
pfs_optimistic_state lock;
m_row_exists= false;