Commit 24ff1793 authored by Vicențiu Ciorbaru's avatar Vicențiu Ciorbaru

5.6.36

parent c33db2cd
SELECT "Digest table has a size 1 and is full already." as use_case;
use_case
Digest table has a size 1 and is full already.
select SCHEMA_NAME, DIGEST, DIGEST_TEXT
from performance_schema.events_statements_summary_by_digest;
SCHEMA_NAME DIGEST DIGEST_TEXT
NULL NULL NULL
# -----------------------------------------------------------------------
# Tests for the performance schema statement Digests.
# -----------------------------------------------------------------------
--source include/not_embedded.inc
--source include/have_perfschema.inc
--source include/no_protocol.inc
SELECT "Digest table has a size 1 and is full already." as use_case;
select SCHEMA_NAME, DIGEST, DIGEST_TEXT
from performance_schema.events_statements_summary_by_digest;
...@@ -3951,9 +3951,11 @@ static PSI_file* end_file_open_wait_v1(PSI_file_locker *locker, ...@@ -3951,9 +3951,11 @@ static PSI_file* end_file_open_wait_v1(PSI_file_locker *locker,
switch (state->m_operation) switch (state->m_operation)
{ {
case PSI_FILE_STAT: case PSI_FILE_STAT:
case PSI_FILE_RENAME:
break; break;
case PSI_FILE_STREAM_OPEN: case PSI_FILE_STREAM_OPEN:
case PSI_FILE_CREATE: case PSI_FILE_CREATE:
case PSI_FILE_OPEN:
if (result != NULL) if (result != NULL)
{ {
PFS_file_class *klass= reinterpret_cast<PFS_file_class*> (state->m_class); PFS_file_class *klass= reinterpret_cast<PFS_file_class*> (state->m_class);
...@@ -3964,7 +3966,6 @@ static PSI_file* end_file_open_wait_v1(PSI_file_locker *locker, ...@@ -3964,7 +3966,6 @@ static PSI_file* end_file_open_wait_v1(PSI_file_locker *locker,
state->m_file= reinterpret_cast<PSI_file*> (pfs_file); state->m_file= reinterpret_cast<PSI_file*> (pfs_file);
} }
break; break;
case PSI_FILE_OPEN:
default: default:
DBUG_ASSERT(false); DBUG_ASSERT(false);
break; break;
......
/* Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. /* Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -255,10 +255,11 @@ find_or_create_digest(PFS_thread *thread, ...@@ -255,10 +255,11 @@ find_or_create_digest(PFS_thread *thread,
if (safe_index == 0) if (safe_index == 0)
{ {
/* Record [0] is reserved. */ /* Record [0] is reserved. */
safe_index= 1; continue;
} }
/* Add a new record in digest stat array. */ /* Add a new record in digest stat array. */
DBUG_ASSERT(safe_index < digest_max);
pfs= &statements_digest_stat_array[safe_index]; pfs= &statements_digest_stat_array[safe_index];
if (pfs->m_lock.is_free()) if (pfs->m_lock.is_free())
......
/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. /* Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -27,6 +27,8 @@ ...@@ -27,6 +27,8 @@
#include "stub_print_error.h" #include "stub_print_error.h"
#include "stub_pfs_defaults.h" #include "stub_pfs_defaults.h"
void unload_performance_schema();
/* test helpers, to simulate the setup */ /* test helpers, to simulate the setup */
void setup_thread(PSI_thread *t, bool enabled) void setup_thread(PSI_thread *t, bool enabled)
...@@ -126,7 +128,7 @@ void test_bootstrap() ...@@ -126,7 +128,7 @@ void test_bootstrap()
psi_2= boot->get_interface(PSI_VERSION_2); psi_2= boot->get_interface(PSI_VERSION_2);
ok(psi_2 == NULL, "version 2"); ok(psi_2 == NULL, "version 2");
shutdown_performance_schema(); unload_performance_schema();
} }
/* /*
...@@ -183,6 +185,28 @@ PSI * load_perfschema() ...@@ -183,6 +185,28 @@ PSI * load_perfschema()
return (PSI*) psi; return (PSI*) psi;
} }
void unload_performance_schema()
{
cleanup_table_share();
cleanup_instruments();
cleanup_sync_class();
cleanup_thread_class();
cleanup_table_share();
cleanup_file_class();
cleanup_stage_class();
cleanup_statement_class();
cleanup_socket_class();
cleanup_events_waits_history_long();
cleanup_events_stages_history_long();
cleanup_events_statements_history_long();
cleanup_table_share_hash();
cleanup_file_hash();
cleanup_digest();
PFS_atomic::cleanup();
shutdown_performance_schema();
}
void test_bad_registration() void test_bad_registration()
{ {
PSI *psi; PSI *psi;
...@@ -581,8 +605,7 @@ void test_bad_registration() ...@@ -581,8 +605,7 @@ void test_bad_registration()
psi->register_socket("X", bad_socket_3, 1); psi->register_socket("X", bad_socket_3, 1);
ok(dummy_socket_key == 2, "assigned key"); ok(dummy_socket_key == 2, "assigned key");
unload_performance_schema();
shutdown_performance_schema();
} }
void test_init_disabled() void test_init_disabled()
...@@ -1016,7 +1039,7 @@ void test_init_disabled() ...@@ -1016,7 +1039,7 @@ void test_init_disabled()
socket_A1= psi->init_socket(99, NULL, NULL, 0); socket_A1= psi->init_socket(99, NULL, NULL, 0);
ok(socket_A1 == NULL, "broken socket key not instrumented"); ok(socket_A1 == NULL, "broken socket key not instrumented");
shutdown_performance_schema(); unload_performance_schema();
} }
void test_locker_disabled() void test_locker_disabled()
...@@ -1321,8 +1344,9 @@ void test_locker_disabled() ...@@ -1321,8 +1344,9 @@ void test_locker_disabled()
ok(socket_A1 != NULL, "instrumented"); ok(socket_A1 != NULL, "instrumented");
/* Socket thread owner has not been set */ /* Socket thread owner has not been set */
socket_locker= psi->start_socket_wait(&socket_state, socket_A1, PSI_SOCKET_SEND, 12, "foo.cc", 12); socket_locker= psi->start_socket_wait(&socket_state, socket_A1, PSI_SOCKET_SEND, 12, "foo.cc", 12);
ok(socket_locker == NULL, "no locker (no thread owner)"); ok(socket_locker != NULL, "locker (owner not used)");
psi->end_socket_wait(socket_locker, 10);
/* Pretend the running thread is not instrumented */ /* Pretend the running thread is not instrumented */
/* ---------------------------------------------- */ /* ---------------------------------------------- */
...@@ -1350,7 +1374,7 @@ void test_locker_disabled() ...@@ -1350,7 +1374,7 @@ void test_locker_disabled()
socket_locker= psi->start_socket_wait(&socket_state, socket_A1, PSI_SOCKET_SEND, 12, "foo.cc", 12); socket_locker= psi->start_socket_wait(&socket_state, socket_A1, PSI_SOCKET_SEND, 12, "foo.cc", 12);
ok(socket_locker == NULL, "no locker"); ok(socket_locker == NULL, "no locker");
shutdown_performance_schema(); unload_performance_schema();
} }
void test_file_instrumentation_leak() void test_file_instrumentation_leak()
...@@ -1437,7 +1461,7 @@ void test_file_instrumentation_leak() ...@@ -1437,7 +1461,7 @@ void test_file_instrumentation_leak()
file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_WRITE); file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_WRITE);
ok(file_locker == NULL, "no locker, no leak"); ok(file_locker == NULL, "no locker, no leak");
shutdown_performance_schema(); unload_performance_schema();
} }
void test_enabled() void test_enabled()
...@@ -1473,7 +1497,7 @@ void test_enabled() ...@@ -1473,7 +1497,7 @@ void test_enabled()
{ & cond_key_B, "C-B", 0} { & cond_key_B, "C-B", 0}
}; };
shutdown_performance_schema(); unload_performance_schema();
#endif #endif
} }
...@@ -1642,6 +1666,6 @@ int main(int, char **) ...@@ -1642,6 +1666,6 @@ int main(int, char **)
plan(216); plan(216);
MY_INIT("pfs-t"); MY_INIT("pfs-t");
do_all_tests(); do_all_tests();
return 0; return (exit_status());
} }
/* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. /* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -111,6 +111,6 @@ int main(int, char **) ...@@ -111,6 +111,6 @@ int main(int, char **)
plan(6); plan(6);
MY_INIT("pfs_account-oom-t"); MY_INIT("pfs_account-oom-t");
do_all_tests(); do_all_tests();
return 0; return (exit_status());
} }
/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. /* Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -341,5 +341,5 @@ int main(int, char **) ...@@ -341,5 +341,5 @@ int main(int, char **)
diag("skipping the cp1251 tests : missing character set"); diag("skipping the cp1251 tests : missing character set");
plan(59 + (cs_cp1251 ? 10 : 0)); plan(59 + (cs_cp1251 ? 10 : 0));
do_all_tests(); do_all_tests();
return 0; return (exit_status());
} }
/* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. /* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -111,6 +111,6 @@ int main(int, char **) ...@@ -111,6 +111,6 @@ int main(int, char **)
plan(6); plan(6);
MY_INIT("pfs_host-oom-t"); MY_INIT("pfs_host-oom-t");
do_all_tests(); do_all_tests();
return 0; return (exit_status());
} }
/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. /* Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -355,6 +355,11 @@ void test_oom() ...@@ -355,6 +355,11 @@ void test_oom()
rc= init_instruments(& param); rc= init_instruments(& param);
ok(rc == 1, "oom (per thread wait)"); ok(rc == 1, "oom (per thread wait)");
cleanup_sync_class();
cleanup_thread_class();
cleanup_file_class();
cleanup_instruments();
param.m_enabled= true; param.m_enabled= true;
param.m_mutex_class_sizing= 0; param.m_mutex_class_sizing= 0;
param.m_rwlock_class_sizing= 0; param.m_rwlock_class_sizing= 0;
...@@ -432,6 +437,8 @@ void test_oom() ...@@ -432,6 +437,8 @@ void test_oom()
init_event_name_sizing(& param); init_event_name_sizing(& param);
rc= init_instruments(& param); rc= init_instruments(& param);
ok(rc == 1, "oom (thread stages history sizing)"); ok(rc == 1, "oom (thread stages history sizing)");
cleanup_thread_class();
cleanup_instruments(); cleanup_instruments();
param.m_enabled= true; param.m_enabled= true;
...@@ -467,6 +474,9 @@ void test_oom() ...@@ -467,6 +474,9 @@ void test_oom()
init_event_name_sizing(& param); init_event_name_sizing(& param);
rc= init_instruments(& param); rc= init_instruments(& param);
ok(rc == 1, "oom (per thread stages)"); ok(rc == 1, "oom (per thread stages)");
cleanup_stage_class();
cleanup_thread_class();
cleanup_instruments(); cleanup_instruments();
param.m_enabled= true; param.m_enabled= true;
...@@ -502,6 +512,8 @@ void test_oom() ...@@ -502,6 +512,8 @@ void test_oom()
init_event_name_sizing(& param); init_event_name_sizing(& param);
rc= init_instruments(& param); rc= init_instruments(& param);
ok(rc == 1, "oom (thread statements history sizing)"); ok(rc == 1, "oom (thread statements history sizing)");
cleanup_thread_class();
cleanup_instruments(); cleanup_instruments();
param.m_enabled= true; param.m_enabled= true;
...@@ -537,6 +549,9 @@ void test_oom() ...@@ -537,6 +549,9 @@ void test_oom()
init_event_name_sizing(& param); init_event_name_sizing(& param);
rc= init_instruments(& param); rc= init_instruments(& param);
ok(rc == 1, "oom (per thread statements)"); ok(rc == 1, "oom (per thread statements)");
cleanup_statement_class();
cleanup_thread_class();
cleanup_instruments(); cleanup_instruments();
param.m_enabled= true; param.m_enabled= true;
...@@ -572,6 +587,8 @@ void test_oom() ...@@ -572,6 +587,8 @@ void test_oom()
init_event_name_sizing(& param); init_event_name_sizing(& param);
rc= init_instruments(& param); rc= init_instruments(& param);
ok(rc == 1, "oom (global waits)"); ok(rc == 1, "oom (global waits)");
cleanup_sync_class();
cleanup_instruments(); cleanup_instruments();
param.m_enabled= true; param.m_enabled= true;
...@@ -609,8 +626,10 @@ void test_oom() ...@@ -609,8 +626,10 @@ void test_oom()
ok(rc == 0, "init stage class"); ok(rc == 0, "init stage class");
rc= init_instruments(& param); rc= init_instruments(& param);
ok(rc == 1, "oom (global stages)"); ok(rc == 1, "oom (global stages)");
cleanup_instruments();
cleanup_sync_class();
cleanup_stage_class(); cleanup_stage_class();
cleanup_instruments();
param.m_enabled= true; param.m_enabled= true;
param.m_mutex_class_sizing= 10; param.m_mutex_class_sizing= 10;
...@@ -647,8 +666,10 @@ void test_oom() ...@@ -647,8 +666,10 @@ void test_oom()
ok(rc == 0, "init statement class"); ok(rc == 0, "init statement class");
rc= init_instruments(& param); rc= init_instruments(& param);
ok(rc == 1, "oom (global statements)"); ok(rc == 1, "oom (global statements)");
cleanup_instruments();
cleanup_sync_class();
cleanup_statement_class(); cleanup_statement_class();
cleanup_instruments();
} }
void do_all_tests() void do_all_tests()
...@@ -665,6 +686,6 @@ int main(int, char **) ...@@ -665,6 +686,6 @@ int main(int, char **)
plan(20); plan(20);
MY_INIT("pfs_instr-oom-t"); MY_INIT("pfs_instr-oom-t");
do_all_tests(); do_all_tests();
return 0; return (exit_status());
} }
/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. /* Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -23,10 +23,11 @@ ...@@ -23,10 +23,11 @@
#include <memory.h> #include <memory.h>
PFS_global_param param;
void test_no_instruments() void test_no_instruments()
{ {
int rc; int rc;
PFS_global_param param;
memset(& param, 0xFF, sizeof(param)); memset(& param, 0xFF, sizeof(param));
param.m_enabled= true; param.m_enabled= true;
...@@ -86,7 +87,6 @@ void test_no_instances() ...@@ -86,7 +87,6 @@ void test_no_instances()
PFS_file *file; PFS_file *file;
PFS_socket *socket; PFS_socket *socket;
PFS_table *table; PFS_table *table;
PFS_global_param param;
memset(& param, 0xFF, sizeof(param)); memset(& param, 0xFF, sizeof(param));
param.m_enabled= true; param.m_enabled= true;
...@@ -227,7 +227,6 @@ void test_with_instances() ...@@ -227,7 +227,6 @@ void test_with_instances()
PFS_socket *socket_2; PFS_socket *socket_2;
PFS_table *table_1; PFS_table *table_1;
PFS_table *table_2; PFS_table *table_2;
PFS_global_param param;
memset(& param, 0xFF, sizeof(param)); memset(& param, 0xFF, sizeof(param));
param.m_enabled= true; param.m_enabled= true;
...@@ -417,6 +416,6 @@ int main(int, char **) ...@@ -417,6 +416,6 @@ int main(int, char **)
plan(103); plan(103);
MY_INIT("pfs_instr-t"); MY_INIT("pfs_instr-t");
do_all_tests(); do_all_tests();
return 0; return (exit_status());
} }
/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. /* Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -67,6 +67,6 @@ int main(int, char **) ...@@ -67,6 +67,6 @@ int main(int, char **)
plan(9); plan(9);
MY_INIT("pfs_instr_info-oom-t"); MY_INIT("pfs_instr_info-oom-t");
do_all_tests(); do_all_tests();
return 0; return (exit_status());
} }
/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. /* Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -673,6 +673,6 @@ int main(int, char **) ...@@ -673,6 +673,6 @@ int main(int, char **)
plan(181); plan(181);
MY_INIT("pfs_instr_info-t"); MY_INIT("pfs_instr_info-t");
do_all_tests(); do_all_tests();
return 0; return (exit_status());
} }
/* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. /* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -66,6 +66,6 @@ int main(int, char **) ...@@ -66,6 +66,6 @@ int main(int, char **)
plan(2); plan(2);
MY_INIT("pfs_misc-t"); MY_INIT("pfs_misc-t");
do_all_tests(); do_all_tests();
return exit_status(); return (exit_status());
} }
/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved. /* Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -117,6 +117,6 @@ int main(int, char **) ...@@ -117,6 +117,6 @@ int main(int, char **)
plan(5); plan(5);
MY_INIT("pfs_timer-t"); MY_INIT("pfs_timer-t");
do_all_tests(); do_all_tests();
return 0; return (exit_status());
} }
/* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. /* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -110,6 +110,6 @@ int main(int, char **) ...@@ -110,6 +110,6 @@ int main(int, char **)
plan(6); plan(6);
MY_INIT("pfs_user-oom-t"); MY_INIT("pfs_user-oom-t");
do_all_tests(); do_all_tests();
return 0; return (exit_status());
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment