Skip to content

Commit

Permalink
Bug#34693784 TABLE ACCESS SERVICE INDEX READ MAP ISSUES
Browse files Browse the repository at this point in the history
Post merge fix

Adjust dd_schema-t unit test to mock handler::index_read_idx_map()
instead of handler::index_read_map().

Approved by: Georgi Kodinov <georgi.kodinov@oracle.com>
  • Loading branch information
marcalff committed Oct 18, 2022
1 parent 33ae5cc commit a084c36
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions unittest/gunit/dd.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ using ::testing::StrictMock;
class Mock_dd_HANDLER : public Base_mock_HANDLER {
public:
// Mock method used indirectly by find_record
MOCK_METHOD5(index_read_idx_map, int(::uchar *, ::uint, const ::uchar *,
key_part_map, enum ha_rkey_function));
MOCK_METHOD4(index_read_map, int(::uchar *, const ::uchar *, key_part_map,
enum ha_rkey_function));

// Handler method used for inserts
MOCK_METHOD1(write_row, int(::uchar *));
Expand Down
20 changes: 10 additions & 10 deletions unittest/gunit/dd_schema-t.cc
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class SchemaTest : public ::testing::Test {
primary key. This is done by creating a raw access key, which is the primary
key value with a physical representation suitable for looking up in a storage
engine. The raw key is used to get the appropriate record from the dd tables
by calling ha_index_read_idx_map. By instrumenting this function to return
by calling ha_index_read_map. By instrumenting this function to return
1, indicating no record found, we will provoke insert.
Then, for insert, Weak_object_impl::store will first call
Expand Down Expand Up @@ -203,10 +203,10 @@ TEST_F(SchemaTest, CreateSchema) {

// Set expectations for insert:

// ha->index_read_idx_map: Called once, return 1
ON_CALL(*ha, index_read_idx_map(_, _, _, _, _))
// ha->index_read_map: Called once, return 1
ON_CALL(*ha, index_read_map(_, _, _, _))
.WillByDefault(Return(HA_ERR_KEY_NOT_FOUND));
EXPECT_CALL(*ha, index_read_idx_map(_, _, _, _, _)).Times(1);
EXPECT_CALL(*ha, index_read_map(_, _, _, _)).Times(1);

// id->store: Called twice, return 0
ON_CALL(*id, store(real_id, true))
Expand Down Expand Up @@ -260,7 +260,7 @@ TEST_F(SchemaTest, CreateSchema) {

/**
To provoke an update, the setup is pretty much the same as for insert (see
above), but we must instrument index_read_idx_map to return 0. This
above), but we must instrument index_read_map to return 0. This
makes a new Raw_record be created, and makes ha_update_row be called.
*/

Expand Down Expand Up @@ -303,9 +303,9 @@ TEST_F(SchemaTest, UpdateSchema) {

// Set expectations for update:

// ha->index_read_idx_map: Called once, return 0
ON_CALL(*ha, index_read_idx_map(_, _, _, _, _)).WillByDefault(Return(0));
EXPECT_CALL(*ha, index_read_idx_map(_, _, _, _, _)).Times(1);
// ha->index_read_map: Called once, return 0
ON_CALL(*ha, index_read_map(_, _, _, _)).WillByDefault(Return(0));
EXPECT_CALL(*ha, index_read_map(_, _, _, _)).Times(1);

// id->store: Called twice, return 0
ON_CALL(*id, store(real_id, true))
Expand Down Expand Up @@ -412,8 +412,8 @@ TEST_F(SchemaTest, GetSchema) {
EXPECT_CALL(*name, store(_, _, _)).Times(1);

// ha->index_read: Called once, return 0
ON_CALL(*ha, index_read_idx_map(_, _, _, _, _)).WillByDefault(Return(0));
EXPECT_CALL(*ha, index_read_idx_map(_, _, _, _, _)).Times(1);
ON_CALL(*ha, index_read_map(_, _, _, _)).WillByDefault(Return(0));
EXPECT_CALL(*ha, index_read_map(_, _, _, _)).Times(1);

// id->val_int: Called once, get faked id
ON_CALL(*id, val_int())
Expand Down

0 comments on commit a084c36

Please sign in to comment.