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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
fa57a72b
Commit
fa57a72b
authored
Jan 14, 2005
by
tomas@poseidon.ndb.mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added support for 'show status like 'Ndb%''
added number_of_replicas printout in show table status
parent
3a75159a
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
81 additions
and
12 deletions
+81
-12
mysql-test/r/ndb_alter_table.result
mysql-test/r/ndb_alter_table.result
+4
-4
mysql-test/r/ndb_autodiscover.result
mysql-test/r/ndb_autodiscover.result
+1
-1
ndb/include/ndbapi/NdbDictionary.hpp
ndb/include/ndbapi/NdbDictionary.hpp
+2
-0
ndb/include/ndbapi/ndb_cluster_connection.hpp
ndb/include/ndbapi/ndb_cluster_connection.hpp
+1
-0
ndb/src/ndbapi/NdbDictionary.cpp
ndb/src/ndbapi/NdbDictionary.cpp
+5
-0
ndb/src/ndbapi/ndb_cluster_connection.cpp
ndb/src/ndbapi/ndb_cluster_connection.cpp
+6
-0
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.cc
+57
-7
sql/ha_ndbcluster.h
sql/ha_ndbcluster.h
+2
-0
sql/mysqld.cc
sql/mysqld.cc
+3
-0
No files found.
mysql-test/r/ndb_alter_table.result
View file @
fa57a72b
...
...
@@ -34,13 +34,13 @@ col5 enum('PENDING', 'ACTIVE', 'DISABLED') not null,
col6 int not null, to_be_deleted int) ENGINE=ndbcluster;
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 ndbcluster 10 Dynamic 0 0 0 0 0 0 1 NULL NULL NULL latin1_swedish_ci NULL
t1 ndbcluster 10 Dynamic 0 0 0 0 0 0 1 NULL NULL NULL latin1_swedish_ci NULL
number_of_replicas: 2
SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
insert into t1 values
(0,4,3,5,"PENDING",1,7),(NULL,4,3,5,"PENDING",1,7),(31,4,3,5,"PENDING",1,7), (7,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7), (100,4,3,5,"PENDING",1,7), (99,4,3,5,"PENDING",1,7), (8,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7);
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 ndbcluster 10 Dynamic 9 96 131072 0 0 0 101 NULL NULL NULL latin1_swedish_ci NULL
t1 ndbcluster 10 Dynamic 9 96 131072 0 0 0 101 NULL NULL NULL latin1_swedish_ci NULL
number_of_replicas: 2
select * from t1 order by col1;
col1 col2 col3 col4 col5 col6 to_be_deleted
0 4 3 5 PENDING 1 7
...
...
@@ -60,7 +60,7 @@ change column col2 fourth varchar(30) not null after col3,
modify column col6 int not null first;
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 ndbcluster 10 Dynamic 9 152 131072 0 0 0 102 NULL NULL NULL latin1_swedish_ci NULL
t1 ndbcluster 10 Dynamic 9 152 131072 0 0 0 102 NULL NULL NULL latin1_swedish_ci NULL
number_of_replicas: 2
select * from t1 order by col1;
col6 col1 col3 fourth col4 col4_5 col5 col7 col8
1 0 3 4 5 PENDING 0000-00-00 00:00:00
...
...
@@ -75,7 +75,7 @@ col6 col1 col3 fourth col4 col4_5 col5 col7 col8
insert into t1 values (2, NULL,4,3,5,99,"PENDING","EXTRA",'2004-01-01 00:00:00');
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 ndbcluster 10 Dynamic 10 152 131072 0 0 0 103 NULL NULL NULL latin1_swedish_ci NULL
t1 ndbcluster 10 Dynamic 10 152 131072 0 0 0 103 NULL NULL NULL latin1_swedish_ci NULL
number_of_replicas: 2
select * from t1 order by col1;
col6 col1 col3 fourth col4 col4_5 col5 col7 col8
1 0 3 4 5 PENDING 0000-00-00 00:00:00
...
...
mysql-test/r/ndb_autodiscover.result
View file @
fa57a72b
...
...
@@ -145,7 +145,7 @@ flush tables;
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t6 MyISAM 9 Fixed 1 260 # # # 0 NULL # # NULL # NULL
t7 ndbcluster 9 Fixed 1 276 # # # 0 NULL # # NULL # NULL
t7 ndbcluster 9 Fixed 1 276 # # # 0 NULL # # NULL # NULL
number_of_replicas: 2
show status like 'handler_discover%';
Variable_name Value
Handler_discover 2
...
...
ndb/include/ndbapi/NdbDictionary.hpp
View file @
fa57a72b
...
...
@@ -715,6 +715,8 @@ public:
int
getRowSizeInBytes
()
const
;
int
createTableInDb
(
Ndb
*
,
bool
existingEqualIsOk
=
true
)
const
;
int
getReplicaCount
()
const
;
#endif
private:
...
...
ndb/include/ndbapi/ndb_cluster_connection.hpp
View file @
fa57a72b
...
...
@@ -86,6 +86,7 @@ public:
void
set_optimized_node_selection
(
int
val
);
unsigned
no_db_nodes
();
unsigned
node_id
();
#endif
private:
...
...
ndb/src/ndbapi/NdbDictionary.cpp
View file @
fa57a72b
...
...
@@ -432,6 +432,11 @@ NdbDictionary::Table::getRowSizeInBytes() const {
return
sz
*
4
;
}
int
NdbDictionary
::
Table
::
getReplicaCount
()
const
{
return
m_impl
.
m_replicaCount
;
}
int
NdbDictionary
::
Table
::
createTableInDb
(
Ndb
*
pNdb
,
bool
equalOk
)
const
{
const
NdbDictionary
::
Table
*
pTab
=
...
...
ndb/src/ndbapi/ndb_cluster_connection.cpp
View file @
fa57a72b
...
...
@@ -183,6 +183,12 @@ Ndb_cluster_connection::no_db_nodes()
return
m_impl
.
m_all_nodes
.
size
();
}
unsigned
Ndb_cluster_connection
::
node_id
()
{
return
m_impl
.
m_transporter_facade
->
ownId
();
}
int
Ndb_cluster_connection
::
wait_until_ready
(
int
timeout
,
...
...
sql/ha_ndbcluster.cc
View file @
fa57a72b
...
...
@@ -105,6 +105,33 @@ struct Ndb_statistics {
Uint64
fragment_memory
;
};
/* Status variables shown with 'show status like 'Ndb%' */
static
long
ndb_cluster_node_id
=
0
;
static
const
char
*
ndb_connected_host
=
0
;
static
long
ndb_connected_port
=
0
;
static
long
ndb_number_of_replicas
=
0
;
static
long
ndb_number_of_storage_nodes
=
0
;
static
int
update_status_variables
(
Ndb_cluster_connection
*
c
)
{
ndb_cluster_node_id
=
c
->
node_id
();
ndb_connected_port
=
c
->
get_connected_port
();
ndb_connected_host
=
c
->
get_connected_host
();
ndb_number_of_replicas
=
0
;
ndb_number_of_storage_nodes
=
c
->
no_db_nodes
();
return
0
;
}
struct
show_var_st
ndb_status_variables
[]
=
{
{
"cluster_node_id"
,
(
char
*
)
&
ndb_cluster_node_id
,
SHOW_LONG
},
{
"connected_host"
,
(
char
*
)
&
ndb_connected_host
,
SHOW_CHAR_PTR
},
{
"connected_port"
,
(
char
*
)
&
ndb_connected_port
,
SHOW_LONG
},
// {"number_of_replicas", (char*) &ndb_number_of_replicas, SHOW_LONG},
{
"number_of_storage_nodes"
,(
char
*
)
&
ndb_number_of_storage_nodes
,
SHOW_LONG
},
{
NullS
,
NullS
,
SHOW_LONG
}
};
/*
Error handling functions
*/
...
...
@@ -4056,6 +4083,8 @@ Thd_ndb* ha_ndbcluster::seize_thd_ndb()
thd_ndb
=
new
Thd_ndb
();
thd_ndb
->
ndb
->
getDictionary
()
->
set_local_table_data_size
(
sizeof
(
Ndb_table_local_info
));
if
(
thd_ndb
->
ndb
->
init
(
max_transactions
)
!=
0
)
{
ERR_PRINT
(
thd_ndb
->
ndb
->
getNdbError
());
...
...
@@ -4381,6 +4410,13 @@ int ndbcluster_find_files(THD *thd,const char *db,const char *path,
a NDB Cluster table handler
*/
/* Call back after cluster connect */
static
int
connect_callback
()
{
update_status_variables
(
g_ndb_cluster_connection
);
return
0
;
}
bool
ndbcluster_init
()
{
int
res
;
...
...
@@ -4410,6 +4446,7 @@ bool ndbcluster_init()
if
((
res
=
g_ndb_cluster_connection
->
connect
(
0
,
0
,
0
))
==
0
)
{
connect_callback
();
DBUG_PRINT
(
"info"
,(
"NDBCLUSTER storage engine at %s on port %d"
,
g_ndb_cluster_connection
->
get_connected_host
(),
g_ndb_cluster_connection
->
get_connected_port
()));
...
...
@@ -4417,7 +4454,7 @@ bool ndbcluster_init()
}
else
if
(
res
==
1
)
{
if
(
g_ndb_cluster_connection
->
start_connect_thread
())
if
(
g_ndb_cluster_connection
->
start_connect_thread
(
connect_callback
))
{
DBUG_PRINT
(
"error"
,
(
"g_ndb_cluster_connection->start_connect_thread()"
));
goto
ndbcluster_init_error
;
...
...
@@ -5285,25 +5322,38 @@ ha_ndbcluster::update_table_comment(
/* out: table comment + additional */
const
char
*
comment
)
/* in: table comment defined by user */
{
return
(
char
*
)
comment
;
#if 0 // for the future
uint
length
=
strlen
(
comment
);
if
(
length
>
64000
-
3
)
{
return
((
char
*
)
comment
);
/* string too long */
}
Ndb
*
ndb
;
if
(
!
(
ndb
=
get_ndb
()))
{
return
((
char
*
)
comment
);
}
ndb
->
setDatabaseName
(
m_dbname
);
NDBDICT
*
dict
=
ndb
->
getDictionary
();
const
NDBTAB
*
tab
;
if
(
!
(
tab
=
dict
->
getTable
(
m_tabname
)))
{
return
((
char
*
)
comment
);
}
char
*
str
;
const char *fmt="%s%s
Row size
: %d";
const unsigned fmt_len_plus_extra= length + strlen(fmt)
+ 3
;
const
char
*
fmt
=
"%s%s
number_of_replicas
: %d"
;
const
unsigned
fmt_len_plus_extra
=
length
+
strlen
(
fmt
);
if
((
str
=
my_malloc
(
fmt_len_plus_extra
,
MYF
(
0
)))
==
NULL
)
{
return
(
char
*
)
comment
;
}
snprintf(str,fmt_len_plus_extra,fmt,comment,10);
snprintf
(
str
,
fmt_len_plus_extra
,
fmt
,
comment
,
length
>
0
?
" "
:
""
,
tab
->
getReplicaCount
());
return
str
;
#endif
}
#endif
/* HAVE_NDBCLUSTER_DB */
sql/ha_ndbcluster.h
View file @
fa57a72b
...
...
@@ -279,6 +279,8 @@ class ha_ndbcluster: public handler
friend
int
execute_no_commit_ie
(
ha_ndbcluster
*
,
NdbTransaction
*
);
};
extern
struct
show_var_st
ndb_status_variables
[];
bool
ndbcluster_init
(
void
);
bool
ndbcluster_end
(
void
);
...
...
sql/mysqld.cc
View file @
fa57a72b
...
...
@@ -5609,6 +5609,9 @@ struct show_var_st status_vars[]= {
SHOW_KEY_CACHE_LONG
},
{
"Last_query_cost"
,
(
char
*
)
&
last_query_cost
,
SHOW_DOUBLE
},
{
"Max_used_connections"
,
(
char
*
)
&
max_used_connections
,
SHOW_LONG
},
#ifdef HAVE_NDBCLUSTER_DB
{
"Ndb_"
,
(
char
*
)
&
ndb_status_variables
,
SHOW_VARS
},
#endif
/*HAVE_NDBCLUSTER_DB*/
{
"Not_flushed_delayed_rows"
,
(
char
*
)
&
delayed_rows_in_use
,
SHOW_LONG_CONST
},
{
"Open_files"
,
(
char
*
)
&
my_file_opened
,
SHOW_LONG_CONST
},
{
"Open_streams"
,
(
char
*
)
&
my_stream_opened
,
SHOW_LONG_CONST
},
...
...
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