Skip to content

Commit db864cf

Browse files
Paweł Olchawaltangvald
authored andcommitted
BUG#29862057 MEM0MEM-T FAILS BECAUSE OF NON-INITIALIZED INFRASTRUCTURE FOR EVENTS
Unit test mem0mem-t was missing to call os_event_global_init. RB: 22281 (cherry picked from commit 89fcdb7a0a1ca40d4bef5876f90138c780815f8d)
1 parent fd0680d commit db864cf

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

storage/innobase/handler/ha_innodb.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4051,10 +4051,11 @@ innobase_init(
40514051
DBUG_RETURN(HA_ERR_INITIALIZATION);
40524052
}
40534053
# endif /* UNIV_DEBUG */
4054-
os_event_global_init();
40554054

40564055
#endif /* HAVE_PSI_INTERFACE */
40574056

4057+
os_event_global_init();
4058+
40584059
/* Set buffer pool size to default for fast startup when mysqld is
40594060
run with --help --verbose options. */
40604061
ulint srv_buf_pool_size_org = 0;

storage/innobase/os/os0event.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ struct os_event {
253253
enabled for the cond_attr object. */
254254
static bool cond_attr_has_monotonic_clock;
255255
#endif /* !_WIN32 */
256+
static bool global_initialized;
256257

257258
public:
258259
event_iter_t event_iter; /*!< For O(1) removal from
@@ -491,6 +492,7 @@ os_event::wait_time_low(
491492
/** Constructor */
492493
os_event::os_event(const char* name) UNIV_NOTHROW
493494
{
495+
ut_a(global_initialized);
494496
init();
495497

496498
m_set = false;
@@ -619,6 +621,7 @@ os_event_destroy(
619621
pthread_condattr_t os_event::cond_attr;
620622
bool os_event::cond_attr_has_monotonic_clock (false);
621623
#endif /* !_WIN32 */
624+
bool os_event::global_initialized (false);
622625

623626

624627
void os_event_global_init(void) {
@@ -643,9 +646,11 @@ void os_event_global_init(void) {
643646

644647
#endif /* UNIV_LINUX */
645648
#endif /* !_WIN32 */
649+
os_event::global_initialized = true;
646650
}
647651

648652
void os_event_global_destroy(void) {
653+
ut_a(os_event::global_initialized);
649654
#ifndef _WIN32
650655
os_event::cond_attr_has_monotonic_clock = false;
651656
#ifdef UNIV_DEBUG
@@ -654,4 +659,5 @@ void os_event_global_destroy(void) {
654659
pthread_condattr_destroy(&os_event::cond_attr);
655660
ut_ad(ret == 0);
656661
#endif /* !_WIN32 */
662+
os_event::global_initialized = false;
657663
}

unittest/gunit/innodb/mem0mem-t.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2014, 2019, 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
@@ -21,6 +21,7 @@
2121
#include "univ.i"
2222

2323
#include "mem0mem.h"
24+
#include "os0event.h"
2425
#include "srv0conc.h"
2526
#include "srv0srv.h"
2627

@@ -37,13 +38,15 @@ class mem0mem : public ::testing::Test {
3738
SetUpTestCase()
3839
{
3940
srv_max_n_threads = srv_sync_array_size + 1;
41+
os_event_global_init();
4042
sync_check_init();
4143
}
4244
static
4345
void
4446
TearDownTestCase()
4547
{
4648
sync_check_close();
49+
os_event_global_destroy();
4750
}
4851
};
4952

0 commit comments

Comments
 (0)