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
09be96ff
Commit
09be96ff
authored
Aug 05, 2020
by
Kentoku SHIBA
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Spider] Add add checking default_value for default_file, host, port
parent
5585c9f9
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
199 additions
and
24 deletions
+199
-24
storage/spider/spd_db_include.cc
storage/spider/spd_db_include.cc
+24
-3
storage/spider/spd_db_include.h
storage/spider/spd_db_include.h
+3
-0
storage/spider/spd_db_mysql.cc
storage/spider/spd_db_mysql.cc
+42
-0
storage/spider/spd_db_mysql.h
storage/spider/spd_db_mysql.h
+6
-0
storage/spider/spd_direct_sql.cc
storage/spider/spd_direct_sql.cc
+62
-10
storage/spider/spd_table.cc
storage/spider/spd_table.cc
+62
-11
No files found.
storage/spider/spd_db_include.cc
View file @
09be96ff
...
...
@@ -141,21 +141,42 @@ bool spider_db_util::tables_on_different_db_are_joinable()
{
DBUG_ENTER
(
"spider_db_util::tables_on_different_db_are_joinable"
);
DBUG_PRINT
(
"info"
,(
"spider this=%p"
,
this
));
DBUG_RETURN
(
TRU
E
);
DBUG_RETURN
(
FALS
E
);
}
bool
spider_db_util
::
socket_has_default_value
()
{
DBUG_ENTER
(
"spider_db_util::socket_has_default_value"
);
DBUG_PRINT
(
"info"
,(
"spider this=%p"
,
this
));
DBUG_RETURN
(
TRU
E
);
DBUG_RETURN
(
FALS
E
);
}
bool
spider_db_util
::
database_has_default_value
()
{
DBUG_ENTER
(
"spider_db_util::database_has_default_value"
);
DBUG_PRINT
(
"info"
,(
"spider this=%p"
,
this
));
DBUG_RETURN
(
TRUE
);
DBUG_RETURN
(
FALSE
);
}
bool
spider_db_util
::
default_file_has_default_value
()
{
DBUG_ENTER
(
"spider_db_util::default_file_has_default_value"
);
DBUG_PRINT
(
"info"
,(
"spider this=%p"
,
this
));
DBUG_RETURN
(
FALSE
);
}
bool
spider_db_util
::
host_has_default_value
()
{
DBUG_ENTER
(
"spider_db_util::host_has_default_value"
);
DBUG_PRINT
(
"info"
,(
"spider this=%p"
,
this
));
DBUG_RETURN
(
FALSE
);
}
bool
spider_db_util
::
port_has_default_value
()
{
DBUG_ENTER
(
"spider_db_util::port_has_default_value"
);
DBUG_PRINT
(
"info"
,(
"spider this=%p"
,
this
));
DBUG_RETURN
(
FALSE
);
}
bool
spider_db_util
::
append_charset_name_before_string
()
...
...
storage/spider/spd_db_include.h
View file @
09be96ff
...
...
@@ -961,6 +961,9 @@ class spider_db_util
virtual
bool
tables_on_different_db_are_joinable
();
virtual
bool
socket_has_default_value
();
virtual
bool
database_has_default_value
();
virtual
bool
default_file_has_default_value
();
virtual
bool
host_has_default_value
();
virtual
bool
port_has_default_value
();
virtual
bool
append_charset_name_before_string
();
virtual
uint
limit_mode
();
};
...
...
storage/spider/spd_db_mysql.cc
View file @
09be96ff
...
...
@@ -7280,6 +7280,48 @@ int spider_db_mbase_util::append_having(
}
#endif
bool
spider_db_mbase_util
::
tables_on_different_db_are_joinable
()
{
DBUG_ENTER
(
"spider_db_mbase_util::tables_on_different_db_are_joinable"
);
DBUG_PRINT
(
"info"
,(
"spider this=%p"
,
this
));
DBUG_RETURN
(
TRUE
);
}
bool
spider_db_mbase_util
::
socket_has_default_value
()
{
DBUG_ENTER
(
"spider_db_mbase_util::socket_has_default_value"
);
DBUG_PRINT
(
"info"
,(
"spider this=%p"
,
this
));
DBUG_RETURN
(
TRUE
);
}
bool
spider_db_mbase_util
::
database_has_default_value
()
{
DBUG_ENTER
(
"spider_db_mbase_util::database_has_default_value"
);
DBUG_PRINT
(
"info"
,(
"spider this=%p"
,
this
));
DBUG_RETURN
(
TRUE
);
}
bool
spider_db_mbase_util
::
default_file_has_default_value
()
{
DBUG_ENTER
(
"spider_db_mbase_util::default_file_has_default_value"
);
DBUG_PRINT
(
"info"
,(
"spider this=%p"
,
this
));
DBUG_RETURN
(
TRUE
);
}
bool
spider_db_mbase_util
::
host_has_default_value
()
{
DBUG_ENTER
(
"spider_db_mbase_util::host_has_default_value"
);
DBUG_PRINT
(
"info"
,(
"spider this=%p"
,
this
));
DBUG_RETURN
(
TRUE
);
}
bool
spider_db_mbase_util
::
port_has_default_value
()
{
DBUG_ENTER
(
"spider_db_mbase_util::port_has_default_value"
);
DBUG_PRINT
(
"info"
,(
"spider this=%p"
,
this
));
DBUG_RETURN
(
TRUE
);
}
bool
spider_db_mbase_util
::
append_charset_name_before_string
()
{
DBUG_ENTER
(
"spider_db_mbase_util::append_charset_name_before_string"
);
...
...
storage/spider/spd_db_mysql.h
View file @
09be96ff
...
...
@@ -199,6 +199,12 @@ class spider_db_mbase_util: public spider_db_util
spider_string
*
str
);
#endif
bool
tables_on_different_db_are_joinable
();
bool
socket_has_default_value
();
bool
database_has_default_value
();
bool
default_file_has_default_value
();
bool
host_has_default_value
();
bool
port_has_default_value
();
bool
append_charset_name_before_string
();
};
...
...
storage/spider/spd_direct_sql.cc
View file @
09be96ff
...
...
@@ -313,8 +313,14 @@ int spider_udf_direct_sql_create_conn_key(
*
direct_sql
->
conn_key
=
'0'
+
direct_sql
->
connection_channel
;
DBUG_PRINT
(
"info"
,(
"spider tgt_wrapper=%s"
,
direct_sql
->
tgt_wrapper
));
tmp_name
=
strmov
(
direct_sql
->
conn_key
+
1
,
direct_sql
->
tgt_wrapper
);
DBUG_PRINT
(
"info"
,(
"spider tgt_host=%s"
,
direct_sql
->
tgt_host
));
tmp_name
=
strmov
(
tmp_name
+
1
,
direct_sql
->
tgt_host
);
if
(
direct_sql
->
tgt_host
)
{
DBUG_PRINT
(
"info"
,(
"spider tgt_host=%s"
,
direct_sql
->
tgt_host
));
tmp_name
=
strmov
(
tmp_name
+
1
,
direct_sql
->
tgt_host
);
}
else
{
DBUG_PRINT
(
"info"
,(
"spider tgt_host=NULL"
));
tmp_name
++
;
}
my_sprintf
(
port_str
,
(
port_str
,
"%05ld"
,
direct_sql
->
tgt_port
));
DBUG_PRINT
(
"info"
,(
"spider port_str=%s"
,
port_str
));
tmp_name
=
strmov
(
tmp_name
+
1
,
port_str
);
...
...
@@ -1429,8 +1435,14 @@ int spider_udf_set_direct_sql_param_default(
)
{
bool
check_socket
;
bool
check_database
;
bool
check_default_file
;
bool
check_host
;
bool
check_port
;
bool
socket_has_default_value
;
bool
database_has_default_value
;
bool
default_file_has_default_value
;
bool
host_has_default_value
;
bool
port_has_default_value
;
int
error_num
,
roop_count
;
DBUG_ENTER
(
"spider_udf_set_direct_sql_param_default"
);
if
(
direct_sql
->
server_name
)
...
...
@@ -1456,10 +1468,35 @@ int spider_udf_set_direct_sql_param_default(
}
else
{
check_database
=
FALSE
;
}
if
(
check_socket
||
check_database
)
if
(
!
direct_sql
->
tgt_default_file
&&
direct_sql
->
tgt_default_group
&&
(
*
spd_defaults_file
||
*
spd_defaults_extra_file
)
)
{
check_default_file
=
TRUE
;
}
else
{
check_default_file
=
FALSE
;
}
if
(
!
direct_sql
->
tgt_host
)
{
check_host
=
TRUE
;
}
else
{
check_host
=
FALSE
;
}
if
(
direct_sql
->
tgt_port
==
-
1
)
{
check_port
=
TRUE
;
}
else
{
check_port
=
FALSE
;
}
if
(
check_socket
||
check_database
||
check_default_file
||
check_host
||
check_port
)
{
socket_has_default_value
=
check_socket
;
database_has_default_value
=
check_database
;
default_file_has_default_value
=
check_default_file
;
host_has_default_value
=
check_host
;
port_has_default_value
=
check_port
;
if
(
direct_sql
->
tgt_wrapper
)
{
for
(
roop_count
=
0
;
roop_count
<
SPIDER_DBTON_SIZE
;
roop_count
++
)
...
...
@@ -1487,6 +1524,21 @@ int spider_udf_set_direct_sql_param_default(
database_has_default_value
=
spider_dbton
[
roop_count
].
db_util
->
database_has_default_value
();
}
if
(
check_default_file
)
{
default_file_has_default_value
=
spider_dbton
[
roop_count
].
db_util
->
default_file_has_default_value
();
}
if
(
check_host
)
{
host_has_default_value
=
spider_dbton
[
roop_count
].
db_util
->
host_has_default_value
();
}
if
(
check_port
)
{
port_has_default_value
=
spider_dbton
[
roop_count
].
db_util
->
port_has_default_value
();
}
break
;
}
}
...
...
@@ -1495,6 +1547,9 @@ int spider_udf_set_direct_sql_param_default(
}
else
{
socket_has_default_value
=
FALSE
;
database_has_default_value
=
FALSE
;
default_file_has_default_value
=
FALSE
;
host_has_default_value
=
FALSE
;
port_has_default_value
=
FALSE
;
}
if
(
database_has_default_value
)
...
...
@@ -1525,7 +1580,7 @@ int spider_udf_set_direct_sql_param_default(
}
}
if
(
!
direct_sql
->
tgt_host
)
if
(
host_has_default_value
)
{
DBUG_PRINT
(
"info"
,(
"spider create default tgt_host"
));
direct_sql
->
tgt_host_length
=
strlen
(
my_localhost
);
...
...
@@ -1539,11 +1594,8 @@ int spider_udf_set_direct_sql_param_default(
}
}
if
(
!
direct_sql
->
tgt_default_file
&&
direct_sql
->
tgt_default_group
&&
(
*
spd_defaults_file
||
*
spd_defaults_extra_file
)
)
{
if
(
default_file_has_default_value
)
{
DBUG_PRINT
(
"info"
,(
"spider create default tgt_default_file"
));
if
(
*
spd_defaults_extra_file
)
{
...
...
@@ -1574,7 +1626,7 @@ int spider_udf_set_direct_sql_param_default(
direct_sql
->
access_mode
=
0
;
#endif
if
(
direct_sql
->
tgt_port
==
-
1
)
if
(
port_has_default_value
)
{
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
if
(
direct_sql
->
access_mode
==
1
)
...
...
storage/spider/spd_table.cc
View file @
09be96ff
...
...
@@ -3730,8 +3730,14 @@ int spider_set_connect_info_default(
)
{
bool
check_socket
;
bool
check_database
;
bool
check_default_file
;
bool
check_host
;
bool
check_port
;
bool
socket_has_default_value
;
bool
database_has_default_value
;
bool
default_file_has_default_value
;
bool
host_has_default_value
;
bool
port_has_default_value
;
int
error_num
,
roop_count
,
roop_count2
;
DBUG_ENTER
(
"spider_set_connect_info_default"
);
for
(
roop_count
=
0
;
roop_count
<
(
int
)
share
->
all_link_count
;
roop_count
++
)
...
...
@@ -3759,10 +3765,35 @@ int spider_set_connect_info_default(
}
else
{
check_database
=
FALSE
;
}
if
(
check_socket
||
check_database
)
if
(
!
share
->
tgt_default_files
[
roop_count
]
&&
share
->
tgt_default_groups
[
roop_count
]
&&
(
*
spd_defaults_file
||
*
spd_defaults_extra_file
)
)
{
check_default_file
=
TRUE
;
}
else
{
check_default_file
=
FALSE
;
}
if
(
!
share
->
tgt_hosts
[
roop_count
])
{
check_host
=
TRUE
;
}
else
{
check_host
=
FALSE
;
}
if
(
share
->
tgt_ports
[
roop_count
]
==
-
1
)
{
check_port
=
TRUE
;
}
else
{
check_port
=
FALSE
;
}
if
(
check_socket
||
check_database
||
check_default_file
||
check_host
||
check_port
)
{
socket_has_default_value
=
check_socket
;
database_has_default_value
=
check_database
;
default_file_has_default_value
=
check_default_file
;
host_has_default_value
=
check_host
;
port_has_default_value
=
check_port
;
if
(
share
->
tgt_wrappers
[
roop_count
])
{
for
(
roop_count2
=
0
;
roop_count2
<
SPIDER_DBTON_SIZE
;
roop_count2
++
)
...
...
@@ -3790,6 +3821,21 @@ int spider_set_connect_info_default(
database_has_default_value
=
spider_dbton
[
roop_count2
].
db_util
->
database_has_default_value
();
}
if
(
check_default_file
)
{
default_file_has_default_value
=
spider_dbton
[
roop_count2
].
db_util
->
default_file_has_default_value
();
}
if
(
check_host
)
{
host_has_default_value
=
spider_dbton
[
roop_count2
].
db_util
->
host_has_default_value
();
}
if
(
check_port
)
{
port_has_default_value
=
spider_dbton
[
roop_count2
].
db_util
->
port_has_default_value
();
}
break
;
}
}
...
...
@@ -3798,6 +3844,9 @@ int spider_set_connect_info_default(
}
else
{
socket_has_default_value
=
FALSE
;
database_has_default_value
=
FALSE
;
default_file_has_default_value
=
FALSE
;
host_has_default_value
=
FALSE
;
port_has_default_value
=
FALSE
;
}
if
(
!
share
->
tgt_wrappers
[
roop_count
])
...
...
@@ -3813,7 +3862,7 @@ int spider_set_connect_info_default(
}
}
if
(
!
share
->
tgt_hosts
[
roop_count
]
)
if
(
host_has_default_value
)
{
DBUG_PRINT
(
"info"
,(
"spider create default tgt_hosts"
));
share
->
tgt_hosts_lengths
[
roop_count
]
=
strlen
(
my_localhost
);
...
...
@@ -3859,11 +3908,8 @@ int spider_set_connect_info_default(
}
}
if
(
!
share
->
tgt_default_files
[
roop_count
]
&&
share
->
tgt_default_groups
[
roop_count
]
&&
(
*
spd_defaults_file
||
*
spd_defaults_extra_file
)
)
{
if
(
default_file_has_default_value
)
{
DBUG_PRINT
(
"info"
,(
"spider create default tgt_default_files"
));
if
(
*
spd_defaults_extra_file
)
{
...
...
@@ -3934,7 +3980,7 @@ int spider_set_connect_info_default(
}
*/
if
(
share
->
tgt_ports
[
roop_count
]
==
-
1
)
if
(
port_has_default_value
)
{
share
->
tgt_ports
[
roop_count
]
=
MYSQL_PORT
;
}
else
if
(
share
->
tgt_ports
[
roop_count
]
<
0
)
...
...
@@ -4562,9 +4608,14 @@ int spider_create_conn_keys(
DBUG_PRINT
(
"info"
,(
"spider tgt_wrappers[%d]=%s"
,
roop_count
,
share
->
tgt_wrappers
[
roop_count
]));
tmp_name
=
strmov
(
tmp_name
+
1
,
share
->
tgt_wrappers
[
roop_count
]);
DBUG_PRINT
(
"info"
,(
"spider tgt_hosts[%d]=%s"
,
roop_count
,
share
->
tgt_hosts
[
roop_count
]));
tmp_name
=
strmov
(
tmp_name
+
1
,
share
->
tgt_hosts
[
roop_count
]);
if
(
share
->
tgt_hosts
[
roop_count
])
{
DBUG_PRINT
(
"info"
,(
"spider tgt_hosts[%d]=%s"
,
roop_count
,
share
->
tgt_hosts
[
roop_count
]));
tmp_name
=
strmov
(
tmp_name
+
1
,
share
->
tgt_hosts
[
roop_count
]);
}
else
{
tmp_name
++
;
}
my_sprintf
(
port_str
,
(
port_str
,
"%05ld"
,
share
->
tgt_ports
[
roop_count
]));
DBUG_PRINT
(
"info"
,(
"spider port_str=%s"
,
port_str
));
tmp_name
=
strmov
(
tmp_name
+
1
,
port_str
);
...
...
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