summaryrefslogtreecommitdiff
path: root/storage/perfschema/table_file_summary_by_instance.cc
diff options
context:
space:
mode:
Diffstat (limited to 'storage/perfschema/table_file_summary_by_instance.cc')
-rw-r--r--storage/perfschema/table_file_summary_by_instance.cc54
1 files changed, 30 insertions, 24 deletions
diff --git a/storage/perfschema/table_file_summary_by_instance.cc b/storage/perfschema/table_file_summary_by_instance.cc
index 3a30984405c..b05d1f24b60 100644
--- a/storage/perfschema/table_file_summary_by_instance.cc
+++ b/storage/perfschema/table_file_summary_by_instance.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2011, 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, version 2.0,
@@ -21,17 +21,19 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
/**
- @file storage/perfschema/table_file_summary.cc
+ @file storage/perfschema/table_file_summary_by_instance.cc
Table FILE_SUMMARY_BY_INSTANCE (implementation).
*/
#include "my_global.h"
-#include "my_pthread.h"
+#include "my_thread.h"
#include "pfs_instr_class.h"
#include "pfs_column_types.h"
#include "pfs_column_values.h"
#include "table_file_summary_by_instance.h"
#include "pfs_global.h"
+#include "pfs_buffer_container.h"
+#include "field.h"
THR_LOCK table_file_summary_by_instance::m_table_lock;
@@ -40,11 +42,10 @@ table_file_summary_by_instance::m_share=
{
{ C_STRING_WITH_LEN("file_summary_by_instance") },
&pfs_truncatable_acl,
- &table_file_summary_by_instance::create,
+ table_file_summary_by_instance::create,
NULL, /* write_row */
table_file_summary_by_instance::delete_all_rows,
- NULL, /* get_row_count */
- 1000, /* records */
+ table_file_summary_by_instance::get_row_count,
sizeof(PFS_simple_index),
&m_table_lock,
{ C_STRING_WITH_LEN("CREATE TABLE file_summary_by_instance("
@@ -72,7 +73,8 @@ table_file_summary_by_instance::m_share=
"SUM_TIMER_MISC BIGINT unsigned not null,"
"MIN_TIMER_MISC BIGINT unsigned not null,"
"AVG_TIMER_MISC BIGINT unsigned not null,"
- "MAX_TIMER_MISC BIGINT unsigned not null)") }
+ "MAX_TIMER_MISC BIGINT unsigned not null)") },
+ false /* perpetual */
};
PFS_engine_table* table_file_summary_by_instance::create(void)
@@ -86,6 +88,12 @@ int table_file_summary_by_instance::delete_all_rows(void)
return 0;
}
+ha_rows
+table_file_summary_by_instance::get_row_count(void)
+{
+ return global_file_container.get_row_count();
+}
+
table_file_summary_by_instance::table_file_summary_by_instance()
: PFS_engine_table(&m_share, &m_pos),
m_row_exists(false), m_pos(0), m_next_pos(0)
@@ -101,17 +109,14 @@ int table_file_summary_by_instance::rnd_next(void)
{
PFS_file *pfs;
- for (m_pos.set_at(&m_next_pos);
- m_pos.m_index < file_max;
- m_pos.next())
+ m_pos.set_at(&m_next_pos);
+ PFS_file_iterator it= global_file_container.iterate(m_pos.m_index);
+ pfs= it.scan_next(& m_pos.m_index);
+ if (pfs != NULL)
{
- pfs= &file_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;
@@ -122,14 +127,15 @@ int table_file_summary_by_instance::rnd_pos(const void *pos)
PFS_file *pfs;
set_position(pos);
- DBUG_ASSERT(m_pos.m_index < file_max);
- pfs= &file_array[m_pos.m_index];
- if (! pfs->m_lock.is_populated())
- return HA_ERR_RECORD_DELETED;
+ pfs= global_file_container.get(m_pos.m_index);
+ if (pfs != NULL)
+ {
+ make_row(pfs);
+ return 0;
+ }
- make_row(pfs);
- return 0;
+ return HA_ERR_RECORD_DELETED;
}
/**
@@ -138,7 +144,7 @@ int table_file_summary_by_instance::rnd_pos(const void *pos)
*/
void table_file_summary_by_instance::make_row(PFS_file *pfs)
{
- pfs_lock lock;
+ pfs_optimistic_state lock;
PFS_file_class *safe_class;
m_row_exists= false;