stonedb icon indicating copy to clipboard operation
stonedb copied to clipboard

bug: Field "a$1、$b、c$" insert value, no query result

Open shangyanwen opened this issue 3 years ago • 3 comments

Describe the problem

1、create database mysqltest;
2、create table mysqltest.$test1 (a$1 int, $b int, c$ int)engine=stonedb;
3、insert into mysqltest.$test1 values (1,2,3);
4、select a$1, $b, c$ from mysqltest.$test1;
Empty set (0.00 sec)

Expected behavior

select a$1, $b, c$ from mysqltest.$test11;
+------+------+------+
| a$1  | $b   | c$   |
+------+------+------+
|    1 |    2 |    3 |
+------+------+------+
1 row in set (0.00 sec)

How To Reproduce

1、create database mysqltest;
2、create table mysqltest.$test1 (a$1 int, $b int, c$ int)engine=stonedb;
3、insert into mysqltest.$test1 values (1,2,3);
4、select a$1, $b, c$ from mysqltest.$test1;

Environment

  1. StoneDB for mysql5.7
  2. Ubuntu 20.04.4

Are you interested in submitting a PR to solve the problem?

  • [ ] Yes, I will!

shangyanwen avatar Jul 14 '22 08:07 shangyanwen

Insert data process, rocksdb returns success. stonedb stack

rocksdb::DBImpl::WriteImpl(rocksdb::DBImpl * const this, const rocksdb::WriteOptions & write_options, rocksdb::WriteBatch * my_batch, rocksdb::WriteCallback * callback, uint64_t * log_used, uint64_t log_ref, bool disable_memtable, uint64_t * seq_used, size_t batch_cnt, rocksdb::PreReleaseCallback * pre_release_callback) (\opt\prepare\rocksdb-6.12.6\db\db_impl\db_impl_write.cc:124)
rocksdb::DBImpl::Write(rocksdb::DBImpl * const this,  write_options, rocksdb::WriteBatch * my_batch) (\opt\prepare\rocksdb-6.12.6\db\db_impl\db_impl_write.cc:53)
stonedb::index::KVStore::KVWriteBatch(stonedb::index::KVStore * const this, rocksdb::WriteOptions & wopts, rocksdb::WriteBatch * batch) (\opt\lth\stonedb\storage\stonedb\index\kv_store.cpp:254)
stonedb::index::KVTransaction::Commit(stonedb::index::KVTransaction * const this) (\opt\lth\stonedb\storage\stonedb\index\kv_transaction.cpp:101)
stonedb::core::RCMemTable::InsertRow(stonedb::core::RCMemTable * const this, std::unique_ptr<char [], std::default_delete<char []> > buf, uint32_t size) (\opt\lth\stonedb\storage\stonedb\core\rc_mem_table.cpp:132)
stonedb::core::RCTable::InsertMemRow(stonedb::core::RCTable * const this, std::unique_ptr<char [], std::default_delete<char []> > buf, uint32_t size) (\opt\lth\stonedb\storage\stonedb\core\rc_table.cpp:1258)
stonedb::core::Engine::InsertMemRow(stonedb::core::Engine * const this, const std::string & table_path, std::shared_ptr<stonedb::core::TableShare> & share, TABLE * table) (\opt\lth\stonedb\storage\stonedb\core\engine.cpp:1423)
stonedb::core::Engine::InsertRow(stonedb::core::Engine * const this, const std::string & table_path, stonedb::core::Transaction * trans, TABLE * table, std::shared_ptr<stonedb::core::TableShare> & share) (\opt\lth\stonedb\storage\stonedb\core\engine.cpp:1432)
stonedb::dbhandler::StonedbHandler::write_row(stonedb::dbhandler::StonedbHandler * const this, uchar * buf) (\opt\lth\stonedb\storage\stonedb\handler\stonedb_handler.cpp:421)
handler::ha_write_row(handler * const this, uchar * buf) (\opt\lth\stonedb\sql\handler.cc:8188)
write_record(THD * thd, TABLE * table, COPY_INFO * info, COPY_INFO * update) (\opt\lth\stonedb\sql\sql_insert.cc:1902)
Sql_cmd_insert::mysql_insert(Sql_cmd_insert * const this, THD * thd, TABLE_LIST * table_list) (\opt\lth\stonedb\sql\sql_insert.cc:776)
Sql_cmd_insert::execute(Sql_cmd_insert * const this, THD * thd) (\opt\lth\stonedb\sql\sql_insert.cc:3149)
mysql_execute_command(THD * thd, bool first_level) (\opt\lth\stonedb\sql\sql_parse.cc:3619)
mysql_parse(THD * thd, Parser_state * parser_state) (\opt\lth\stonedb\sql\sql_parse.cc:5621)
dispatch_command(THD * thd, const COM_DATA * com_data, enum_server_command command) (\opt\lth\stonedb\sql\sql_parse.cc:1495)
do_command(THD * thd) (\opt\lth\stonedb\sql\sql_parse.cc:1034)
handle_connection(void * arg) (\opt\lth\stonedb\sql\conn_handler\connection_handler_per_thread.cc:313)
pfs_spawn_thread(void * arg) (\opt\lth\stonedb\storage\perfschema\pfs.cc:2197)
libpthread.so.0!start_thread (未知源:0)

