Skip to content

Instantly share code, notes, and snippets.

@spetrunia
Created March 8, 2024 13:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spetrunia/07979da51e333545bcf45eac49b311ae to your computer and use it in GitHub Desktop.
Save spetrunia/07979da51e333545bcf45eac49b311ae to your computer and use it in GitHub Desktop.
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index e41f1b08c5a..09b6067be4f 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -93,6 +93,7 @@ static const char *ha_par_ext= PAR_EXT;
table->record[0] during index condition evaluation (if present).
*/
using IndexOperationFunc= std::function<int(uchar* read_buf)>;
+#if 0
static int index_reader(TABLE* table,
Item* pushed_idx_cond,
uchar* record_buf,
@@ -106,6 +107,7 @@ static int index_reader(TABLE* table,
memcpy(record_buf, table->record[0], record_buf_len);
return error;
}
+#endif
/****************************************************************************
MODULE create/delete handler object
@@ -7966,6 +7968,7 @@ int ha_partition::handle_ordered_index_scan(uchar *buf, bool reverse_order)
switch (m_index_scan_type) {
case partition_index_read:
+#if 0
error=
index_reader(table, pushed_idx_cond, rec_buf_ptr, m_rec_length,
[this, file] (uchar* read_buf) {
@@ -7974,6 +7977,18 @@ int ha_partition::handle_ordered_index_scan(uchar *buf, bool reverse_order)
m_start_key.keypart_map,
m_start_key.flag);
});
+#endif
+ /*
+ We might be using ICP. Move table->fields from table->record[0] to
+ rec_buf_ptr.
+ */
+ table->move_fields(table->field, rec_buf_ptr, table->record[0]);
+ error= file->ha_index_read_map(rec_buf_ptr,
+ m_start_key.key,
+ m_start_key.keypart_map,
+ m_start_key.flag);
+
+ table->move_fields(table->field, table->record[0], rec_buf_ptr);
/* Caller has specified reverse_order */
break;
case partition_index_first:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment