-
Notifications
You must be signed in to change notification settings - Fork 842
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feature] [tokudb] Issue: #63 Add compression ratio statistics per FT
TokuDB has status to expose the compression ratio: mysql> show global status like 'tokudb%COMPRESSION_RATIO'; +---------------------------------------+----------+ | Variable_name | Value | +---------------------------------------+----------+ | Tokudb_LEAF_NODE_COMPRESSION_RATIO | 5.850260 | | Tokudb_NONLEAF_NODE_COMPRESSION_RATIO | 0.564453 | | Tokudb_OVERALL_NODE_COMPRESSION_RATIO | 4.528809 | +---------------------------------------+----------+ but this a global level ratio, and sometimes the users may be interested in table level compression ratio. This patch address this request by exposing FT level compresstion ratio through information_schema.TokuDB_fractal_tree_info table. We add two columns, leaf_compress_ratio and internal_compress_ratio, which indicate the compression ratio of leaf nodes and internal nodes accordingly. Limitations, the comppression ratio infos are maintained in memeory, and will lost when server is restarted or ft get evicted from memory. Maybe in future there infos will be persisted in ft file, when this feature is accepted by PerconaFT upstream.
- Loading branch information
AliSQL
authored and
AliSQL
committed
May 1, 2018
1 parent
349aa36
commit 4ec960a
Showing
11 changed files
with
118 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
mysql-test/suite/rds/r/tokudb_show_compress_ratio_per_ft.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
create table t1(c1 int) engine = tokudb; | ||
create table t2(c1 int) engine = tokudb; | ||
insert into t1 values (rand()); | ||
select count(*) from t1; | ||
count(*) | ||
3145726 | ||
select count(*) from t2; | ||
count(*) | ||
6291410 | ||
set global tokudb_checkpoint_on_flush_logs=ON; | ||
flush logs; | ||
set global tokudb_checkpoint_on_flush_logs=OFF; | ||
select leaf_compress_ratio > 3, internal_compress_ratio > 1 from information_schema.TokuDB_fractal_tree_info where table_dictionary_name = 'main'; | ||
leaf_compress_ratio > 3 internal_compress_ratio > 1 | ||
1 0 | ||
1 0 | ||
flush tables; | ||
set global tokudb_checkpoint_on_flush_logs=ON; | ||
flush logs; | ||
set global tokudb_checkpoint_on_flush_logs=OFF; | ||
select leaf_compress_ratio > 3, internal_compress_ratio > 1 from information_schema.TokuDB_fractal_tree_info where table_dictionary_name = 'main'; | ||
leaf_compress_ratio > 3 internal_compress_ratio > 1 | ||
1 0 | ||
1 0 | ||
drop table t1; | ||
drop table t2; |
39 changes: 39 additions & 0 deletions
39
mysql-test/suite/rds/t/tokudb_show_compress_ratio_per_ft.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--source include/have_tokudb.inc | ||
--source include/have_innodb.inc | ||
|
||
create table t1(c1 int) engine = tokudb; | ||
create table t2(c1 int) engine = tokudb; | ||
|
||
insert into t1 values (rand()); | ||
|
||
--let $i=0 | ||
--let $count=20 | ||
--disable_query_log | ||
while ($i<$count) | ||
{ | ||
inc $i; | ||
eval insert into t1 values (rand()); | ||
eval insert into t1 select * from t1; | ||
eval insert into t2 select * from t1; | ||
} | ||
--enable_query_log | ||
|
||
select count(*) from t1; | ||
select count(*) from t2; | ||
|
||
# trigger checkpoint | ||
set global tokudb_checkpoint_on_flush_logs=ON; | ||
flush logs; | ||
set global tokudb_checkpoint_on_flush_logs=OFF; | ||
|
||
select leaf_compress_ratio > 3, internal_compress_ratio > 1 from information_schema.TokuDB_fractal_tree_info where table_dictionary_name = 'main'; | ||
flush tables; | ||
|
||
set global tokudb_checkpoint_on_flush_logs=ON; | ||
flush logs; | ||
set global tokudb_checkpoint_on_flush_logs=OFF; | ||
|
||
select leaf_compress_ratio > 3, internal_compress_ratio > 1 from information_schema.TokuDB_fractal_tree_info where table_dictionary_name = 'main'; | ||
|
||
drop table t1; | ||
drop table t2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters