Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
eaec266e
Commit
eaec266e
authored
Sep 28, 2014
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
restore and fix wsrep status variables
parent
13af416a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
53 additions
and
94 deletions
+53
-94
sql/mysqld.cc
sql/mysqld.cc
+3
-0
sql/sql_class.cc
sql/sql_class.cc
+0
-2
sql/sql_class.h
sql/sql_class.h
+0
-1
sql/sql_parse.cc
sql/sql_parse.cc
+0
-8
sql/wsrep_mysqld.h
sql/wsrep_mysqld.h
+1
-0
sql/wsrep_var.cc
sql/wsrep_var.cc
+49
-83
No files found.
sql/mysqld.cc
View file @
eaec266e
...
...
@@ -8174,6 +8174,9 @@ SHOW_VAR status_vars[]= {
{
"Uptime"
,
(
char
*
)
&
show_starttime
,
SHOW_SIMPLE_FUNC
},
#ifdef ENABLED_PROFILING
{
"Uptime_since_flush_status"
,(
char
*
)
&
show_flushstatustime
,
SHOW_SIMPLE_FUNC
},
#endif
#ifdef WITH_WSREP
{
"wsrep"
,
(
char
*
)
&
wsrep_show_status
,
SHOW_FUNC
},
#endif
{
NullS
,
NullS
,
SHOW_LONG
}
};
...
...
sql/sql_class.cc
View file @
eaec266e
...
...
@@ -1026,7 +1026,6 @@ THD::THD(bool is_wsrep_applier)
wsrep_retry_query_len
=
0
;
wsrep_retry_command
=
COM_CONNECT
;
wsrep_consistency_check
=
NO_CONSISTENCY_CHECK
;
wsrep_status_vars
=
0
;
wsrep_mysql_replicated
=
0
;
wsrep_TOI_pre_query
=
NULL
;
wsrep_TOI_pre_query_len
=
0
;
...
...
@@ -1635,7 +1634,6 @@ THD::~THD()
mysql_mutex_destroy
(
&
LOCK_wsrep_thd
);
if
(
wsrep_rli
)
delete
wsrep_rli
;
if
(
wsrep_rgi
)
delete
wsrep_rgi
;
if
(
wsrep_status_vars
)
wsrep
->
stats_free
(
wsrep
,
wsrep_status_vars
);
#endif
/* Close connection */
#ifndef EMBEDDED_LIBRARY
...
...
sql/sql_class.h
View file @
eaec266e
...
...
@@ -3767,7 +3767,6 @@ public:
enum
enum_server_command
wsrep_retry_command
;
enum
wsrep_consistency_check_mode
wsrep_consistency_check
;
wsrep_stats_var
*
wsrep_status_vars
;
int
wsrep_mysql_replicated
;
const
char
*
wsrep_TOI_pre_query
;
/* a query to apply before
the actual TOI query */
...
...
sql/sql_parse.cc
View file @
eaec266e
...
...
@@ -5705,14 +5705,6 @@ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables)
else
status_var_add
(
thd
->
status_var
.
rows_sent
,
thd
->
get_sent_row_count
());
#ifdef WITH_WSREP
if
(
thd
->
wsrep_status_vars
)
{
wsrep
->
stats_free
(
wsrep
,
thd
->
wsrep_status_vars
);
thd
->
wsrep_status_vars
=
0
;
}
#endif
return
res
;
}
...
...
sql/wsrep_mysqld.h
View file @
eaec266e
...
...
@@ -86,6 +86,7 @@ extern my_bool wsrep_restart_slave;
extern
my_bool
wsrep_restart_slave_activated
;
extern
my_bool
wsrep_slave_FK_checks
;
extern
my_bool
wsrep_slave_UK_checks
;
extern
ulong
wsrep_running_threads
;
enum
enum_wsrep_OSU_method
{
WSREP_OSU_TOI
,
WSREP_OSU_RSU
};
enum
enum_wsrep_sync_wait
{
...
...
sql/wsrep_var.cc
View file @
eaec266e
...
...
@@ -15,9 +15,9 @@
#include "wsrep_var.h"
#include <sql_plugin.h>
#include <mysqld.h>
#include <sql_class.h>
#include <sql_plugin.h>
#include <set_var.h>
#include <sql_acl.h>
#include "wsrep_priv.h"
...
...
@@ -507,99 +507,65 @@ bool wsrep_desync_update (sys_var *self, THD* thd, enum_var_type type)
return
false
;
}
/*
* Status variables stuff below
*/
static
inline
void
wsrep_assign_to_mysql
(
SHOW_VAR
*
mysql
,
wsrep_stats_var
*
wsrep
)
{
mysql
->
name
=
wsrep
->
name
;
switch
(
wsrep
->
type
)
{
case
WSREP_VAR_INT64
:
mysql
->
value
=
(
char
*
)
&
wsrep
->
value
.
_int64
;
mysql
->
type
=
SHOW_LONGLONG
;
break
;
case
WSREP_VAR_STRING
:
mysql
->
value
=
(
char
*
)
&
wsrep
->
value
.
_string
;
mysql
->
type
=
SHOW_CHAR_PTR
;
break
;
case
WSREP_VAR_DOUBLE
:
mysql
->
value
=
(
char
*
)
&
wsrep
->
value
.
_double
;
mysql
->
type
=
SHOW_DOUBLE
;
break
;
}
}
#if DYNAMIC
// somehow this mysql status thing works only with statically allocated arrays.
static
SHOW_VAR
*
mysql_status_vars
=
NULL
;
static
int
mysql_status_len
=
-
1
;
#else
static
SHOW_VAR
mysql_status_vars
[
512
+
1
];
static
const
int
mysql_status_len
=
512
;
#endif
static
SHOW_VAR
wsrep_status_vars
[]
=
{
{
"connected"
,
(
char
*
)
&
wsrep_connected
,
SHOW_BOOL
},
{
"ready"
,
(
char
*
)
&
wsrep_ready
,
SHOW_BOOL
},
{
"cluster_state_uuid"
,(
char
*
)
&
wsrep_cluster_state_uuid
,
SHOW_CHAR_PTR
},
{
"cluster_conf_id"
,
(
char
*
)
&
wsrep_cluster_conf_id
,
SHOW_LONGLONG
},
{
"cluster_status"
,
(
char
*
)
&
wsrep_cluster_status
,
SHOW_CHAR_PTR
},
{
"cluster_size"
,
(
char
*
)
&
wsrep_cluster_size
,
SHOW_LONG_NOFLUSH
},
{
"local_index"
,
(
char
*
)
&
wsrep_local_index
,
SHOW_LONG_NOFLUSH
},
{
"local_bf_aborts"
,
(
char
*
)
&
wsrep_show_bf_aborts
,
SHOW_SIMPLE_FUNC
},
{
"provider_name"
,
(
char
*
)
&
wsrep_provider_name
,
SHOW_CHAR_PTR
},
{
"provider_version"
,
(
char
*
)
&
wsrep_provider_version
,
SHOW_CHAR_PTR
},
{
"provider_vendor"
,
(
char
*
)
&
wsrep_provider_vendor
,
SHOW_CHAR_PTR
},
{
"thread_count"
,
(
char
*
)
&
wsrep_running_threads
,
SHOW_LONG_NOFLUSH
}
};
static
void
export_wsrep_status_to_mysql
(
THD
*
thd
)
static
int
show_var_cmp
(
const
void
*
var1
,
const
void
*
var2
)
{
int
wsrep_status_len
,
i
;
return
strcasecmp
(((
SHOW_VAR
*
)
var1
)
->
name
,
((
SHOW_VAR
*
)
var2
)
->
name
);
}
thd
->
wsrep_status_vars
=
wsrep
->
stats_get
(
wsrep
);
int
wsrep_show_status
(
THD
*
thd
,
SHOW_VAR
*
var
,
char
*
buff
)
{
uint
i
,
maxi
=
SHOW_VAR_FUNC_BUFF_SIZE
/
sizeof
(
*
var
)
-
1
;
SHOW_VAR
*
v
=
(
SHOW_VAR
*
)
buff
;
if
(
!
thd
->
wsrep_status_vars
)
{
return
;
}
var
->
type
=
SHOW_ARRAY
;
var
->
value
=
buff
;
for
(
wsrep_status_len
=
0
;
thd
->
wsrep_status_vars
[
wsrep_status_len
].
name
!=
NULL
;
wsrep_status_len
++
);
for
(
i
=
0
;
i
<
array_elements
(
wsrep_status_vars
);
i
++
)
*
v
++=
wsrep_status_vars
[
i
];
#if DYNAMIC
if
(
wsrep_status_len
!=
mysql_status_len
)
{
void
*
tmp
=
realloc
(
mysql_status_vars
,
(
wsrep_status_len
+
1
)
*
sizeof
(
SHOW_VAR
));
if
(
!
tmp
)
{
DBUG_ASSERT
(
i
<
maxi
);
sql_print_error
(
"Out of memory for wsrep status variables."
"Number of variables: %d"
,
wsrep_status_len
);
return
;
wsrep_stats_var
*
stats
=
wsrep
->
stats_get
(
wsrep
);
for
(
wsrep_stats_var
*
sv
=
stats
;
i
<
maxi
&&
sv
&&
sv
->
name
;
i
++
,
sv
++
,
v
++
)
{
v
->
name
=
thd
->
strdup
(
sv
->
name
);
switch
(
sv
->
type
)
{
case
WSREP_VAR_INT64
:
v
->
value
=
(
char
*
)
thd
->
memdup
(
&
sv
->
value
.
_int64
,
sizeof
(
longlong
));
v
->
type
=
SHOW_LONGLONG
;
break
;
case
WSREP_VAR_STRING
:
v
->
value
=
thd
->
strdup
(
sv
->
value
.
_string
);
v
->
type
=
SHOW_CHAR
;
break
;
case
WSREP_VAR_DOUBLE
:
v
->
value
=
(
char
*
)
thd
->
memdup
(
&
sv
->
value
.
_double
,
sizeof
(
double
));
v
->
type
=
SHOW_DOUBLE
;
break
;
}
mysql_status_len
=
wsrep_status_len
;
mysql_status_vars
=
(
SHOW_VAR
*
)
tmp
;
DBUG_ASSERT
(
i
<
maxi
);
}
/* @TODO: fix this: */
#else
if
(
mysql_status_len
<
wsrep_status_len
)
wsrep_status_len
=
mysql_status_len
;
#endif
wsrep
->
stats_free
(
wsrep
,
stats
);
for
(
i
=
0
;
i
<
wsrep_status_len
;
i
++
)
wsrep_assign_to_mysql
(
mysql_status_vars
+
i
,
thd
->
wsrep_status_vars
+
i
);
my_qsort
(
buff
,
i
,
sizeof
(
*
v
),
show_var_cmp
);
mysql_status_vars
[
wsrep_status_len
].
name
=
NullS
;
mysql_status_vars
[
wsrep_status_len
].
value
=
NullS
;
mysql_status_vars
[
wsrep_status_len
].
type
=
SHOW_LONG
;
}
int
wsrep_show_status
(
THD
*
thd
,
SHOW_VAR
*
var
,
char
*
buff
)
{
export_wsrep_status_to_mysql
(
thd
);
var
->
type
=
SHOW_ARRAY
;
var
->
value
=
(
char
*
)
&
mysql_status_vars
;
#if 0
{"wsrep_connected", (char*) &wsrep_connected, SHOW_BOOL},
{"wsrep_ready", (char*) &wsrep_ready, SHOW_BOOL},
{"wsrep_cluster_state_uuid", (char*) &wsrep_cluster_state_uuid,SHOW_CHAR_PTR},
{"wsrep_cluster_conf_id", (char*) &wsrep_cluster_conf_id, SHOW_LONGLONG},
{"wsrep_cluster_status", (char*) &wsrep_cluster_status, SHOW_CHAR_PTR},
{"wsrep_cluster_size", (char*) &wsrep_cluster_size, SHOW_LONG_NOFLUSH},
{"wsrep_local_index", (char*) &wsrep_local_index, SHOW_LONG_NOFLUSH},
{"wsrep_local_bf_aborts", (char*) &wsrep_show_bf_aborts, SHOW_SIMPLE_FUNC},
{"wsrep_provider_name", (char*) &wsrep_provider_name, SHOW_CHAR_PTR},
{"wsrep_provider_version", (char*) &wsrep_provider_version, SHOW_CHAR_PTR},
{"wsrep_provider_vendor", (char*) &wsrep_provider_vendor, SHOW_CHAR_PTR},
{"wsrep_thread_count", (char*) &wsrep_running_threads, SHOW_LONG_NOFLUSH},
{"wsrep", (char*) &wsrep_show_status, SHOW_FUNC},
#endif
v
->
name
=
0
;
// terminator
return
0
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment