Skip to content

Commit 24ff179

Browse files
committed
5.6.36
1 parent c33db2c commit 24ff179

16 files changed

+108
-39
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
SELECT "Digest table has a size 1 and is full already." as use_case;
2+
use_case
3+
Digest table has a size 1 and is full already.
4+
select SCHEMA_NAME, DIGEST, DIGEST_TEXT
5+
from performance_schema.events_statements_summary_by_digest;
6+
SCHEMA_NAME DIGEST DIGEST_TEXT
7+
NULL NULL NULL
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--performance-schema-digests-size=1
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# -----------------------------------------------------------------------
2+
# Tests for the performance schema statement Digests.
3+
# -----------------------------------------------------------------------
4+
5+
--source include/not_embedded.inc
6+
--source include/have_perfschema.inc
7+
--source include/no_protocol.inc
8+
9+
SELECT "Digest table has a size 1 and is full already." as use_case;
10+
11+
select SCHEMA_NAME, DIGEST, DIGEST_TEXT
12+
from performance_schema.events_statements_summary_by_digest;
13+
14+
15+

storage/perfschema/pfs.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3951,9 +3951,11 @@ static PSI_file* end_file_open_wait_v1(PSI_file_locker *locker,
39513951
switch (state->m_operation)
39523952
{
39533953
case PSI_FILE_STAT:
3954+
case PSI_FILE_RENAME:
39543955
break;
39553956
case PSI_FILE_STREAM_OPEN:
39563957
case PSI_FILE_CREATE:
3958+
case PSI_FILE_OPEN:
39573959
if (result != NULL)
39583960
{
39593961
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,
39643966
state->m_file= reinterpret_cast<PSI_file*> (pfs_file);
39653967
}
39663968
break;
3967-
case PSI_FILE_OPEN:
39683969
default:
39693970
DBUG_ASSERT(false);
39703971
break;

storage/perfschema/pfs_digest.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -255,10 +255,11 @@ find_or_create_digest(PFS_thread *thread,
255255
if (safe_index == 0)
256256
{
257257
/* Record [0] is reserved. */
258-
safe_index= 1;
258+
continue;
259259
}
260260

261261
/* Add a new record in digest stat array. */
262+
DBUG_ASSERT(safe_index < digest_max);
262263
pfs= &statements_digest_stat_array[safe_index];
263264

264265
if (pfs->m_lock.is_free())

storage/perfschema/unittest/pfs-t.cc

Lines changed: 35 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -27,6 +27,8 @@
2727
#include "stub_print_error.h"
2828
#include "stub_pfs_defaults.h"
2929

30+
void unload_performance_schema();
31+
3032
/* test helpers, to simulate the setup */
3133

3234
void setup_thread(PSI_thread *t, bool enabled)
@@ -126,7 +128,7 @@ void test_bootstrap()
126128
psi_2= boot->get_interface(PSI_VERSION_2);
127129
ok(psi_2 == NULL, "version 2");
128130

129-
shutdown_performance_schema();
131+
unload_performance_schema();
130132
}
131133

132134
/*
@@ -183,6 +185,28 @@ PSI * load_perfschema()
183185
return (PSI*) psi;
184186
}
185187

188+
void unload_performance_schema()
189+
{
190+
cleanup_table_share();
191+
cleanup_instruments();
192+
cleanup_sync_class();
193+
cleanup_thread_class();
194+
cleanup_table_share();
195+
cleanup_file_class();
196+
cleanup_stage_class();
197+
cleanup_statement_class();
198+
cleanup_socket_class();
199+
cleanup_events_waits_history_long();
200+
cleanup_events_stages_history_long();
201+
cleanup_events_statements_history_long();
202+
cleanup_table_share_hash();
203+
cleanup_file_hash();
204+
cleanup_digest();
205+
PFS_atomic::cleanup();
206+
207+
shutdown_performance_schema();
208+
}
209+
186210
void test_bad_registration()
187211
{
188212
PSI *psi;
@@ -581,8 +605,7 @@ void test_bad_registration()
581605
psi->register_socket("X", bad_socket_3, 1);
582606
ok(dummy_socket_key == 2, "assigned key");
583607

584-
585-
shutdown_performance_schema();
608+
unload_performance_schema();
586609
}
587610

588611
void test_init_disabled()
@@ -1016,7 +1039,7 @@ void test_init_disabled()
10161039
socket_A1= psi->init_socket(99, NULL, NULL, 0);
10171040
ok(socket_A1 == NULL, "broken socket key not instrumented");
10181041

1019-
shutdown_performance_schema();
1042+
unload_performance_schema();
10201043
}
10211044

10221045
void test_locker_disabled()
@@ -1321,8 +1344,9 @@ void test_locker_disabled()
13211344
ok(socket_A1 != NULL, "instrumented");
13221345
/* Socket thread owner has not been set */
13231346
socket_locker= psi->start_socket_wait(&socket_state, socket_A1, PSI_SOCKET_SEND, 12, "foo.cc", 12);
1324-
ok(socket_locker == NULL, "no locker (no thread owner)");
1325-
1347+
ok(socket_locker != NULL, "locker (owner not used)");
1348+
psi->end_socket_wait(socket_locker, 10);
1349+
13261350
/* Pretend the running thread is not instrumented */
13271351
/* ---------------------------------------------- */
13281352

@@ -1350,7 +1374,7 @@ void test_locker_disabled()
13501374
socket_locker= psi->start_socket_wait(&socket_state, socket_A1, PSI_SOCKET_SEND, 12, "foo.cc", 12);
13511375
ok(socket_locker == NULL, "no locker");
13521376

1353-
shutdown_performance_schema();
1377+
unload_performance_schema();
13541378
}
13551379

13561380
void test_file_instrumentation_leak()
@@ -1437,7 +1461,7 @@ void test_file_instrumentation_leak()
14371461
file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_WRITE);
14381462
ok(file_locker == NULL, "no locker, no leak");
14391463

