Skip to content

Commit 8868737

Browse files
janlindstromsysprg
authored andcommitted
MDEV-36527 : Selecting mysql.wsrep_streaming_log incorrectly not allowed when detached
In the get_table_category function, the check for whether a table is a WSREP system table was incorrectly placed. As a result, TABLE_CATEGORY_MYSQL was returned, but user access to tables in this category is not allowed when the server is detached. Fixed by moving the check for whether a table is a WSREP system table inside the section with checks for MySQL schema tables. Its category is now correctly set to TABLE_CATEGORY_INFORMATION, and tables in this category are accessible when detached. Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
1 parent 865b05b commit 8868737

File tree

3 files changed

+4
-9
lines changed

3 files changed

+4
-9
lines changed

sql/table.cc

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -316,12 +316,7 @@ TABLE_CATEGORY get_table_category(const Lex_ident_db &db,
316316
name.streq(TRANSACTION_REG_NAME))
317317
return TABLE_CATEGORY_LOG;
318318

319-
return TABLE_CATEGORY_MYSQL;
320-
}
321-
322319
#ifdef WITH_WSREP
323-
if (db.streq(WSREP_LEX_SCHEMA))
324-
{
325320
if(name.streq(WSREP_LEX_STREAMING))
326321
return TABLE_CATEGORY_INFORMATION;
327322
if (name.streq(WSREP_LEX_CLUSTER))
@@ -330,9 +325,11 @@ TABLE_CATEGORY get_table_category(const Lex_ident_db &db,
330325
return TABLE_CATEGORY_INFORMATION;
331326
if (name.streq(WSREP_LEX_ALLOWLIST))
332327
return TABLE_CATEGORY_INFORMATION;
333-
}
334328
#endif /* WITH_WSREP */
335329

330+
return TABLE_CATEGORY_MYSQL;
331+
}
332+
336333
return TABLE_CATEGORY_USER;
337334
}
338335

sql/wsrep_schema.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
#define WSREP_MEMBERS_TABLE "wsrep_cluster_members"
4444
#define WSREP_ALLOWLIST_TABLE "wsrep_allowlist"
4545

46-
LEX_CSTRING WSREP_LEX_SCHEMA= {STRING_WITH_LEN(WSREP_SCHEMA)};
4746
LEX_CSTRING WSREP_LEX_STREAMING= {STRING_WITH_LEN(WSREP_STREAMING_TABLE)};
4847
LEX_CSTRING WSREP_LEX_CLUSTER= {STRING_WITH_LEN(WSREP_CLUSTER_TABLE)};
4948
LEX_CSTRING WSREP_LEX_MEMBERS= {STRING_WITH_LEN(WSREP_MEMBERS_TABLE)};

sql/wsrep_schema.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (C) 2015-2024 Codership Oy <info@codership.com>
1+
/* Copyright (C) 2015-2025 Codership Oy <info@codership.com>
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
@@ -172,7 +172,6 @@ class Wsrep_schema
172172

173173
extern Wsrep_schema* wsrep_schema;
174174

175-
extern LEX_CSTRING WSREP_LEX_SCHEMA;
176175
extern LEX_CSTRING WSREP_LEX_STREAMING;
177176
extern LEX_CSTRING WSREP_LEX_CLUSTER;
178177
extern LEX_CSTRING WSREP_LEX_MEMBERS;

0 commit comments

Comments
 (0)