summaryrefslogtreecommitdiffstats
path: root/extra/mariabackup/backup_debug.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:00:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:00:34 +0000
commit3f619478f796eddbba6e39502fe941b285dd97b1 (patch)
treee2c7b5777f728320e5b5542b6213fd3591ba51e2 /extra/mariabackup/backup_debug.h
parentInitial commit. (diff)
downloadmariadb-3f619478f796eddbba6e39502fe941b285dd97b1.tar.xz
mariadb-3f619478f796eddbba6e39502fe941b285dd97b1.zip
Adding upstream version 1:10.11.6.upstream/1%10.11.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'extra/mariabackup/backup_debug.h')
-rw-r--r--extra/mariabackup/backup_debug.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/extra/mariabackup/backup_debug.h b/extra/mariabackup/backup_debug.h
new file mode 100644
index 00000000..777b4f4a
--- /dev/null
+++ b/extra/mariabackup/backup_debug.h
@@ -0,0 +1,24 @@
+#pragma once
+#include "my_dbug.h"
+#ifndef DBUG_OFF
+char *dbug_mariabackup_get_val(const char *event, fil_space_t::name_type key);
+/*
+In debug mode, execute SQL statement that was passed via environment.
+To use this facility, you need to
+
+1. Add code DBUG_EXECUTE_MARIABACKUP_EVENT("my_event_name", key););
+ to the code. key is usually a table name
+2. Set environment variable my_event_name_$key SQL statement you want to execute
+ when event occurs, in DBUG_EXECUTE_IF from above.
+ In mtr , you can set environment via 'let' statement (do not use $ as the first char
+ for the variable)
+3. start mariabackup with --dbug=+d,debug_mariabackup_events
+*/
+#define DBUG_EXECUTE_FOR_KEY(EVENT, KEY, CODE) \
+ DBUG_EXECUTE_IF("mariabackup_inject_code", \
+ { char *dbug_val= dbug_mariabackup_get_val(EVENT, KEY); \
+ if (dbug_val) CODE })
+#else
+#define DBUG_EXECUTE_FOR_KEY(EVENT, KEY, CODE)
+#endif
+