| Bug #107858 | truncate table not free mutex in some case | ||
|---|---|---|---|
| Submitted: | 13 Jul 2022 7:14 | Modified: | 22 Aug 2022 19:41 |
| Reporter: | WANG GUANGYOU | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: InnoDB storage engine | Severity: | S3 (Non-critical) |
| Version: | 5.7 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
[13 Jul 2022 12:29]
MySQL Verification Team
Hi Mr. GUANGYOU, Thank you for your bug report.
[13 Jul 2022 12:30]
MySQL Verification Team
Hi Mr. GUANGYOU, Thank you for your bug report. We have discovered that you are correct about your report, but only in the version 5.7. Version 8.0 is totally re-organised in most of its code, including the row truncation. Verified as 5.7-only bug.
[22 Aug 2022 19:41]
Daniel Price
Posted by developer: Fixed as of the upcoming 8.0.31 release: A TRUNCATE TABLE operation failed to free an acquired mutex in specific cases.
[22 Aug 2022 22:40]
Tsubasa Tanaka
> [13 Jul 12:30] MySQL Verification Team says "Verified as 5.7-only bug.", but > Fixed as of the upcoming 8.0.31 release: At last, is this affected both 5.7 and 8.0?

Description: check the code. #################### dberr_t truncate_t::truncate( /*=================*/ ulint space_id, const char* dir_path, const char* tablename, ulint flags, bool trunc_to_default) { dberr_t err = DB_SUCCESS; char* path; bool has_data_dir = FSP_FLAGS_HAS_DATA_DIR(flags); ut_a(!is_system_tablespace(space_id)); if (has_data_dir) { ut_ad(dir_path != NULL); path = fil_make_filepath(dir_path, tablename, IBD, true); } else { path = fil_make_filepath(NULL, tablename, IBD, false); } if (path == NULL) { return(DB_OUT_OF_MEMORY); } ####################################### enter mutex mutex_enter(&fil_system->mutex); fil_space_t* space = fil_space_get_by_id(space_id); /* The following code must change when InnoDB supports multiple datafiles per tablespace. */ ut_a(UT_LIST_GET_LEN(space->chain) == 1); fil_node_t* node = UT_LIST_GET_FIRST(space->chain); if (trunc_to_default) { space->size = node->size = FIL_IBD_FILE_INITIAL_SIZE; } const bool already_open = node->is_open; if (!already_open) { bool ret; node->handle = os_file_create_simple_no_error_handling( innodb_data_file_key, path, OS_FILE_OPEN, OS_FILE_READ_WRITE, fsp_is_system_temporary(space_id) ? false : srv_read_only_mode, &ret); if (!ret) { ib::error() << "Failed to open tablespace file " << path << "."; ut_free(path); ############################ return without exit mutex return(DB_ERROR); } node->is_open = true; } How to repeat: check the code