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
35425cfc
Commit
35425cfc
authored
Mar 30, 2022
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup: Remove some unused functions
parent
bdba1d46
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
4 additions
and
279 deletions
+4
-279
sql/ha_partition.h
sql/ha_partition.h
+1
-5
sql/handler.cc
sql/handler.cc
+1
-188
sql/handler.h
sql/handler.h
+1
-85
storage/federatedx/ha_federatedx.cc
storage/federatedx/ha_federatedx.cc
+1
-1
No files found.
sql/ha_partition.h
View file @
35425cfc
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
/*
/*
Copyright (c) 2005, 2012, Oracle and/or its affiliates.
Copyright (c) 2005, 2012, Oracle and/or its affiliates.
Copyright (c) 2009, 202
1
, MariaDB Corporation.
Copyright (c) 2009, 202
2
, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
it under the terms of the GNU General Public License as published by
...
@@ -793,10 +793,6 @@ class ha_partition :public handler
...
@@ -793,10 +793,6 @@ class ha_partition :public handler
NOTE: This cannot be cached since it can depend on TRANSACTION ISOLATION
NOTE: This cannot be cached since it can depend on TRANSACTION ISOLATION
LEVEL which is dynamic, see bug#39084.
LEVEL which is dynamic, see bug#39084.
HA_READ_RND_SAME:
Not currently used. (Means that the handler supports the rnd_same() call)
(MyISAM, HEAP)
HA_TABLE_SCAN_ON_INDEX:
HA_TABLE_SCAN_ON_INDEX:
Used to avoid scanning full tables on an index. If this flag is set then
Used to avoid scanning full tables on an index. If this flag is set then
the handler always has a primary key (hidden if not defined) and this
the handler always has a primary key (hidden if not defined) and this
...
...
sql/handler.cc
View file @
35425cfc
/* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
/* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
Copyright (c) 2009, 20
18
, MariaDB Corporation.
Copyright (c) 2009, 20
22
, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
it under the terms of the GNU General Public License as published by
...
@@ -2531,11 +2531,6 @@ double handler::keyread_time(uint index, uint ranges, ha_rows rows)
...
@@ -2531,11 +2531,6 @@ double handler::keyread_time(uint index, uint ranges, ha_rows rows)
len
*
rows
/
(
stats
.
block_size
+
1
)
/
TIME_FOR_COMPARE
;
len
*
rows
/
(
stats
.
block_size
+
1
)
/
TIME_FOR_COMPARE
;
}
}
void
**
handler
::
ha_data
(
THD
*
thd
)
const
{
return
thd_ha_data
(
thd
,
ht
);
}
THD
*
handler
::
ha_thd
(
void
)
const
THD
*
handler
::
ha_thd
(
void
)
const
{
{
DBUG_ASSERT
(
!
table
||
!
table
->
in_use
||
table
->
in_use
==
current_thd
);
DBUG_ASSERT
(
!
table
||
!
table
->
in_use
||
table
->
in_use
==
current_thd
);
...
@@ -6271,17 +6266,6 @@ void handler::unlock_shared_ha_data()
...
@@ -6271,17 +6266,6 @@ void handler::unlock_shared_ha_data()
mysql_mutex_unlock
(
&
table_share
->
LOCK_ha_data
);
mysql_mutex_unlock
(
&
table_share
->
LOCK_ha_data
);
}
}
/** @brief
Dummy function which accept information about log files which is not need
by handlers
*/
void
signal_log_not_needed
(
struct
handlerton
,
char
*
log_file
)
{
DBUG_ENTER
(
"signal_log_not_needed"
);
DBUG_PRINT
(
"enter"
,
(
"logfile '%s'"
,
log_file
));
DBUG_VOID_RETURN
;
}
void
handler
::
set_lock_type
(
enum
thr_lock_type
lock
)
void
handler
::
set_lock_type
(
enum
thr_lock_type
lock
)
{
{
table
->
reginfo
.
lock_type
=
lock
;
table
->
reginfo
.
lock_type
=
lock
;
...
@@ -6384,177 +6368,6 @@ void ha_fake_trx_id(THD *thd)
...
@@ -6384,177 +6368,6 @@ void ha_fake_trx_id(THD *thd)
#endif
/* WITH_WSREP */
#endif
/* WITH_WSREP */
#ifdef TRANS_LOG_MGM_EXAMPLE_CODE
/*
Example of transaction log management functions based on assumption that logs
placed into a directory
*/
#include <my_dir.h>
#include <my_sys.h>
int
example_of_iterator_using_for_logs_cleanup
(
handlerton
*
hton
)
{
void
*
buffer
;
int
res
=
1
;
struct
handler_iterator
iterator
;
struct
handler_log_file_data
data
;
if
(
!
hton
->
create_iterator
)
return
1
;
/* iterator creator is not supported */
if
((
*
hton
->
create_iterator
)(
hton
,
HA_TRANSACTLOG_ITERATOR
,
&
iterator
)
!=
HA_ITERATOR_OK
)
{
/* error during creation of log iterator or iterator is not supported */
return
1
;
}
while
((
*
iterator
.
next
)(
&
iterator
,
(
void
*
)
&
data
)
==
0
)
{
printf
(
"%s
\n
"
,
data
.
filename
.
str
);
if
(
data
.
status
==
HA_LOG_STATUS_FREE
&&
mysql_file_delete
(
INSTRUMENT_ME
,
data
.
filename
.
str
,
MYF
(
MY_WME
)))
goto
err
;
}
res
=
0
;
err:
(
*
iterator
.
destroy
)(
&
iterator
);
return
res
;
}
/*
Here we should get info from handler where it save logs but here is
just example, so we use constant.
IMHO FN_ROOTDIR ("/") is safe enough for example, because nobody has
rights on it except root and it consist of directories only at lest for
*nix (sorry, can't find windows-safe solution here, but it is only example).
*/
#define fl_dir FN_ROOTDIR
/** @brief
Dummy function to return log status should be replaced by function which
really detect the log status and check that the file is a log of this
handler.
*/
enum
log_status
fl_get_log_status
(
char
*
log
)
{
MY_STAT
stat_buff
;
if
(
mysql_file_stat
(
INSTRUMENT_ME
,
log
,
&
stat_buff
,
MYF
(
0
)))
return
HA_LOG_STATUS_INUSE
;
return
HA_LOG_STATUS_NOSUCHLOG
;
}
struct
fl_buff
{
LEX_STRING
*
names
;
enum
log_status
*
statuses
;
uint32
entries
;
uint32
current
;
};
int
fl_log_iterator_next
(
struct
handler_iterator
*
iterator
,
void
*
iterator_object
)
{
struct
fl_buff
*
buff
=
(
struct
fl_buff
*
)
iterator
->
buffer
;
struct
handler_log_file_data
*
data
=
(
struct
handler_log_file_data
*
)
iterator_object
;
if
(
buff
->
current
>=
buff
->
entries
)
return
1
;
data
->
filename
=
buff
->
names
[
buff
->
current
];
data
->
status
=
buff
->
statuses
[
buff
->
current
];
buff
->
current
++
;
return
0
;
}
void
fl_log_iterator_destroy
(
struct
handler_iterator
*
iterator
)
{
my_free
(
iterator
->
buffer
);
}
/** @brief
returns buffer, to be assigned in handler_iterator struct
*/
enum
handler_create_iterator_result
fl_log_iterator_buffer_init
(
struct
handler_iterator
*
iterator
)
{
MY_DIR
*
dirp
;
struct
fl_buff
*
buff
;
char
*
name_ptr
;
uchar
*
ptr
;
FILEINFO
*
file
;
uint32
i
;
/* to be able to make my_free without crash in case of error */
iterator
->
buffer
=
0
;
if
(
!
(
dirp
=
my_dir
(
fl_dir
,
MYF
(
MY_THREAD_SPECIFIC
))))
{
return
HA_ITERATOR_ERROR
;
}
if
((
ptr
=
(
uchar
*
)
my_malloc
(
ALIGN_SIZE
(
sizeof
(
fl_buff
))
+
((
ALIGN_SIZE
(
sizeof
(
LEX_STRING
))
+
sizeof
(
enum
log_status
)
+
+
FN_REFLEN
+
1
)
*
(
uint
)
dirp
->
number_off_files
),
MYF
(
MY_THREAD_SPECIFIC
)))
==
0
)
{
return
HA_ITERATOR_ERROR
;
}
buff
=
(
struct
fl_buff
*
)
ptr
;
buff
->
entries
=
buff
->
current
=
0
;
ptr
=
ptr
+
(
ALIGN_SIZE
(
sizeof
(
fl_buff
)));
buff
->
names
=
(
LEX_STRING
*
)
(
ptr
);
ptr
=
ptr
+
((
ALIGN_SIZE
(
sizeof
(
LEX_STRING
))
*
(
uint
)
dirp
->
number_off_files
));
buff
->
statuses
=
(
enum
log_status
*
)(
ptr
);
name_ptr
=
(
char
*
)(
ptr
+
(
sizeof
(
enum
log_status
)
*
(
uint
)
dirp
->
number_off_files
));
for
(
i
=
0
;
i
<
(
uint
)
dirp
->
number_off_files
;
i
++
)
{
enum
log_status
st
;
file
=
dirp
->
dir_entry
+
i
;
if
((
file
->
name
[
0
]
==
'.'
&&
((
file
->
name
[
1
]
==
'.'
&&
file
->
name
[
2
]
==
'\0'
)
||
file
->
name
[
1
]
==
'\0'
)))
continue
;
if
((
st
=
fl_get_log_status
(
file
->
name
))
==
HA_LOG_STATUS_NOSUCHLOG
)
continue
;
name_ptr
=
strxnmov
(
buff
->
names
[
buff
->
entries
].
str
=
name_ptr
,
FN_REFLEN
,
fl_dir
,
file
->
name
,
NullS
);
buff
->
names
[
buff
->
entries
].
length
=
(
name_ptr
-
buff
->
names
[
buff
->
entries
].
str
);
buff
->
statuses
[
buff
->
entries
]
=
st
;
buff
->
entries
++
;
}
iterator
->
buffer
=
buff
;
iterator
->
next
=
&
fl_log_iterator_next
;
iterator
->
destroy
=
&
fl_log_iterator_destroy
;
my_dirend
(
dirp
);
return
HA_ITERATOR_OK
;
}
/* An example of a iterator creator */
enum
handler_create_iterator_result
fl_create_iterator
(
enum
handler_iterator_type
type
,
struct
handler_iterator
*
iterator
)
{
switch
(
type
)
{
case
HA_TRANSACTLOG_ITERATOR
:
return
fl_log_iterator_buffer_init
(
iterator
);
default:
return
HA_ITERATOR_UNSUPPORTED
;
}
}
#endif
/*TRANS_LOG_MGM_EXAMPLE_CODE*/
bool
HA_CREATE_INFO
::
check_conflicting_charset_declarations
(
CHARSET_INFO
*
cs
)
bool
HA_CREATE_INFO
::
check_conflicting_charset_declarations
(
CHARSET_INFO
*
cs
)
{
{
if
((
used_fields
&
HA_CREATE_USED_DEFAULT_CHARSET
)
&&
if
((
used_fields
&
HA_CREATE_USED_DEFAULT_CHARSET
)
&&
...
...
sql/handler.h
View file @
35425cfc
...
@@ -783,31 +783,6 @@ typedef bool (stat_print_fn)(THD *thd, const char *type, size_t type_len,
...
@@ -783,31 +783,6 @@ typedef bool (stat_print_fn)(THD *thd, const char *type, size_t type_len,
enum
ha_stat_type
{
HA_ENGINE_STATUS
,
HA_ENGINE_LOGS
,
HA_ENGINE_MUTEX
};
enum
ha_stat_type
{
HA_ENGINE_STATUS
,
HA_ENGINE_LOGS
,
HA_ENGINE_MUTEX
};
extern
MYSQL_PLUGIN_IMPORT
st_plugin_int
*
hton2plugin
[
MAX_HA
];
extern
MYSQL_PLUGIN_IMPORT
st_plugin_int
*
hton2plugin
[
MAX_HA
];
/* Transaction log maintains type definitions */
enum
log_status
{
HA_LOG_STATUS_FREE
=
0
,
/* log is free and can be deleted */
HA_LOG_STATUS_INUSE
=
1
,
/* log can't be deleted because it is in use */
HA_LOG_STATUS_NOSUCHLOG
=
2
/* no such log (can't be returned by
the log iterator status) */
};
/*
Function for signaling that the log file changed its state from
LOG_STATUS_INUSE to LOG_STATUS_FREE
Now it do nothing, will be implemented as part of new transaction
log management for engines.
TODO: implement the function.
*/
void
signal_log_not_needed
(
struct
handlerton
,
char
*
log_file
);
/*
Data of transaction log iterator.
*/
struct
handler_log_file_data
{
LEX_STRING
filename
;
enum
log_status
status
;
};
/*
/*
Definitions for engine-specific table/field/index options in the CREATE TABLE.
Definitions for engine-specific table/field/index options in the CREATE TABLE.
...
@@ -922,46 +897,6 @@ typedef struct st_ha_create_table_option {
...
@@ -922,46 +897,6 @@ typedef struct st_ha_create_table_option {
struct
st_mysql_sys_var
*
var
;
struct
st_mysql_sys_var
*
var
;
}
ha_create_table_option
;
}
ha_create_table_option
;
enum
handler_iterator_type
{
/* request of transaction log iterator */
HA_TRANSACTLOG_ITERATOR
=
1
};
enum
handler_create_iterator_result
{
HA_ITERATOR_OK
,
/* iterator created */
HA_ITERATOR_UNSUPPORTED
,
/* such type of iterator is not supported */
HA_ITERATOR_ERROR
/* error during iterator creation */
};
/*
Iterator structure. Can be used by handler/handlerton for different purposes.
Iterator should be created in the way to point "before" the first object
it iterate, so next() call move it to the first object or return !=0 if
there is nothing to iterate through.
*/
struct
handler_iterator
{
/*
Moves iterator to next record and return 0 or return !=0
if there is no records.
iterator_object will be filled by this function if next() returns 0.
Content of the iterator_object depend on iterator type.
*/
int
(
*
next
)(
struct
handler_iterator
*
,
void
*
iterator_object
);
/*
Free resources allocated by iterator, after this call iterator
is not usable.
*/
void
(
*
destroy
)(
struct
handler_iterator
*
);
/*
Pointer to buffer for the iterator to use.
Should be allocated by function which created the iterator and
destroyed by freed by above "destroy" call
*/
void
*
buffer
;
};
class
handler
;
class
handler
;
class
group_by_handler
;
class
group_by_handler
;
struct
Query
;
struct
Query
;
...
@@ -1223,22 +1158,6 @@ struct handlerton
...
@@ -1223,22 +1158,6 @@ struct handlerton
const
char
*
query
,
uint
query_length
,
const
char
*
query
,
uint
query_length
,
const
char
*
db
,
const
char
*
table_name
);
const
char
*
db
,
const
char
*
table_name
);
/*
Get log status.
If log_status is null then the handler do not support transaction
log information (i.e. log iterator can't be created).
(see example of implementation in handler.cc, TRANS_LOG_MGM_EXAMPLE_CODE)
*/
enum
log_status
(
*
get_log_status
)(
handlerton
*
hton
,
char
*
log
);
/*
Iterators creator.
Presence of the pointer should be checked before using
*/
enum
handler_create_iterator_result
(
*
create_iterator
)(
handlerton
*
hton
,
enum
handler_iterator_type
type
,
struct
handler_iterator
*
fill_this_in
);
void
(
*
abort_transaction
)(
handlerton
*
hton
,
THD
*
bf_thd
,
void
(
*
abort_transaction
)(
handlerton
*
hton
,
THD
*
bf_thd
,
THD
*
victim_thd
,
my_bool
signal
);
THD
*
victim_thd
,
my_bool
signal
);
int
(
*
set_checkpoint
)(
handlerton
*
hton
,
const
XID
*
xid
);
int
(
*
set_checkpoint
)(
handlerton
*
hton
,
const
XID
*
xid
);
...
@@ -3291,15 +3210,13 @@ class handler :public Sql_alloc
...
@@ -3291,15 +3210,13 @@ class handler :public Sql_alloc
inline
int
ha_read_first_row
(
uchar
*
buf
,
uint
primary_key
);
inline
int
ha_read_first_row
(
uchar
*
buf
,
uint
primary_key
);
/**
/**
The following
3
function is only needed for tables that may be
The following
2
function is only needed for tables that may be
internal temporary tables during joins.
internal temporary tables during joins.
*/
*/
virtual
int
remember_rnd_pos
()
virtual
int
remember_rnd_pos
()
{
return
HA_ERR_WRONG_COMMAND
;
}
{
return
HA_ERR_WRONG_COMMAND
;
}
virtual
int
restart_rnd_next
(
uchar
*
buf
)
virtual
int
restart_rnd_next
(
uchar
*
buf
)
{
return
HA_ERR_WRONG_COMMAND
;
}
{
return
HA_ERR_WRONG_COMMAND
;
}
virtual
int
rnd_same
(
uchar
*
buf
,
uint
inx
)
{
return
HA_ERR_WRONG_COMMAND
;
}
virtual
ha_rows
records_in_range
(
uint
inx
,
key_range
*
min_key
,
virtual
ha_rows
records_in_range
(
uint
inx
,
key_range
*
min_key
,
key_range
*
max_key
)
key_range
*
max_key
)
...
@@ -3970,7 +3887,6 @@ class handler :public Sql_alloc
...
@@ -3970,7 +3887,6 @@ class handler :public Sql_alloc
TABLE_SHARE
*
get_table_share
()
{
return
table_share
;
}
TABLE_SHARE
*
get_table_share
()
{
return
table_share
;
}
protected:
protected:
/* Service methods for use by storage engines. */
/* Service methods for use by storage engines. */
void
**
ha_data
(
THD
*
)
const
;
THD
*
ha_thd
(
void
)
const
;
THD
*
ha_thd
(
void
)
const
;
/**
/**
...
...
storage/federatedx/ha_federatedx.cc
View file @
35425cfc
...
@@ -1720,7 +1720,7 @@ ha_rows ha_federatedx::records_in_range(uint inx, key_range *start_key,
...
@@ -1720,7 +1720,7 @@ ha_rows ha_federatedx::records_in_range(uint inx, key_range *start_key,
federatedx_txn
*
ha_federatedx
::
get_txn
(
THD
*
thd
,
bool
no_create
)
federatedx_txn
*
ha_federatedx
::
get_txn
(
THD
*
thd
,
bool
no_create
)
{
{
federatedx_txn
**
txnp
=
(
federatedx_txn
**
)
ha_data
(
thd
);
federatedx_txn
**
txnp
=
(
federatedx_txn
**
)
thd_ha_data
(
thd
,
ht
);
if
(
!*
txnp
&&
!
no_create
)
if
(
!*
txnp
&&
!
no_create
)
*
txnp
=
new
federatedx_txn
();
*
txnp
=
new
federatedx_txn
();
return
*
txnp
;
return
*
txnp
;
...
...
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