From ddc416c60698e1f8939faff0cb09c5b5af8e03a7 Mon Sep 17 00:00:00 2001 From: Aleksey Midenkov Date: Mon, 25 Apr 2022 13:58:41 +0300 Subject: MDEV-20077 Warning on full history partition is delayed until next DML statement Moved LIMIT warning from vers_set_hist_part() to new call vers_check_limit() at table unlock phase. At that point read_partitions bitmap is already pruned by DML code (see prune_partitions(), find_used_partitions()) so we have to set corresponding bits for working history partition. Also we don't do my_error(ME_WARNING|ME_ERROR_LOG), because at that point it doesn't update warnings number, so command reports 0 warnings (but warning list is still updated). Instead we do push_warning_printf() and sql_print_warning() separately. Under LOCK TABLES external_lock(F_UNLCK) is not executed. There is start_stmt(), but no corresponding "stop_stmt()". So for that mode we call vers_check_limit() directly from close_thread_tables(). Test result has been changed according to new LIMIT and warning printing algorithm. For convenience all LIMIT warnings are marked with "You see warning above ^". TODO MDEV-20345 fixed. Now vers_history_generating() contains fine-grained list of DML-commands that can generate history (and TODO mechanism worked well). --- sql/partition_info.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sql/partition_info.h') diff --git a/sql/partition_info.h b/sql/partition_info.h index 341ae363c7f..ddbb89fa605 100644 --- a/sql/partition_info.h +++ b/sql/partition_info.h @@ -421,7 +421,13 @@ public: vers_info->limit= limit; return !limit; } + bool vers_require_hist_part(THD *thd) const + { + return part_type == VERSIONING_PARTITION && + thd->lex->vers_history_generating(); + } int vers_set_hist_part(THD *thd); + void vers_check_limit(THD *thd); bool vers_setup_expression(THD *thd, uint32 alter_add= 0); /* Stage 1. */ partition_element *get_partition(uint part_id) { -- cgit v1.2.1