From 509dca8167e77eacaabd54f074db7ce07f073007 Mon Sep 17 00:00:00 2001
From: Danny Auble <da@schedmd.com>
Date: Wed, 16 Jul 2014 12:42:34 -0700
Subject: [PATCH] Add debug_flags to the mysql_plugin

---
 .../accounting_storage/mysql/accounting_storage_mysql.c       | 4 ++++
 .../accounting_storage/mysql/accounting_storage_mysql.h       | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c b/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c
index dbcf5156c21..6a61235f8f1 100644
--- a/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c
+++ b/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c
@@ -146,6 +146,8 @@ char *wckey_hour_table = "wckey_usage_hour_table";
 char *wckey_month_table = "wckey_usage_month_table";
 char *wckey_table = "wckey_table";
 
+uint64_t debug_flags = 0;
+
 static char *default_qos_str = NULL;
 
 enum {
@@ -2098,6 +2100,8 @@ extern int init ( void )
 
 	first = 0;
 
+	debug_flags = slurm_get_debug_flags();
+
 	if (!slurmdbd_conf) {
 		char *cluster_name = NULL;
 		if (!(cluster_name = slurm_get_cluster_name()))
diff --git a/src/plugins/accounting_storage/mysql/accounting_storage_mysql.h b/src/plugins/accounting_storage/mysql/accounting_storage_mysql.h
index 3bad59c467f..9eedacbe2ee 100644
--- a/src/plugins/accounting_storage/mysql/accounting_storage_mysql.h
+++ b/src/plugins/accounting_storage/mysql/accounting_storage_mysql.h
@@ -104,6 +104,7 @@ extern List as_mysql_cluster_list;
 extern List as_mysql_total_cluster_list;
 extern pthread_mutex_t as_mysql_cluster_list_lock;
 
+extern uint64_t debug_flags;
 
 typedef enum {
 	QOS_LEVEL_NONE,
@@ -111,6 +112,9 @@ typedef enum {
 	QOS_LEVEL_MODIFY
 } qos_level_t;
 
+#define DB_DEBUG(conn, fmt, ...) \
+	info("%d(%s:%d) "fmt, conn, THIS_FILE, __LINE__, ##__VA_ARGS__);
+
 /*global functions */
 extern int check_connection(mysql_conn_t *mysql_conn);
 extern char *fix_double_quotes(char *str);
-- 
GitLab