@@ -9314,8 +9314,9 @@ int ha_partition::extra(enum ha_extra_function operation)
9314
9314
switch (operation) {
9315
9315
/* Category 1), used by most handlers */
9316
9316
case HA_EXTRA_NO_KEYREAD:
9317
- DBUG_RETURN (loop_partitions (end_keyread_cb, NULL ));
9317
+ DBUG_RETURN (loop_read_partitions (end_keyread_cb, NULL ));
9318
9318
case HA_EXTRA_KEYREAD:
9319
+ DBUG_RETURN (loop_read_partitions (extra_cb, &operation));
9319
9320
case HA_EXTRA_FLUSH:
9320
9321
case HA_EXTRA_PREPARE_FOR_FORCED_CLOSE:
9321
9322
DBUG_RETURN (loop_partitions (extra_cb, &operation));
@@ -9537,7 +9538,7 @@ int ha_partition::extra_opt(enum ha_extra_function operation, ulong arg)
9537
9538
switch (operation)
9538
9539
{
9539
9540
case HA_EXTRA_KEYREAD:
9540
- DBUG_RETURN (loop_partitions (start_keyread_cb, &arg));
9541
+ DBUG_RETURN (loop_read_partitions (start_keyread_cb, &arg));
9541
9542
case HA_EXTRA_CACHE:
9542
9543
prepare_extra_cache (arg);
9543
9544
DBUG_RETURN (0 );
@@ -9625,14 +9626,53 @@ int ha_partition::loop_extra_alter(enum ha_extra_function operation)
9625
9626
*/
9626
9627
9627
9628
int ha_partition::loop_partitions (handler_callback callback, void *param)
9629
+ {
9630
+ int result= loop_partitions_over_map (&m_part_info->lock_partitions ,
9631
+ callback, param);
9632
+ /* Add all used partitions to be called in reset(). */
9633
+ bitmap_union (&m_partitions_to_reset, &m_part_info->lock_partitions );
9634
+ return result;
9635
+ }
9636
+
9637
+
9638
+ /*
9639
+ Call callback(part, param) on read_partitions (the ones used by the query)
9640
+ */
9641
+
9642
+ int ha_partition::loop_read_partitions (handler_callback callback, void *param)
9643
+ {
9644
+ /*
9645
+ There is no need to record partitions on m_partitions_to_reset as
9646
+ read_partitions were opened, etc - they will be reset anyway.
9647
+ */
9648
+ return loop_partitions_over_map (&m_part_info->read_partitions , callback,
9649
+ param);
9650
+ }
9651
+
9652
+
9653
+ /* *
9654
+ Call callback(part, param) on specified set of partitions
9655
+
9656
+ @part_map The set of partitions to call callback for
9657
+ @param callback a callback to call for each partition
9658
+ @param param a void*-parameter passed to callback
9659
+
9660
+ @return Operation status
9661
+ @retval >0 Error code
9662
+ @retval 0 Success
9663
+ */
9664
+
9665
+ int ha_partition::loop_partitions_over_map (const MY_BITMAP *part_map,
9666
+ handler_callback callback,
9667
+ void *param)
9628
9668
{
9629
9669
int result= 0 , tmp;
9630
9670
uint i;
9631
- DBUG_ENTER (" ha_partition::loop_partitions " );
9671
+ DBUG_ENTER (" ha_partition::loop_partitions_over_map " );
9632
9672
9633
- for (i= bitmap_get_first_set (&m_part_info-> lock_partitions );
9673
+ for (i= bitmap_get_first_set (part_map );
9634
9674
i < m_tot_parts;
9635
- i= bitmap_get_next_set (&m_part_info-> lock_partitions , i))
9675
+ i= bitmap_get_next_set (part_map , i))
9636
9676
{
9637
9677
/*
9638
9678
This can be called after an error in ha_open.
@@ -9642,8 +9682,6 @@ int ha_partition::loop_partitions(handler_callback callback, void *param)
9642
9682
(tmp= callback (m_file[i], param)))
9643
9683
result= tmp;
9644
9684
}
9645
- /* Add all used partitions to be called in reset(). */
9646
- bitmap_union (&m_partitions_to_reset, &m_part_info->lock_partitions );
9647
9685
DBUG_RETURN (result);
9648
9686
}
9649
9687
0 commit comments