[MDEV-18235] Changes related to fsync() Created: 2019-01-14  Updated: 2019-01-25  Resolved: 2019-01-25

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Fix Version/s: 10.4.3, 10.2.22, 10.3.13

Type: Task Priority: Major
Reporter: Eugene Kosov (Inactive) Assignee: Eugene Kosov (Inactive)
Resolution: Fixed Votes: 0
Labels: None

Attachments: File bench.svg    

 Description   

Various changes in fil. Mostly code simplification.



 Comments   
Comment by Eugene Kosov (Inactive) [ 2019-01-15 ]

Flame graph for this test:

create table table_names (
  id int primary key auto_increment,
  name varchar(255)
) engine=innodb;
 
 
insert into table_names values (1, 't1');
 
let $counter = 1;
while ($counter <= 10000) {
 
  let $id = `select max(id) + 1 from table_names`;
 
  eval
  insert into table_names (name) values (concat('t', convert($id, char)));
 
  inc $counter;
}
 
let $data_size = `select count(*) from table_names`;
 
let $counter = 1;
while ($counter <= $data_size) {
  let $table_name = `select name from table_names where id = $counter`;
 
  eval
  create table $table_name (i int) engine=innodb;
 
  eval
  insert into $table_name values (1), (2), (3), (4), (5);
 
  inc $counter;
}
 
let $counter = 1;
while ($counter <= $data_size) {
  let $table_name = `select name from table_names where id = $counter`;
 
  eval
  update $table_name set i = i + 1;
 
  inc $counter;
}
 
let $counter = 1;
while ($counter <= $data_size) {
  let $table_name = `select name from table_names where id = $counter`;
 
  eval
  drop table $table_name;
 
  inc $counter;
}
 
 
drop table table_names;

It's hard to see fil in this graph. And it's hard to see the impact of a patch.

Comment by Eugene Kosov (Inactive) [ 2019-01-23 ]

Benchmark results was added to PR, so I'm requesting another round of review.

Comment by Marko Mäkelä [ 2019-01-25 ]

I did some additional research, and did not find any evidence that fsync() would not be thread-safe on any POSIX-compliant file system.

Maybe we should consider using the asynchronous I/O interface in the future, that is, IOCB_CMD_FSYNC instead of fsync() or IOCB_CMD_FDSYNC instead of fdatasync().

Comment by Eugene Kosov (Inactive) [ 2019-01-25 ]

http://pubs.opengroup.org/onlinepubs/007904975/

2.9.1 Thread-Safety
All functions defined by this volume of IEEE Std 1003.1-2001 shall be thread-safe, except that the following functions1 need not be thread-safe.

Thus, fsync() shall be thread-safe by POSIX.

Generated at Thu Feb 08 08:42:31 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.