mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
P_S 5.7.28
This commit is contained in:
@@ -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, version 2.0,
|
||||
@@ -26,12 +26,14 @@
|
||||
*/
|
||||
|
||||
#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"
|
||||
#include "table_file_instances.h"
|
||||
#include "pfs_global.h"
|
||||
#include "pfs_buffer_container.h"
|
||||
#include "field.h"
|
||||
|
||||
THR_LOCK table_file_instances::m_table_lock;
|
||||
|
||||
@@ -40,17 +42,17 @@ table_file_instances::m_share=
|
||||
{
|
||||
{ C_STRING_WITH_LEN("file_instances") },
|
||||
&pfs_readonly_acl,
|
||||
&table_file_instances::create,
|
||||
table_file_instances::create,
|
||||
NULL, /* write_row */
|
||||
NULL, /* delete_all_rows */
|
||||
NULL, /* get_row_count */
|
||||
1000, /* records */
|
||||
table_file_instances::get_row_count,
|
||||
sizeof(PFS_simple_index),
|
||||
&m_table_lock,
|
||||
{ C_STRING_WITH_LEN("CREATE TABLE file_instances("
|
||||
"FILE_NAME VARCHAR(512) not null,"
|
||||
"EVENT_NAME VARCHAR(128) not null,"
|
||||
"OPEN_COUNT INTEGER unsigned not null)") }
|
||||
"OPEN_COUNT INTEGER unsigned not null)") },
|
||||
false /* perpetual */
|
||||
};
|
||||
|
||||
PFS_engine_table* table_file_instances::create(void)
|
||||
@@ -58,6 +60,12 @@ PFS_engine_table* table_file_instances::create(void)
|
||||
return new table_file_instances();
|
||||
}
|
||||
|
||||
ha_rows
|
||||
table_file_instances::get_row_count(void)
|
||||
{
|
||||
return global_file_container.get_row_count();
|
||||
}
|
||||
|
||||
table_file_instances::table_file_instances()
|
||||
: PFS_engine_table(&m_share, &m_pos),
|
||||
m_row_exists(false), m_pos(0), m_next_pos(0)
|
||||
@@ -73,17 +81,14 @@ int table_file_instances::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;
|
||||
@@ -94,19 +99,20 @@ int table_file_instances::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;
|
||||
}
|
||||
|
||||
void table_file_instances::make_row(PFS_file *pfs)
|
||||
{
|
||||
pfs_lock lock;
|
||||
pfs_optimistic_state lock;
|
||||
PFS_file_class *safe_class;
|
||||
|
||||
m_row_exists= false;
|
||||
|
Reference in New Issue
Block a user