forked from facebook/mysql-5.6
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MyRocks: Flush memtables on clean shutdown (facebook#127)
Summary: On clean shutdown, memtables were not flushed. This caused data loss, if WAL was disabled. This diff flushes all memtables before calling CancelAllBackgroundWork(). Differential Revision: https://reviews.facebook.net/D52257 fbshipit-source-id: 1c87c632249
- Loading branch information
1 parent
79986a1
commit 82c3727
Showing
4 changed files
with
76 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
DROP TABLE IF EXISTS t1; | ||
create table t1( | ||
id bigint not null primary key, | ||
i1 bigint, #unique | ||
i2 bigint, #repeating | ||
c1 varchar(20), #unique | ||
c2 varchar(20), #repeating | ||
index t1_2(i1) | ||
) engine=rocksdb; | ||
select count(*), sum(id), sum(i1), sum(i2) from t1; | ||
count(*) sum(id) sum(i1) sum(i2) | ||
50000 1250025000 1250025000 124980000 | ||
select count(*), sum(id), sum(i1), sum(i2) from t1; | ||
count(*) sum(id) sum(i1) sum(i2) | ||
50000 1250025000 1250025000 124980000 | ||
drop table t1; |
6 changes: 6 additions & 0 deletions
6
mysql-test/suite/rocksdb/t/insert_optimized_config-master.opt
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,6 @@ | ||
--rocksdb_write_disable_wal=1 | ||
--rocksdb_default_cf_options=write_buffer_size=16k;target_file_size_base=16k;level0_file_num_compaction_trigger=4;level0_slowdown_writes_trigger=256;level0_stop_writes_trigger=256;max_write_buffer_number=16;compression_per_level=kNoCompression;memtable=vector:1024 | ||
--rocksdb_override_cf_options=__system__={memtable=skip_list:16} | ||
--rocksdb_compaction_sequential_deletes=0 | ||
--rocksdb_compaction_sequential_deletes_window=0 | ||
|
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,41 @@ | ||
--source include/have_rocksdb.inc | ||
|
||
--disable_warnings | ||
DROP TABLE IF EXISTS t1; | ||
--enable_warnings | ||
|
||
create table t1( | ||
id bigint not null primary key, | ||
i1 bigint, #unique | ||
i2 bigint, #repeating | ||
c1 varchar(20), #unique | ||
c2 varchar(20), #repeating | ||
index t1_2(i1) | ||
) engine=rocksdb; | ||
|
||
--disable_query_log | ||
set rocksdb_bulk_load=1; | ||
let $i=0; | ||
while ($i<50000) | ||
{ | ||
inc $i; | ||
eval insert t1(id, i1, i2, c1, c2) values($i, $i, $i div 10, $i, $i div 10); | ||
} | ||
set rocksdb_bulk_load=0; | ||
--enable_query_log | ||
|
||
select count(*), sum(id), sum(i1), sum(i2) from t1; | ||
|
||
# reload without load optimized config | ||
let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect; | ||
--exec echo "wait" > $restart_file | ||
--shutdown_server 10 | ||
--source include/wait_until_disconnected.inc | ||
-- exec echo "restart:--rocksdb_write_disable_wal=0 --rocksdb_default_cf_options=write_buffer_size=64k;target_file_size_base=64k;max_bytes_for_level_base=1m;compression_per_level=kNoCompression;" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect | ||
-- enable_reconnect | ||
-- source include/wait_until_connected_again.inc | ||
|
||
select count(*), sum(id), sum(i1), sum(i2) from t1; | ||
|
||
drop table t1; | ||
|
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