mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Cleanup: Remove some unused functions
This commit is contained in:
189
sql/handler.cc
189
sql/handler.cc
@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
|
||||
Copyright (c) 2009, 2018, MariaDB Corporation.
|
||||
Copyright (c) 2009, 2022, MariaDB Corporation.
|
||||
|
||||
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
|
||||
@ -2531,11 +2531,6 @@ double handler::keyread_time(uint index, uint ranges, ha_rows rows)
|
||||
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
|
||||
{
|
||||
DBUG_ASSERT(!table || !table->in_use || table->in_use == current_thd);
|
||||
@ -6271,17 +6266,6 @@ void handler::unlock_shared_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)
|
||||
{
|
||||
table->reginfo.lock_type= lock;
|
||||
@ -6384,177 +6368,6 @@ void ha_fake_trx_id(THD *thd)
|
||||
#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)
|
||||
{
|
||||
if ((used_fields & HA_CREATE_USED_DEFAULT_CHARSET) &&
|
||||
|
Reference in New Issue
Block a user