mirror of
https://github.com/MariaDB/server.git
synced 2026-05-16 20:07:13 +02:00
5.6.33-79.0
This commit is contained in:
parent
93ab3093cb
commit
d7dc03a267
38 changed files with 2892 additions and 85 deletions
|
|
@ -6781,3 +6781,161 @@ dict_tf_to_row_format_string(
|
|||
return(0);
|
||||
}
|
||||
#endif /* !UNIV_HOTBACKUP */
|
||||
|
||||
/** Insert a records into SYS_ZIP_DICT.
|
||||
@retval DB_SUCCESS if OK
|
||||
@retval dberr_t if the insert failed */
|
||||
UNIV_INTERN
|
||||
dberr_t
|
||||
dict_create_zip_dict(
|
||||
const char* name, /*!< in: zip_dict name */
|
||||
ulint name_len, /*!< in: zip_dict name length*/
|
||||
const char* data, /*!< in: zip_dict data */
|
||||
ulint data_len) /*!< in: zip_dict data length */
|
||||
{
|
||||
dberr_t err = DB_SUCCESS;
|
||||
trx_t* trx;
|
||||
|
||||
ut_ad(name);
|
||||
ut_ad(data);
|
||||
|
||||
rw_lock_x_lock(&dict_operation_lock);
|
||||
dict_mutex_enter_for_mysql();
|
||||
|
||||
trx = trx_allocate_for_background();
|
||||
trx->op_info = "insert zip_dict";
|
||||
trx->dict_operation_lock_mode = RW_X_LATCH;
|
||||
trx_start_if_not_started(trx);
|
||||
|
||||
err = dict_create_add_zip_dict(name, name_len, data, data_len, trx);
|
||||
|
||||
if (err == DB_SUCCESS) {
|
||||
trx_commit_for_mysql(trx);
|
||||
}
|
||||
else {
|
||||
trx->op_info = "rollback of internal trx on zip_dict table";
|
||||
trx_rollback_to_savepoint(trx, NULL);
|
||||
ut_a(trx->error_state == DB_SUCCESS);
|
||||
}
|
||||
trx->op_info = "";
|
||||
trx->dict_operation_lock_mode = 0;
|
||||
trx_free_for_background(trx);
|
||||
|
||||
dict_mutex_exit_for_mysql();
|
||||
rw_lock_x_unlock(&dict_operation_lock);
|
||||
|
||||
return err;
|
||||
}
|
||||
/** Get single compression dictionary id for the given
|
||||
(table id, column pos) pair.
|
||||
@retval DB_SUCCESS if OK
|
||||
@retval DB_RECORD_NOT_FOUND if not found */
|
||||
UNIV_INTERN
|
||||
dberr_t
|
||||
dict_get_dictionary_id_by_key(
|
||||
ulint table_id, /*!< in: table id */
|
||||
ulint column_pos, /*!< in: column position */
|
||||
ulint* dict_id) /*!< out: zip_dict id */
|
||||
{
|
||||
dberr_t err = DB_SUCCESS;
|
||||
trx_t* trx;
|
||||
|
||||
rw_lock_s_lock(&dict_operation_lock);
|
||||
dict_mutex_enter_for_mysql();
|
||||
|
||||
trx = trx_allocate_for_background();
|
||||
trx->op_info = "get zip dict id by composite key";
|
||||
trx->dict_operation_lock_mode = RW_S_LATCH;
|
||||
trx_start_if_not_started(trx);
|
||||
|
||||
err = dict_create_get_zip_dict_id_by_reference(table_id, column_pos,
|
||||
dict_id, trx);
|
||||
|
||||
trx_commit_for_mysql(trx);
|
||||
trx->dict_operation_lock_mode = 0;
|
||||
trx_free_for_background(trx);
|
||||
|
||||
dict_mutex_exit_for_mysql();
|
||||
rw_lock_s_unlock(&dict_operation_lock);
|
||||
|
||||
return err;
|
||||
}
|
||||
/** Get compression dictionary info (name and data) for the given id.
|
||||
Allocates memory in name->str and data->str on success.
|
||||
Must be freed with mem_free().
|
||||
@retval DB_SUCCESS if OK
|
||||
@retval DB_RECORD_NOT_FOUND if not found */
|
||||
UNIV_INTERN
|
||||
dberr_t
|
||||
dict_get_dictionary_info_by_id(
|
||||
ulint dict_id, /*!< in: table name */
|
||||
char** name, /*!< out: dictionary name */
|
||||
ulint* name_len, /*!< out: dictionary name length*/
|
||||
char** data, /*!< out: dictionary data */
|
||||
ulint* data_len) /*!< out: dictionary data length*/
|
||||
{
|
||||
dberr_t err = DB_SUCCESS;
|
||||
trx_t* trx;
|
||||
|
||||
rw_lock_s_lock(&dict_operation_lock);
|
||||
dict_mutex_enter_for_mysql();
|
||||
|
||||
trx = trx_allocate_for_background();
|
||||
trx->op_info = "get zip dict name and data by id";
|
||||
trx->dict_operation_lock_mode = RW_S_LATCH;
|
||||
trx_start_if_not_started(trx);
|
||||
|
||||
err = dict_create_get_zip_dict_info_by_id(dict_id, name, name_len,
|
||||
data, data_len, trx);
|
||||
|
||||
trx_commit_for_mysql(trx);
|
||||
trx->dict_operation_lock_mode = 0;
|
||||
trx_free_for_background(trx);
|
||||
|
||||
dict_mutex_exit_for_mysql();
|
||||
rw_lock_s_unlock(&dict_operation_lock);
|
||||
|
||||
return err;
|
||||
}
|
||||
/** Delete a record in SYS_ZIP_DICT with the given name.
|
||||
@retval DB_SUCCESS if OK
|
||||
@retval DB_RECORD_NOT_FOUND if not found
|
||||
@retval DB_ROW_IS_REFERENCED if in use */
|
||||
UNIV_INTERN
|
||||
dberr_t
|
||||
dict_drop_zip_dict(
|
||||
const char* name, /*!< in: zip_dict name */
|
||||
ulint name_len) /*!< in: zip_dict name length*/
|
||||
{
|
||||
dberr_t err = DB_SUCCESS;
|
||||
trx_t* trx;
|
||||
|
||||
ut_ad(name);
|
||||
|
||||
rw_lock_x_lock(&dict_operation_lock);
|
||||
dict_mutex_enter_for_mysql();
|
||||
|
||||
trx = trx_allocate_for_background();
|
||||
trx->op_info = "delete zip_dict";
|
||||
trx->dict_operation_lock_mode = RW_X_LATCH;
|
||||
trx_start_if_not_started(trx);
|
||||
|
||||
err = dict_create_remove_zip_dict(name, name_len, trx);
|
||||
|
||||
if (err == DB_SUCCESS) {
|
||||
trx_commit_for_mysql(trx);
|
||||
}
|
||||
else {
|
||||
trx->op_info = "rollback of internal trx on zip_dict table";
|
||||
trx_rollback_to_savepoint(trx, NULL);
|
||||
ut_a(trx->error_state == DB_SUCCESS);
|
||||
}
|
||||
trx->op_info = "";
|
||||
trx->dict_operation_lock_mode = 0;
|
||||
trx_free_for_background(trx);
|
||||
|
||||
dict_mutex_exit_for_mysql();
|
||||
rw_lock_x_unlock(&dict_operation_lock);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue