Comments (4)
Adding tests for the fix. It is easy to hit HA_READ_PREFIX_LAST_OR_PREV - they are used by min/max optimizer, and by the range scan producing ORDER BY DESC.
It seems to be impossible to hit HA_READ_PREFIX_LAST: It is only used by Loose Index Scan, which is never used for MyRocks tables because of the following chain:
- cost_group_min_max() will always return cur_read_cost=INF to get_best_group_min_max()
- INF comes from tree_traversal_cost (other components have finite values)
- tree_traversal_cost gets it from this
const double tree_traversal_cost=
ceil(log(static_cast<double>(table_records))/
log(static_cast<double>(keys_per_block))) * ROWID_COMPARE_COST;
here, keys_per_block=1
- the value 1 comes from here:
keys_per_block= (table->file->stats.block_size / 2 /
(index_info->key_length + table->file->ref_length)
+ 1);
Since table->file->stats.block_size=0
, we can only get 1.
from mysql-5.6.
Checking what other storage engvines set block_size to.
myisam: myisam_block_size= MI_KEY_BLOCK_LENGTH= 1024
innodb:
#define UNIV_PAGE_SIZE ((ulint) srv_page_size)
srv_page_size=16384
Users of ha_statistics::block_size
- handler::index_only_read_time (the same keys_per_block calculation)
- cost_group_min_max
from mysql-5.6.
Actually, there is a way to get HA_READ_PREFIX_LAST to be called. For many (or all?) engines, MyRocks included, h->index_read_last[_map()] will call index_read(HA_READ_PREFIX_LAST).
#0 0x0000000000fe27ce in ha_rocksdb::index_read_map (this=0x7fffcc1e3110, buf=0x7fffcc1d6280 "\374\001", key=0x7fffcc4f5028 "\001", keypart_map=3, find_flag=HA_READ_PREFIX_LAST) at /home/psergey/dev-git/mysql-5.6-rocksdb-issue16-splitthefix/storage/rocksdb/ha_rocksdb.cc:2891
#1 0x0000000000fe2f22 in ha_rocksdb::index_read_last_map (this=0x7fffcc1e3110, buf=0x7fffcc1d6280 "\374\001", key=0x7fffcc4f5028 "\001", keypart_map=3) at /home/psergey/dev-git/mysql-5.6-rocksdb-issue16-splitthefix/storage/rocksdb/ha_rocksdb.cc:2977
#2 0x0000000000729ec7 in handler::ha_index_read_last_map (this=0x7fffcc1e3110, buf=0x7fffcc1d6280 "\374\001", key=0x7fffcc4f5028 "\001", keypart_map=3) at /home/psergey/dev-git/mysql-5.6-rocksdb-issue16-splitthefix/sql/handler.cc:2939
#3 0x00000000009e6012 in join_read_last_key (tab=0x7fffcc4f4870) at /home/psergey/dev-git/mysql-5.6-rocksdb-issue16-splitthefix/sql/sql_executor.cc:2276
#4 0x00000000009e1b6e in sub_select (join=0x7fffcc006660, join_tab=0x7fffcc4f4870, end_of_records=false) at /home/psergey/dev-git/mysql-5.6-rocksdb-issue16-splitthefix/sql/sql_executor.cc:1294
#5 0x00000000009e0b91 in do_select (join=0x7fffcc006660) at /home/psergey/dev-git/mysql-5.6-rocksdb-issue16-splitthefix/sql/sql_executor.cc:950
#6 0x00000000009dc928 in JOIN::exec (this=0x7fffcc006660) at /home/psergey/dev-git/mysql-5.6-rocksdb-issue16-splitthefix/sql/sql_executor.cc:207
from mysql-5.6.
https://reviews.facebook.net/D35415
from mysql-5.6.
Related Issues (20)
- DROP TABLE may take long time to wait for Seek() by drop_index_thread HOT 1
- UPDATE for table with VARCHAR pk gives "Can't find record" error HOT 5
- UPDATE may hang when it does a full table scan and updates PK values HOT 3
- Add kv_format_version into RDBSE_KEYDEF and data dictionary
- Include RocksDB utility tools into MySQL binary HOT 4
- rocksdb.rocksdb test asserts with message "Failed to get column family info from index id" HOT 8
- SIGSEGV on create table contention HOT 2
- Release Row Locks when necessary, Transaction API variant
- Add more information to SHOW ENGINE ROCKSDB TRANSACTION STATUS
- DML statements over reverse-ordered CFs are very slow after #86. HOT 5
- rocksdb.cardinality and other tests fail assert in rocksdb::port::PthreadCall HOT 23
- Range scan with equal predicates returns wrong results with bloom filter HOT 7
- Possible memory leak in RDBSE_KEYDEF::setup
- background space reclaim isn't working after DROP DATABASE HOT 1
- Enable specifying per column family options without a separate config file
- Add rocksdb-specific tests to parts suite
- Refine checkpoint logic in MyRocks
- Using SingleDelete() in MyRocks
- Reduce rocksdb_sys_vars suite to one test
- Automatically setup bootstrap for rocksdb tests
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mysql-5.6.