lylth avatar Jul 24 '22 08:07 lylth

There is an exception in the rocksdb AsyncDropData process.

StripeRep(rocksdb::SequenceNumber lower_bound, rocksdb::SequenceNumber upper_bound, const rocksdb::InternalKeyComparator * icmp, rocksdb::RangeDelAggregator::StripeRep * const this) (\opt\prepare\rocksdb-6.12.6\db\range_del_aggregator.h:311)
ReadRangeDelAggregator(rocksdb::SequenceNumber upper_bound, const rocksdb::InternalKeyComparator * icmp, rocksdb::ReadRangeDelAggregator * const this) (\opt\prepare\rocksdb-6.12.6\db\range_del_aggregator.h:359)
rocksdb::DBIter::DBIter(rocksdb::DBIter * const this, rocksdb::Env * _env, const rocksdb::ReadOptions & read_options, const rocksdb::ImmutableCFOptions & cf_options, const rocksdb::MutableCFOptions & mutable_cf_options, const rocksdb::Comparator * cmp, rocksdb::InternalIterator * iter, rocksdb::SequenceNumber s, bool arena_mode, uint64_t max_sequential_skip_in_iterations, rocksdb::ReadCallback * read_callback, rocksdb::DBImpl * db_impl, rocksdb::ColumnFamilyData * cfd, bool allow_blob) (\opt\prepare\rocksdb-6.12.6\db\db_iter.cc:77)
rocksdb::ArenaWrappedDBIter::Init(rocksdb::ArenaWrappedDBIter * const this, rocksdb::Env * env, const rocksdb::ReadOptions & read_options, const rocksdb::ImmutableCFOptions & cf_options, const rocksdb::MutableCFOptions & mutable_cf_options, const rocksdb::SequenceNumber & sequence, uint64_t max_sequential_skip_in_iteration, uint64_t version_number, rocksdb::ReadCallback * read_callback, rocksdb::DBImpl * db_impl, rocksdb::ColumnFamilyData * cfd, bool allow_blob, bool allow_refresh) (\opt\prepare\rocksdb-6.12.6\db\arena_wrapped_db_iter.cc:46)
rocksdb::NewArenaWrappedDbIterator(rocksdb::Env * env, const rocksdb::ReadOptions & read_options, const rocksdb::ImmutableCFOptions & cf_options, const rocksdb::MutableCFOptions & mutable_cf_options, const rocksdb::SequenceNumber & sequence, unsigned long max_sequential_skip_in_iterations, uint64_t version_number, rocksdb::ReadCallback * read_callback, rocksdb::DBImpl * db_impl, rocksdb::ColumnFamilyData * cfd, bool allow_blob, bool allow_refresh) (\opt\prepare\rocksdb-6.12.6\db\arena_wrapped_db_iter.cc:97)
rocksdb::DBImpl::NewIteratorImpl(rocksdb::DBImpl * const this, const rocksdb::ReadOptions & read_options, rocksdb::ColumnFamilyData * cfd, rocksdb::SequenceNumber snapshot, rocksdb::ReadCallback * read_callback, bool allow_blob, bool allow_refresh) (\opt\prepare\rocksdb-6.12.6\db\db_impl\db_impl.cc:2830)
rocksdb::DBImpl::NewIterator(rocksdb::DBImpl * const this, const rocksdb::ReadOptions & read_options, rocksdb::ColumnFamilyHandle * column_family) (\opt\prepare\rocksdb-6.12.6\db\db_impl\db_impl.cc:2749)
stonedb::index::DICTManager::get_ongoing_index(const stonedb::index::DICTManager * const this, std::vector<stonedb::index::GlobalId, std::allocator<stonedb::index::GlobalId> > & ids, stonedb::index::MetaType dd_type) (\opt\lth\stonedb\storage\stonedb\index\rdb_meta_manager.cpp:887)
stonedb::index::KVStore::AsyncDropData(stonedb::index::KVStore * const this) (\opt\lth\stonedb\storage\stonedb\index\kv_store.cpp:112)
stonedb::index::KVStore::<lambda()>::operator()(void) const(const stonedb::index::KVStore::<lambda()> * const __closure) (\opt\lth\stonedb\storage\stonedb\index\kv_store.cpp:85)
std::__invoke_impl<void, stonedb::index::KVStore::Init()::<lambda()> >(std::__invoke_other, stonedb::index::KVStore::<lambda()> &)(stonedb::index::KVStore::<lambda()> & __f) (\opt\rh\devtoolset-7\root\usr\include\c++\7\bits\invoke.h:60)
std::__invoke<stonedb::index::KVStore::Init()::<lambda()> >(stonedb::index::KVStore::<lambda()> &)(stonedb::index::KVStore::<lambda()> & __fn) (\opt\rh\devtoolset-7\root\usr\include\c++\7\bits\invoke.h:95)
std::thread::_Invoker<std::tuple<stonedb::index::KVStore::Init()::<lambda()> > >::_M_invoke<0>(std::_Index_tuple<0>)(std::thread::_Invoker<std::tuple<stonedb::index::KVStore::Init()::<lambda()> > > * const this) (\opt\rh\devtoolset-7\root\usr\include\c++\7\thread:234)
std::thread::_Invoker<std::tuple<stonedb::index::KVStore::Init()::<lambda()> > >::operator()(void)(std::thread::_Invoker<std::tuple<stonedb::index::KVStore::Init()::<lambda()> > > * const this) (\opt\rh\devtoolset-7\root\usr\include\c++\7\thread:243)
std::thread::_State_impl<std::thread::_Invoker<std::tuple<stonedb::index::KVStore::Init()::<lambda()> > > >::_M_run(void)(std::thread::_State_impl<std::thread::_Invoker<std::tuple<stonedb::index::KVStore::Init()::<lambda()> > > > * const this) (\opt\rh\devtoolset-7\root\usr\include\c++\7\thread:186)
execute_native_thread_routine (未知源:0)
libpthread.so.0!start_thread (未知源:0)
libc.so.6!clone (未知源:0)

lylth avatar Jul 24 '22 08:07 lylth

Check that the data file is empty. Check the log and find that the table name has been escaped. $test1->@0024test1. Preliminary judgment that rocksdb does not support the '$' special character

lylth avatar Jul 24 '22 08:07 lylth