Skip to content

Commit 5ffc688

Browse files
kemmmariadb-LeonidFedorov
authored andcommitted
fix(plugin): MCOL-6029 use the right field from the rows_stats struct for inserts
1 parent e8b9add commit 5ffc688

File tree

4 files changed

+15
-10
lines changed

4 files changed

+15
-10
lines changed

dbcon/mysql/ha_mcs.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,6 @@ pthread_mutex_t mcs_mutex;
7777
#endif
7878
#define DEBUG_RETURN return
7979

80-
#if MYSQL_VERSION_ID >= 110500
81-
/* because of renames in the handler class */
82-
#define rows_changed rows_stats.updated
83-
#endif
84-
8580
/**
8681
@brief
8782
Function we use in the creation of our hash to get key.
@@ -335,7 +330,7 @@ int ha_mcs::write_row(const uchar* buf)
335330
int rc;
336331
try
337332
{
338-
rc = ha_mcs_impl_write_row(buf, table, rows_changed, time_zone);
333+
rc = ha_mcs_impl_write_row(buf, table, rows_inserted(), time_zone);
339334
}
340335
catch (std::runtime_error& e)
341336
{
@@ -2008,7 +2003,7 @@ int ha_mcs_cache::flush_insert_cache()
20082003
copied_rows++;
20092004
if ((error = parent::write_row(record)))
20102005
goto end;
2011-
rows_changed++;
2006+
rows_inserted()++;
20122007
}
20132008
if (error == HA_ERR_END_OF_FILE)
20142009
error = 0;

dbcon/mysql/ha_mcs.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,16 @@ class ha_mcs : public handler
5959
int impl_external_lock(THD* thd, TABLE* table, int lock_type);
6060
int impl_rnd_init(TABLE* table, const std::vector<COND*>& condStack);
6161

62+
protected:
63+
ha_rows& rows_inserted()
64+
{
65+
#if MYSQL_VERSION_ID >= 110500
66+
return rows_stats.inserted;
67+
#else
68+
return rows_changed;
69+
#endif
70+
}
71+
6272
public:
6373
ha_mcs(handlerton* hton, TABLE_SHARE* table_arg);
6474
~ha_mcs() override = default;

dbcon/mysql/ha_mcs_impl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2891,7 +2891,7 @@ int ha_mcs_impl_delete_table(const char* name)
28912891
int rc = ha_mcs_impl_delete_table_(dbName, name, *ci);
28922892
return rc;
28932893
}
2894-
int ha_mcs_impl_write_row(const uchar* buf, TABLE* table, uint64_t rows_changed, long timeZone)
2894+
int ha_mcs_impl_write_row(const uchar* buf, TABLE* table, uint64_t rows_inserted, long timeZone)
28952895
{
28962896
THD* thd = current_thd;
28972897

@@ -2921,7 +2921,7 @@ int ha_mcs_impl_write_row(const uchar* buf, TABLE* table, uint64_t rows_changed,
29212921

29222922
// At the beginning of insert, make sure there are no
29232923
// left-over values from a previously possibly failed insert.
2924-
if (rows_changed == 0)
2924+
if (rows_inserted == 0)
29252925
ci->tableValuesMap.clear();
29262926

29272927
if (ci->alterTableState > 0)

dbcon/mysql/ha_mcs_impl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ extern int ha_mcs_impl_open(const char* name, int mode, uint32_t test_if_locked)
3131
extern int ha_mcs_impl_close(void);
3232
extern int ha_mcs_impl_rnd_next(uchar* buf, TABLE* table, long timeZone);
3333
extern int ha_mcs_impl_rnd_end(TABLE* table, bool is_derived_hand = false);
34-
extern int ha_mcs_impl_write_row(const uchar* buf, TABLE* table, uint64_t rows_changed, long timeZone);
34+
extern int ha_mcs_impl_write_row(const uchar* buf, TABLE* table, uint64_t rows_inserted, long timeZone);
3535
extern void ha_mcs_impl_start_bulk_insert(ha_rows rows, TABLE* table, bool is_cache_insert = false);
3636
extern int ha_mcs_impl_end_bulk_insert(bool abort, TABLE* table);
3737
extern int ha_mcs_impl_rename_table(const char* from, const char* to);

0 commit comments

Comments
 (0)