public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* new database files not compressed
@ 2020-08-30  9:35 Hamish Moffatt
  2020-08-31  2:20 ` Eric Wong
                   ` (2 more replies)
  0 siblings, 3 replies; 31+ messages in thread
From: Hamish Moffatt @ 2020-08-30  9:35 UTC (permalink / raw)
  To: linux-btrfs

I am trying to store Firebird database files compressed on btrfs. 
Although I have mounted the file system with -o compress-force, new 
files created by Firebird are not being compressed according to 
compsize. If I copy them, or use btrfs filesystem defrag, they compress 
well.

Other files seem to be compressed automatically OK. Why are the Firebird 
files different?


$ uname -a
Linux packer-debian-10-amd64 5.7.0-3-amd64 #1 SMP Debian 5.7.17-1 
(2020-08-23) x86_64 GNU/Linux

$ sudo mkfs.btrfs -m single -f /dev/sdb
btrfs-progs v4.20.1
See http://btrfs.wiki.kernel.org for more information.

Label:              (null)
UUID:               949f7f3f-681b-40fb-97b9-522756d5d619
Node size:          16384
Sector size:        4096
Filesystem size:    29.98GiB
Block group profiles:
   Data:             single            8.00MiB
   Metadata:         single            8.00MiB
   System:           single            4.00MiB
SSD detected:       no
Incompat features:  extref, skinny-metadata
Number of devices:  1
Devices:
    ID        SIZE  PATH
     1    29.98GiB  /dev/sdb

$ sudo mount -o compress-force /dev/sdb /mnt/test
$ sudo mkdir /mnt/test/db
$ cd /mnt/test/db

Now I restore a backup to create a database:

$ zcat ~/*.zip | gbak -REP stdin test.fdb
$ sudo compsize test.fdb
Type       Perc     Disk Usage   Uncompressed Referenced
TOTAL      100%      182M         182M         175M
none       100%      182M         182M         175M
$ cat test.fdb > test2.fdb
$ sudo compsize test2.fdb
Type       Perc     Disk Usage   Uncompressed Referenced
TOTAL       10%       18M         175M         175M
zlib        10%       18M         175M         175M


The same thing occurs if I create a brand new database:

$ isql-fb
Use CONNECT or CREATE DATABASE to specify a database
SQL> create database 'test3.fdb';
SQL> ^D$
$ sync
$ sudo compsize test3.fdb
Type       Perc     Disk Usage   Uncompressed Referenced
TOTAL      100%      784K         784K         784K
none       100%      784K         784K         784K
$ cp test3.fdb test4.fdb
$ sync
$ sudo compsize test4.fdb
Type       Perc     Disk Usage   Uncompressed Referenced
TOTAL        7%       60K         784K         784K
zlib         7%       60K         784K         784K


If I create a database with SQLite it is compressed:


$ cat test.sql
create table test ( id integer primary key asc autoincrement, timestamp 
text default (datetime()), data text);
$ sqlite3 foo.db < test.sql
$ sudo compsize foo.db
Type       Perc     Disk Usage   Uncompressed Referenced
TOTAL       33%      4.0K          12K          12K
zlib        33%      4.0K          12K          12K


I ran isql-fb in strace to see if there is something special in the 
open(2) flags;


$ strace -o trace isql-fb
Use CONNECT or CREATE DATABASE to specify a database
SQL> create database 'new.fdb';
SQL> ^D$
$ grep new.fdb trace
readlink("/mnt/test/db/new.fdb", 0x7ffd9cf70810, 4096) = -1 ENOENT (No 
such file or directory)
stat("/mnt/test/db/new.fdb", 0x7ffd9cf705b0) = -1 ENOENT (No such file 
or directory)
stat("/mnt/test/db/new.fdb", 0x7ffd9cf71480) = -1 ENOENT (No such file 
or directory)
stat("/mnt/test/db/new.fdb", 0x7ffd9cf70e40) = -1 ENOENT (No such file 
or directory)
openat(AT_FDCWD, "/mnt/test/db/new.fdb", O_RDWR) = -1 ENOENT (No such 
file or directory)
openat(AT_FDCWD, "/mnt/test/db/new.fdb", O_RDONLY) = -1 ENOENT (No such 
file or directory)
readlink("/mnt/test/db/new.fdb", 0x7ffd9cf70800, 4096) = -1 ENOENT (No 
such file or directory)
stat("/mnt/test/db/new.fdb", 0x7ffd9cf705a0) = -1 ENOENT (No such file 
or directory)
stat("/mnt/test/db/new.fdb", 0x7ffd9cf71470) = -1 ENOENT (No such file 
or directory)
stat("/mnt/test/db/new.fdb", 0x7ffd9cf70dc0) = -1 ENOENT (No such file 
or directory)
stat("/mnt/test/db/new.fdb", 0x7ffd9cf70eb0) = -1 ENOENT (No such file 
or directory)
openat(AT_FDCWD, "/mnt/test/db/new.fdb", O_RDWR|O_CREAT|O_EXCL, 0666) = 6
readlink("/mnt/test/db/new.fdb", 0x7ffd9cf6ff00, 4096) = -1 EINVAL 
(Invalid argument)




thanks

Hamish


^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2020-09-05  4:07 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-30  9:35 new database files not compressed Hamish Moffatt
2020-08-31  2:20 ` Eric Wong
2020-08-31  2:44   ` Hamish Moffatt
2020-08-31  3:15   ` A L
2020-08-31  3:47 ` Zygo Blaxell
2020-08-31  8:53   ` Hamish Moffatt
2020-08-31  9:25     ` Nikolay Borisov
2020-08-31 10:40       ` Hamish Moffatt
2020-08-31 10:47         ` Nikolay Borisov
2020-08-31 12:56           ` Hamish Moffatt
2020-08-31 11:15     ` Roman Mamedov
2020-08-31 12:54       ` Hamish Moffatt
2020-08-31 12:57         ` Nikolay Borisov
2020-08-31 23:50           ` Hamish Moffatt
2020-09-01  5:15             ` Nikolay Borisov
2020-09-01  8:55               ` Hamish Moffatt
2020-09-02  0:32                 ` Hamish Moffatt
2020-09-02  5:57                   ` Nikolay Borisov
2020-09-02  6:05                     ` Hamish Moffatt
2020-09-02  6:10                       ` Nikolay Borisov
2020-09-02  9:57                     ` A L
2020-09-02 10:09                       ` Nikolay Borisov
2020-09-03 15:04                         ` A L
2020-09-02 16:16                       ` Zygo Blaxell
2020-09-03 12:53                         ` Hamish Moffatt
2020-09-03 19:44                           ` Zygo Blaxell
2020-09-04  8:07                             ` Hamish Moffatt
2020-09-05  4:07                               ` Zygo Blaxell
2020-09-03 15:03                         ` A L
2020-09-03 21:52                           ` Zygo Blaxell
2020-09-01  1:43 ` Chris Murphy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox