[MDEV-30135] Not a bug: does MariaDB updates mtime (*.ibd and *.frm) after each transaction? Created: 2022-11-30  Updated: 2022-12-19  Resolved: 2022-11-30

Status: Closed
Project: MariaDB Server
Component/s: N/A
Affects Version/s: 10.6.10
Fix Version/s: N/A

Type: Bug Priority: Minor
Reporter: Philippe Assignee: Unassigned
Resolution: Not a Bug Votes: 0
Labels: innodb


 Description   

Hello From France.

*Description*

I am using a backup tool using rsync.

Rsync "quick check" sync every file if size if different or if mtime is different.

However, it happears that files (*.ibd and *.frm) used by MariaDB are not "updated" very ofen (mtime).

I mean, data is up to date inside these files but why MariadDB doesn't update mtime of these files on each commit?

I am quite sure this is not a bug.

So, please send a "RTFM", I will be very happy! ^^



 Comments   
Comment by Daniel Black [ 2022-11-30 ]

Hi from Australia.

a) frm file record the table structure and are only changed on `alter table` and the like.
b) ibd files are updated as innodb applies the redo log which my be a significant time after the transaction took place.

An the most important thing, don't use rsync for backups of database. To backup the database you need to get a complete copy at a single point in time. As such the only time rsync is a sufficient backup if, mariadb is shut down, or mariadb is halted by the operating system (kill -STOP).

Use backups like mariabackup, mariadb-dump. I've even seen some success filesystem snapshots if the filesystem supports this and copy from them.

If you're looking for an indicator if a transaction as been written, a changed GTID (if binary logs are enabled, good for a point-in-time recovery), or for innodb specificly, a lsn status variable.

So the RTFM link requested is https://mariadb.com/kb/en/backup-and-restore-overview/

Please take care of your backups.

And the last important thing. Test a recovery from your backup.

Thanks for using MariaDB. Suggested locations for questions however are listed on https://mariadb.com/kb/en/getting-help-with-mariadb/.

Comment by Daniel Black [ 2022-11-30 ]

Not a bug as requested.

Comment by Philippe [ 2022-12-18 ]

Hello again.

Many, many thanks for your valuable answers!

Long story short: I use rsync when databases are "cold" (MariaDB is stopped) or when a "live" backup (OpenVZ 7) is performed (CRIU saves memory/processes/etc).

But today, when restoring some backups (testing), only rsync with checksum option (reading all files and comparing data) updated *.ibd files (same time, same size).

Sorry to be "dumb" again but, could you tell me when *.ibd files stats are really updated? (filesystem => mtime)

Does "innodb_flush_log_at_trx_commit" have any impact?

As requested previously, I will be very happy (again) if you send me a "RTFM" page! ^^

If the question is really obvious, I'm really sorry to waste your time (please tell me).

Good evening from France to Australia!

Comment by Daniel Black [ 2022-12-19 ]

You're not being dumb, please use one of the suggested locations for questions however are listed on https://mariadb.com/kb/en/getting-help-with-mariadb/. I will notice when its there, I've just got a few other things to do. Its also unclear what the significance of your today restore testing is.

Generated at Thu Feb 08 10:13:55 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.