[MDEV-25447] MyRocks use "tmpdir" rather than using "rocksdb_tmpdir" for DDL operation Created: 2021-04-19 Updated: 2022-06-21 Resolved: 2022-05-03 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - RocksDB |
| Affects Version/s: | 10.2, 10.3, 10.4, 10.5 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Critical |
| Reporter: | Pramod Mahto | Assignee: | Pramod Mahto |
| Resolution: | Incomplete | Votes: | 1 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
While converting storage engine from InnoDB to ROCKSDB, even after changing rocksdb_tmpdir= <new_path_location> ,its using tmpdir = /tmp location.
|
| Comments |
| Comment by Sergei Petrunia [ 2021-10-04 ] | |||||||||||||||||||||
|
Debugging this:
The execution reaches this point in storage/rocksdb/rdb_index_merge.cc:
Indeed, it is not using m_tmpfile_path... | |||||||||||||||||||||
| Comment by Sergei Petrunia [ 2021-10-04 ] | |||||||||||||||||||||
|
The upstream uses mysql_tmpfile_path, which is not present in MariaDB. mysql_tmpfile_path was introduced by:
It's interesting that InnoDB in MariaDB seems to have innodb_tmpdir. | |||||||||||||||||||||
| Comment by Sergei Petrunia [ 2021-10-04 ] | |||||||||||||||||||||
|
InnoDB's handing of temp files does quite a few checks buy eventually calls create_temp_file():
| |||||||||||||||||||||
| Comment by Sergei Petrunia [ 2021-10-04 ] | |||||||||||||||||||||
|
It seems like it's possible to use create_temp_file . I'd need to have a discussion about this before jumping to implement it. | |||||||||||||||||||||
| Comment by Sergei Petrunia [ 2022-01-21 ] | |||||||||||||||||||||
|
http://lists.askmonty.org/pipermail/commits/2022-January/014865.html serg, could you please review? | |||||||||||||||||||||
| Comment by Sergei Petrunia [ 2022-01-21 ] | |||||||||||||||||||||
|
bb-10.2-mdev25447 | |||||||||||||||||||||
| Comment by Sergei Golubchik [ 2022-01-22 ] | |||||||||||||||||||||
|
Why every engine wants to use it's own tmpdir? And even as a session variable. At least, InnoDB checks that the user has FILE privilege, RocksDB doesn't do even that. I think there should be only one tmpdir, in the server. We can make it modifiable, though, as that seems to be the reason for the proliferation of per-engine tmpdirs. | |||||||||||||||||||||
| Comment by Sergei Petrunia [ 2022-01-23 ] | |||||||||||||||||||||
Is this a rhetorical question or acknowledgment of ones' ignorance? I assume there must be some solid reason as different people seem to have specifically bothered about this: both MyRocks developers (see https://github.com/facebook/mysql-5.6/issues/455) and the customer that has filed the associated support ticket.
I agree that a request to perform permission checks is reasonable. The checking function should probably be at the SQL layer.
Besides tmpdirs, the engines allow one to specify where the data files are placed: see innodb_data_home_dir, rocksdb_datadir, rocksdb_waldir. I assume that performance dictates that engine's tmpdir is located on the same volume as its datadir. Are we going to reject the engine's right to use its own directories? | |||||||||||||||||||||
| Comment by Sergei Golubchik [ 2022-01-24 ] | |||||||||||||||||||||
|
Acknowledgement. I really don't know why and want to understand it. My guess is (see above) that it's because @@tmpdir is read-only and engine developers wanted to be able to modify it. The original bug description seems to imply the same.
1. if one wants to create a new "temporary" table file and then rename it to the non-temporary table name — then yes, but those files are not created in the tmpdir.
No, we have no way of doing it. The engine can do anything it wants, even when it's wrong or bad for the user experience. But we don't have to encourage that. So the question is — is there a good reason for engines to have their own tmpdirs? If yes — we should help them to do it. If not — we should help them not to. | |||||||||||||||||||||
| Comment by Sergei Golubchik [ 2022-01-25 ] | |||||||||||||||||||||
|
pramod.mahto@mariadb.com, why would anyone want to change rocksdb_tmpdir? What is the point of it, what benefits does it have? | |||||||||||||||||||||
| Comment by Sergei Petrunia [ 2022-02-17 ] | |||||||||||||||||||||
|
Note to self: study what tmp files myrocks are created for: and then the engine should create the files eitehr at the datadir (for #1) or at the temp.dir (for #2). Also, for temporary files, one might want to change tmpdir for one specific query (to handle very big queries). This can be fixed by making tmpdir writable (currently, tmpdir is not writable, innodb_tmpdir is writable (with some security checks made), rocksdb_tmpdir is writable (without any checks)). | |||||||||||||||||||||
| Comment by Sergei Golubchik [ 2022-05-06 ] | |||||||||||||||||||||
|
moved the feature to MDEV-28485 |