diff options
author | Sergey Petrunya <psergey@askmonty.org> | 2012-12-20 14:30:09 +0400 |
---|---|---|
committer | Sergey Petrunya <psergey@askmonty.org> | 2012-12-20 14:30:09 +0400 |
commit | 28c9e1a550bc9f2c2dbb28304d22552ea944cf07 (patch) | |
tree | 79c0f0e227ba1ddcefb35f0127d832a1b9f4a15d /storage/cassandra | |
parent | 6b47b2fe986f22cc3db4c3b8727783a4b392909e (diff) | |
download | mariadb-git-28c9e1a550bc9f2c2dbb28304d22552ea944cf07.tar.gz |
Cassandra Storage Engine: Address review feedback part #3
- Cleanup ha_cassandra::store_lock()
- Remove dummy ha_cassandra::delete_table()
- Add HA_TABLE_SCAN_ON_INDEX to table_flags()
Diffstat (limited to 'storage/cassandra')
-rw-r--r-- | storage/cassandra/ha_cassandra.cc | 47 | ||||
-rw-r--r-- | storage/cassandra/ha_cassandra.h | 4 |
2 files changed, 19 insertions, 32 deletions
diff --git a/storage/cassandra/ha_cassandra.cc b/storage/cassandra/ha_cassandra.cc index d85fa942029..a54190e080c 100644 --- a/storage/cassandra/ha_cassandra.cc +++ b/storage/cassandra/ha_cassandra.cc @@ -1605,7 +1605,10 @@ int ha_cassandra::index_read_map(uchar *buf, const uchar *key, DBUG_ENTER("ha_cassandra::index_read_map"); if (find_flag != HA_READ_KEY_EXACT) + { + DBUG_ASSERT(0); /* Non-equality lookups should never be done */ DBUG_RETURN(HA_ERR_WRONG_COMMAND); + } uint key_len= calculate_key_len(table, active_index, key, keypart_map); store_key_image_to_rec(table->field[0], (uchar*)key, key_len); @@ -2470,7 +2473,16 @@ err: } -/* The following function was copied from ha_blackhole::store_lock: */ +/* + We can't really have any locks for Cassandra Storage Engine. We're reading + from Cassandra cluster, and other clients can asynchronously modify the data. + + We can enforce locking within this process, but this will not be useful. + + Thus, store_lock() should express that: + - Writes do not block other writes + - Reads should not block anything either, including INSERTs. +*/ THR_LOCK_DATA **ha_cassandra::store_lock(THD *thd, THR_LOCK_DATA **to, enum thr_lock_type lock_type) @@ -2478,27 +2490,13 @@ THR_LOCK_DATA **ha_cassandra::store_lock(THD *thd, DBUG_ENTER("ha_cassandra::store_lock"); if (lock_type != TL_IGNORE && lock.type == TL_UNLOCK) { - /* - Here is where we get into the guts of a row level lock. - If TL_UNLOCK is set - If we are not doing a LOCK TABLE or DISCARD/IMPORT - TABLESPACE, then allow multiple writers - */ - + /* Writes allow other writes */ if ((lock_type >= TL_WRITE_CONCURRENT_INSERT && - lock_type <= TL_WRITE) && !thd_in_lock_tables(thd) - && !thd_tablespace_op(thd)) + lock_type <= TL_WRITE)) lock_type = TL_WRITE_ALLOW_WRITE; - /* - In queries of type INSERT INTO t1 SELECT ... FROM t2 ... - MySQL would use the lock TL_READ_NO_INSERT on t2, and that - would conflict with TL_WRITE_ALLOW_WRITE, blocking all inserts - to t2. Convert the lock to a normal read lock to allow - concurrent inserts to t2. - */ - - if (lock_type == TL_READ_NO_INSERT && !thd_in_lock_tables(thd)) + /* Reads allow everything, including INSERTs */ + if (lock_type == TL_READ_NO_INSERT) lock_type = TL_READ; lock.type= lock_type; @@ -2516,17 +2514,6 @@ ha_rows ha_cassandra::records_in_range(uint inx, key_range *min_key, } -int ha_cassandra::delete_table(const char *name) -{ - DBUG_ENTER("ha_cassandra::delete_table"); - /* - Cassandra table is just a view. Dropping it doesn't affect the underlying - column family, so we do nothing here. - */ - DBUG_RETURN(0); -} - - /** check_if_incompatible_data() called if ALTER TABLE can't detect otherwise if new and old definition are compatible diff --git a/storage/cassandra/ha_cassandra.h b/storage/cassandra/ha_cassandra.h index 3954c7850ef..be8a49af493 100644 --- a/storage/cassandra/ha_cassandra.h +++ b/storage/cassandra/ha_cassandra.h @@ -145,7 +145,8 @@ public: HA_REQUIRE_PRIMARY_KEY | HA_PRIMARY_KEY_IN_READ_INDEX | HA_PRIMARY_KEY_REQUIRED_FOR_POSITION | - HA_NO_AUTO_INCREMENT; + HA_NO_AUTO_INCREMENT | + HA_TABLE_SCAN_ON_INDEX; } /** @brief @@ -258,7 +259,6 @@ public: int delete_all_rows(void); ha_rows records_in_range(uint inx, key_range *min_key, key_range *max_key); - int delete_table(const char *from); int create(const char *name, TABLE *form, HA_CREATE_INFO *create_info); ///< required bool check_if_incompatible_data(HA_CREATE_INFO *info, |