Skip to content

Commit

Permalink
Implemented RocksDB::WriteOptions
Browse files Browse the repository at this point in the history
Summary: Setting WriteOptions through global system variables. The options are read-write. The WriteOptions object is copied for each use to avoid threading issues.

Test Plan:
Ran the test. Observed that sync option turns on and off WAL flushes per transaction (ie SQL statement). Stopped in the gdb and checked that WriteOptions had correct values.

The diff is for this task: MariaDB/webscalesql-5.6#15

Reviewers: mcallaghan, jonah
  • Loading branch information
maykov authored and jtolmer committed Jan 5, 2016
1 parent 3f201cb commit ff7cdbb
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
35 changes: 35 additions & 0 deletions mysql-test/suite/rocksdb/write_sync.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
SET GLOBAL rocksdb_write_disable_wal=false;
SET GLOBAL rocksdb_write_timeout_hint_us=555;
SET GLOBAL rocksdb_write_ignore_missing_column_families=true;
create table aaa (id int primary key, i int) engine rocksdb;
SET GLOBAL rocksdb_write_sync=off;
insert aaa(id, i) values(1,1);
show status like 'rocksdb_wal_synced';
Variable_name Value
rocksdb_wal_synced 1
insert aaa(id, i) values(2,1);
show status like 'rocksdb_wal_synced';
Variable_name Value
rocksdb_wal_synced 1
insert aaa(id, i) values(3,1);
show status like 'rocksdb_wal_synced';
Variable_name Value
rocksdb_wal_synced 1
SET GLOBAL rocksdb_write_sync=on_commit;
insert aaa(id, i) values(4,1);
show status like 'rocksdb_wal_synced';
Variable_name Value
rocksdb_wal_synced 2
insert aaa(id, i) values(5,1);
show status like 'rocksdb_wal_synced';
Variable_name Value
rocksdb_wal_synced 3
insert aaa(id, i) values(6,1);
show status like 'rocksdb_wal_synced';
Variable_name Value
rocksdb_wal_synced 4
drop table aaa;
SET GLOBAL rocksdb_write_sync=off;
SET GLOBAL rocksdb_write_disable_wal=false;
SET GLOBAL rocksdb_write_timeout_hint_us=0;
SET GLOBAL rocksdb_write_ignore_missing_column_families=false;
29 changes: 29 additions & 0 deletions mysql-test/suite/rocksdb/write_sync.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
SET GLOBAL rocksdb_write_disable_wal=false;
SET GLOBAL rocksdb_write_timeout_hint_us=555;
SET GLOBAL rocksdb_write_ignore_missing_column_families=true;

create table aaa (id int primary key, i int) engine rocksdb;

SET GLOBAL rocksdb_write_sync=off;
insert aaa(id, i) values(1,1);
show status like 'rocksdb_wal_synced';
insert aaa(id, i) values(2,1);
show status like 'rocksdb_wal_synced';
insert aaa(id, i) values(3,1);
show status like 'rocksdb_wal_synced';

SET GLOBAL rocksdb_write_sync=on_commit;
insert aaa(id, i) values(4,1);
show status like 'rocksdb_wal_synced';
insert aaa(id, i) values(5,1);
show status like 'rocksdb_wal_synced';
insert aaa(id, i) values(6,1);
show status like 'rocksdb_wal_synced';

# Cleanup
drop table aaa;
SET GLOBAL rocksdb_write_sync=off;
SET GLOBAL rocksdb_write_disable_wal=false;
SET GLOBAL rocksdb_write_timeout_hint_us=0;
SET GLOBAL rocksdb_write_ignore_missing_column_families=false;

0 comments on commit ff7cdbb

Please sign in to comment.