1440-
shutdown_performance_schema();
1464+
unload_performance_schema();
14411465
}
14421466

14431467
void test_enabled()
@@ -1473,7 +1497,7 @@ void test_enabled()
14731497
{ & cond_key_B, "C-B", 0}
14741498
};
14751499

1476-
shutdown_performance_schema();
1500+
unload_performance_schema();
14771501
#endif
14781502
}
14791503

@@ -1642,6 +1666,6 @@ int main(int, char **)
16421666
plan(216);
16431667
MY_INIT("pfs-t");
16441668
do_all_tests();
1645-
return 0;
1669+
return (exit_status());
16461670
}
16471671

storage/perfschema/unittest/pfs_account-oom-t.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -111,6 +111,6 @@ int main(int, char **)
111111
plan(6);
112112
MY_INIT("pfs_account-oom-t");
113113
do_all_tests();
114-
return 0;
114+
return (exit_status());
115115
}
116116

storage/perfschema/unittest/pfs_connect_attr-t.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -341,5 +341,5 @@ int main(int, char **)
341341
diag("skipping the cp1251 tests : missing character set");
342342
plan(59 + (cs_cp1251 ? 10 : 0));
343343
do_all_tests();
344-
return 0;
344+
return (exit_status());
345345
}

storage/perfschema/unittest/pfs_host-oom-t.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -111,6 +111,6 @@ int main(int, char **)
111111
plan(6);
112112
MY_INIT("pfs_host-oom-t");
113113
do_all_tests();
114-
return 0;
114+
return (exit_status());
115115
}
116116

storage/perfschema/unittest/pfs_instr-oom-t.cc

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -355,6 +355,11 @@ void test_oom()
355355
rc= init_instruments(& param);
356356
ok(rc == 1, "oom (per thread wait)");
357357

358+
cleanup_sync_class();
359+
cleanup_thread_class();
360+
cleanup_file_class();
361+
cleanup_instruments();
362+
358363
param.m_enabled= true;
359364
param.m_mutex_class_sizing= 0;
360365
param.m_rwlock_class_sizing= 0;
@@ -432,6 +437,8 @@ void test_oom()
432437
init_event_name_sizing(& param);
433438
rc= init_instruments(& param);
434439
ok(rc == 1, "oom (thread stages history sizing)");
440+
441+
cleanup_thread_class();
435442
cleanup_instruments();
436443

437444
param.m_enabled= true;
@@ -467,6 +474,9 @@ void test_oom()
467474
init_event_name_sizing(& param);
468475
rc= init_instruments(& param);
469476
ok(rc == 1, "oom (per thread stages)");
477+
478+
cleanup_stage_class();
479+
cleanup_thread_class();
470480
cleanup_instruments();
471481

472482
param.m_enabled= true;
@@ -502,6 +512,8 @@ void test_oom()
502512
init_event_name_sizing(& param);
503513
rc= init_instruments(& param);
504514
ok(rc == 1, "oom (thread statements history sizing)");
515+
516+
cleanup_thread_class();
505517
cleanup_instruments();
506518

507519
param.m_enabled= true;
@@ -537,6 +549,9 @@ void test_oom()
537549
init_event_name_sizing(& param);
538550
rc= init_instruments(& param);
539551
ok(rc == 1, "oom (per thread statements)");
552+
553+
cleanup_statement_class();
554+
cleanup_thread_class();
540555
cleanup_instruments();
541556

542557
param.m_enabled= true;
@@ -572,6 +587,8 @@ void test_oom()
572587
init_event_name_sizing(& param);
573588
rc= init_instruments(& param);
574589
ok(rc == 1, "oom (global waits)");
590+
591+
cleanup_sync_class();
575592
cleanup_instruments();
576593

577594
param.m_enabled= true;
@@ -609,8 +626,10 @@ void test_oom()
609626
ok(rc == 0, "init stage class");
610627
rc= init_instruments(& param);
611628
ok(rc == 1, "oom (global stages)");
612-
cleanup_instruments();
629+
630+
cleanup_sync_class();
613631
cleanup_stage_class();
632+
cleanup_instruments();
614633

615634
param.m_enabled= true;
616635
param.m_mutex_class_sizing= 10;
@@ -647,8 +666,10 @@ void test_oom()
647666
ok(rc == 0, "init statement class");
648667
rc= init_instruments(& param);
649668
ok(rc == 1, "oom (global statements)");
650-
cleanup_instruments();
669+
670+
cleanup_sync_class();
651671
cleanup_statement_class();
672+
cleanup_instruments();
652673
}
653674

654675
void do_all_tests()
@@ -665,6 +686,6 @@ int main(int, char **)
665686
plan(20);
666687
MY_INIT("pfs_instr-oom-t");
667688
do_all_tests();
668-
return 0;
689+
return (exit_status());
669690
}
670691

storage/perfschema/unittest/pfs_instr-t.cc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -23,10 +23,11 @@
2323

2424
#include <memory.h>
2525

26+
PFS_global_param param;
27+
2628
void test_no_instruments()
2729
{
2830
int rc;
29-
PFS_global_param param;
3031

3132
memset(& param, 0xFF, sizeof(param));
3233
param.m_enabled= true;
@@ -86,7 +87,6 @@ void test_no_instances()
8687
PFS_file *file;
8788
PFS_socket *socket;
8889
PFS_table *table;
89-
PFS_global_param param;
9090

9191
memset(& param, 0xFF, sizeof(param));
9292
param.m_enabled= true;
@@ -227,7 +227,6 @@ void test_with_instances()
227227
PFS_socket *socket_2;
228228
PFS_table *table_1;
229229
PFS_table *table_2;
230-
PFS_global_param param;
231230

232231
memset(& param, 0xFF, sizeof(param));
233232
param.m_enabled= true;
@@ -417,6 +416,6 @@ int main(int, char **)
417416
plan(103);
418417
MY_INIT("pfs_instr-t");
419418
do_all_tests();
420-
return 0;
419+
return (exit_status());
421420
}
422421

storage/perfschema/unittest/pfs_instr_class-oom-t.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -67,6 +67,6 @@ int main(int, char **)
6767
plan(9);
6868
MY_INIT("pfs_instr_info-oom-t");
6969
do_all_tests();
70-
return 0;
70+
return (exit_status());
7171
}
7272

storage/perfschema/unittest/pfs_instr_class-t.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -673,6 +673,6 @@ int main(int, char **)
673673
plan(181);
674674
MY_INIT("pfs_instr_info-t");
675675
do_all_tests();
676-
return 0;
676+
return (exit_status());
677677
}
678678

0 commit comments

Comments
 (0)