summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorMohamed Ashiq <ashiq333@gmail.com>2015-05-19 14:55:38 +0530
committerNiels de Vos <ndevos@redhat.com>2015-06-10 01:54:14 -0700
commit2847b03a38515a625e36d52c7e0a1d37107d72ba (patch)
tree97810d4927f3b794c6221152d1e9a91016a8dec7 /libglusterfs
parent9374b2ef417104ba51bc03a55ff8c5a521c749f4 (diff)
gfdb/libglusterfs : Porting to a new logging framework
Change-Id: I61874561fdf2c175d2b3eec0c85c25f12dc60552 BUG: 1194640 Signed-off-by: Mohamed Ashiq <ashiq333@gmail.com> Reviewed-on: http://review.gluster.org/10819 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Joseph Fernandes
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/gfdb/gfdb_data_store.c91
-rw-r--r--libglusterfs/src/gfdb/gfdb_data_store_types.h28
-rw-r--r--libglusterfs/src/gfdb/gfdb_sqlite3.c193
-rw-r--r--libglusterfs/src/gfdb/gfdb_sqlite3.h6
-rw-r--r--libglusterfs/src/gfdb/gfdb_sqlite3_helper.c306
5 files changed, 352 insertions, 272 deletions
diff --git a/libglusterfs/src/gfdb/gfdb_data_store.c b/libglusterfs/src/gfdb/gfdb_data_store.c
index 5699b750068..8559a626e18 100644
--- a/libglusterfs/src/gfdb/gfdb_data_store.c
+++ b/libglusterfs/src/gfdb/gfdb_data_store.c
@@ -11,6 +11,7 @@
#include "gfdb_sqlite3.h"
#include "gfdb_data_store.h"
#include "list.h"
+#include "libglusterfs-messages.h"
/******************************************************************************
*
@@ -89,8 +90,9 @@ add_connection_node (gfdb_conn_node_t *_conn_node) {
/*Lock the list*/
ret = pthread_mutex_lock (&db_conn_mutex);
if (ret) {
- gf_log (GFDB_DATA_STORE, GF_LOG_ERROR,
- "Failed lock db connection list %s", strerror(ret));
+ gf_msg (GFDB_DATA_STORE, GF_LOG_ERROR, ret,
+ LG_MSG_LOCK_LIST_FAILED, "Failed lock db connection "
+ "list %s", strerror(ret));
ret = -1;
goto out;
}
@@ -105,8 +107,9 @@ add_connection_node (gfdb_conn_node_t *_conn_node) {
/*unlock the list*/
ret = pthread_mutex_unlock (&db_conn_mutex);
if (ret) {
- gf_log (GFDB_DATA_STORE, GF_LOG_ERROR,
- "Failed unlock db connection list %s", strerror(ret));
+ gf_msg (GFDB_DATA_STORE, GF_LOG_ERROR, ret,
+ LG_MSG_UNLOCK_LIST_FAILED, "Failed unlock db "
+ "connection list %s", strerror(ret));
ret = -1;
/*TODO What if the unlock fails.
* Will it lead to deadlock?
@@ -131,8 +134,9 @@ delete_conn_node (gfdb_conn_node_t *_conn_node)
/*Lock of the list*/
ret = pthread_mutex_lock (&db_conn_mutex);
if (ret) {
- gf_log (GFDB_DATA_STORE, GF_LOG_ERROR,
- "Failed lock on db connection list %s", strerror(ret));
+ gf_msg (GFDB_DATA_STORE, GF_LOG_ERROR, ret,
+ LG_MSG_LOCK_LIST_FAILED, "Failed lock on db connection"
+ " list %s", strerror(ret));
goto out;
}
@@ -153,9 +157,9 @@ delete_conn_node (gfdb_conn_node_t *_conn_node)
/*Release the list lock*/
ret = pthread_mutex_unlock (&db_conn_mutex);
if (ret) {
- gf_log (GFDB_DATA_STORE, GF_LOG_WARNING,
- "Failed unlock on db connection"
- " list %s", strerror(ret));
+ gf_msg (GFDB_DATA_STORE, GF_LOG_WARNING, ret,
+ LG_MSG_UNLOCK_LIST_FAILED, "Failed unlock on db "
+ "connection list %s", strerror(ret));
/*TODO What if the unlock fails.
* Will it lead to deadlock?
* Most of the gluster code
@@ -190,11 +194,13 @@ init_db_operations (gfdb_db_type_t gfdb_db_type,
case GFDB_HYPERDEX:
case GFDB_HASH_FILE_STORE:
case GFDB_ROCKS_DB:
- gf_log (GFDB_DATA_STORE, GF_LOG_ERROR, "Plugin not supported");
+ gf_msg (GFDB_DATA_STORE, GF_LOG_ERROR, 0,
+ LG_MSG_UNSUPPORTED_PLUGIN, "Plugin not supported");
break;
case GFDB_INVALID_DB:
case GFDB_DB_END:
- gf_log (GFDB_DATA_STORE, GF_LOG_ERROR, "Invalid DB Type");
+ gf_msg (GFDB_DATA_STORE, GF_LOG_ERROR, 0,
+ LG_MSG_INVALID_DB_TYPE, "Invalid DB Type");
break;
}
return ret;
@@ -228,8 +234,9 @@ init_db (dict_t *args, gfdb_db_type_t gfdb_db_type)
_conn_node = GF_CALLOC (1, sizeof(gfdb_conn_node_t),
gf_mt_db_conn_node_t);
if (!_conn_node) {
- gf_log (GFDB_DATA_STORE, GF_LOG_ERROR,
- "Failed mem alloc for gfdb_conn_node_t!");
+ gf_msg (GFDB_DATA_STORE, GF_LOG_ERROR, ENOMEM,
+ LG_MSG_NO_MEMORY, "Failed mem alloc for "
+ "gfdb_conn_node_t!");
goto alloc_failed;
}
@@ -240,8 +247,9 @@ init_db (dict_t *args, gfdb_db_type_t gfdb_db_type)
/*Add created connection node to the list*/
ret = add_connection_node (_conn_node);
if (ret) {
- gf_log (GFDB_DATA_STORE, GF_LOG_ERROR,
- "Failed to add connection node to list");
+ gf_msg (GFDB_DATA_STORE, GF_LOG_ERROR, 0,
+ LG_MSG_ADD_TO_LIST_FAILED, "Failed to add connection "
+ "node to list");
goto _conn_failed;
}
@@ -250,8 +258,9 @@ init_db (dict_t *args, gfdb_db_type_t gfdb_db_type)
/*init the db ops object of db connection object*/
ret = init_db_operations(gfdb_db_type, db_operations_t);
if (ret) {
- gf_log (GFDB_DATA_STORE, GF_LOG_ERROR,
- "Failed initializing database operation failed.");
+ gf_msg (GFDB_DATA_STORE, GF_LOG_ERROR, 0,
+ LG_MSG_INIT_DB_FAILED, "Failed initializing database "
+ "operation failed.");
ret = -1;
goto init_db_failed;
}
@@ -261,8 +270,8 @@ init_db (dict_t *args, gfdb_db_type_t gfdb_db_type)
ret = db_operations_t->init_db_op (args, &_conn_node->gfdb_connection.
gf_db_connection);
if (ret) {
- gf_log (GFDB_DATA_STORE, GF_LOG_ERROR,
- "Failed initializing database");
+ gf_msg (GFDB_DATA_STORE, GF_LOG_ERROR, 0,
+ LG_MSG_INIT_DB_FAILED, "Failed initializing database");
ret = -1;
goto init_db_failed;
}
@@ -278,8 +287,9 @@ init_db (dict_t *args, gfdb_db_type_t gfdb_db_type)
init_db_failed:
ret = delete_conn_node (_conn_node);
if (ret) {
- gf_log (GFDB_DATA_STORE, GF_LOG_ERROR,
- "Failed deleting connection node from list");
+ gf_msg (GFDB_DATA_STORE, GF_LOG_ERROR, 0,
+ LG_MSG_DELETE_FROM_LIST_FAILED, "Failed deleting "
+ "connection node from list");
}
return NULL;
/*if adding to the list failed free connection node*/
@@ -316,15 +326,17 @@ fini_db (gfdb_conn_node_t *_conn_node)
ret = db_operations_t->fini_db_op(&_conn_node->gfdb_connection.
gf_db_connection);
if (ret) {
- gf_log (GFDB_DATA_STORE, GF_LOG_ERROR,
- "Failed close the db connection");
+ gf_msg (GFDB_DATA_STORE, GF_LOG_ERROR, 0,
+ LG_MSG_CLOSE_CONNECTION_FAILED, "Failed close the db "
+ "connection");
goto out;
}
ret = delete_conn_node (_conn_node);
if (ret) {
- gf_log (GFDB_DATA_STORE, GF_LOG_ERROR,
- "Failed deleting connection node from list");
+ gf_msg (GFDB_DATA_STORE, GF_LOG_ERROR, 0,
+ LG_MSG_DELETE_FROM_LIST_FAILED, "Failed deleting "
+ "connection node from list");
}
empty:
ret = 0;
@@ -370,8 +382,9 @@ insert_record (gfdb_conn_node_t *_conn_node,
ret = db_operations_t->insert_record_op (gf_db_connection,
gfdb_db_record);
if (ret) {
- gf_log (GFDB_DATA_STORE, GF_LOG_ERROR,
- "Insert/Update operation failed!");
+ gf_msg (GFDB_DATA_STORE, GF_LOG_ERROR, 0,
+ LG_MSG_INSERT_OR_UPDATE_FAILED, "Insert/Update"
+ " operation failed!");
}
}
@@ -409,8 +422,9 @@ delete_record (gfdb_conn_node_t *_conn_node,
ret = db_operations_t->delete_record_op (gf_db_connection,
gfdb_db_record);
if (ret) {
- gf_log (GFDB_DATA_STORE, GF_LOG_ERROR,
- "Delete operation failed!");
+ gf_msg (GFDB_DATA_STORE, GF_LOG_ERROR, 0,
+ LG_MSG_DELETE_FAILED, "Delete operation "
+ "failed!");
}
}
@@ -448,8 +462,9 @@ find_all(gfdb_conn_node_t *_conn_node, gf_query_callback_t query_callback,
query_callback,
_query_cbk_args);
if (ret) {
- gf_log (GFDB_DATA_STORE, GF_LOG_ERROR,
- "Find all operation failed!");
+ gf_msg (GFDB_DATA_STORE, GF_LOG_ERROR, 0,
+ LG_MSG_FIND_OP_FAILED, "Find all operation "
+ "failed!");
}
}
@@ -494,8 +509,9 @@ find_unchanged_for_time(gfdb_conn_node_t *_conn_node,
_query_cbk_args,
for_time);
if (ret) {
- gf_log (GFDB_DATA_STORE, GF_LOG_ERROR,
- "Find unchanged operation failed!");
+ gf_msg (GFDB_DATA_STORE, GF_LOG_ERROR, 0,
+ LG_MSG_FIND_OP_FAILED, "Find unchanged "
+ "operation failed!");
}
}
@@ -538,7 +554,8 @@ find_recently_changed_files(gfdb_conn_node_t *_conn_node,
_query_cbk_args,
from_time);
if (ret) {
- gf_log (GFDB_DATA_STORE, GF_LOG_ERROR,
+ gf_msg (GFDB_DATA_STORE, GF_LOG_ERROR, 0,
+ LG_MSG_FIND_OP_FAILED,
"Find changed operation failed!");
}
@@ -594,7 +611,8 @@ find_unchanged_for_time_freq(gfdb_conn_node_t *_conn_node,
read_freq_thresold,
_clear_counters);
if (ret) {
- gf_log (GFDB_DATA_STORE, GF_LOG_ERROR,
+ gf_msg (GFDB_DATA_STORE, GF_LOG_ERROR, 0,
+ LG_MSG_FIND_OP_FAILED,
"Find unchanged with freq operation failed!");
}
@@ -649,7 +667,8 @@ find_recently_changed_files_freq(gfdb_conn_node_t *_conn_node,
read_freq_thresold,
_clear_counters);
if (ret) {
- gf_log (GFDB_DATA_STORE, GF_LOG_ERROR,
+ gf_msg (GFDB_DATA_STORE, GF_LOG_ERROR, 0,
+ LG_MSG_FIND_OP_FAILED,
"Find changed with freq operation failed!");
}
diff --git a/libglusterfs/src/gfdb/gfdb_data_store_types.h b/libglusterfs/src/gfdb/gfdb_data_store_types.h
index 5f6650dd910..b0511637ddc 100644
--- a/libglusterfs/src/gfdb/gfdb_data_store_types.h
+++ b/libglusterfs/src/gfdb/gfdb_data_store_types.h
@@ -19,6 +19,7 @@
#include "compat-uuid.h"
#include "gfdb_mem-types.h"
#include "dict.h"
+#include "libglusterfs-messages.h"
typedef enum gf_db_operation {
GFDB_INVALID_DB_OP = -1,
@@ -335,8 +336,9 @@ gfdb_query_record_init()
gfdb_query_record = GF_CALLOC (1, sizeof(gfdb_query_record_t),
gf_mt_gfdb_query_record_t);
if (!gfdb_query_record) {
- gf_log (GFDB_DATA_STORE, GF_LOG_ERROR,
- "Error allocating memory to gfdb_query_record ");
+ gf_msg (GFDB_DATA_STORE, GF_LOG_ERROR, ENOMEM,
+ LG_MSG_NO_MEMORY, "Error allocating memory to "
+ "gfdb_query_record ");
goto out;
}
ret = 0;
@@ -379,8 +381,9 @@ gfdb_link_info_init ()
gfdb_link_info = GF_CALLOC (1, sizeof(gfdb_link_info_t),
gf_mt_gfdb_link_info_t);
if (!gfdb_link_info) {
- gf_log (GFDB_DATA_STORE, GF_LOG_ERROR,
- "Error allocating memory to gfdb_link_info ");
+ gf_msg (GFDB_DATA_STORE, GF_LOG_ERROR, ENOMEM,
+ LG_MSG_NO_MEMORY, "Error allocating memory to "
+ "gfdb_link_info ");
}
return gfdb_link_info;
@@ -692,9 +695,9 @@ typedef struct gfdb_connection {
goto error;\
ret = dict_add (params_dict, param_key, data);\
if (ret) {\
- gf_log (comp_name, GF_LOG_ERROR,\
- "Failed setting %s to params dictionary",\
- param_key);\
+ gf_msg (comp_name, GF_LOG_ERROR, 0,\
+ LG_MSG_SET_PARAM_FAILED, "Failed setting %s "\
+ "to params dictionary", param_key);\
goto error;\
};\
} while (0)
@@ -706,8 +709,9 @@ typedef struct gfdb_connection {
data_t *data = NULL;\
data = dict_get (params_dict, param_key);\
if (!data) {\
- gf_log (comp_name, GF_LOG_ERROR,\
- "Failed to retrieve %s from params", param_key);\
+ gf_msg (comp_name, GF_LOG_ERROR, 0,\
+ LG_MSG_GET_PARAM_FAILED, "Failed to retrieve "\
+ "%s from params", param_key);\
goto error;\
} else {\
str_value = data->data;\
@@ -724,9 +728,9 @@ typedef struct gfdb_connection {
data = dict_get (params_dict, param_key);\
if (!data) {\
str_value = _default_v;\
- gf_log (comp_name, GF_LOG_WARNING,\
- "Failed to retrieve %s from params."\
- "Assigning default value: %s",\
+ gf_msg (comp_name, GF_LOG_WARNING, 0,\
+ LG_MSG_GET_PARAM_FAILED, "Failed to retrieve "\
+ "%s from params.Assigning default value: %s",\
param_key, _default_v);\
} else {\
str_value = data->data;\
diff --git a/libglusterfs/src/gfdb/gfdb_sqlite3.c b/libglusterfs/src/gfdb/gfdb_sqlite3.c
index 02d60857498..7eca03f40e2 100644
--- a/libglusterfs/src/gfdb/gfdb_sqlite3.c
+++ b/libglusterfs/src/gfdb/gfdb_sqlite3.c
@@ -10,6 +10,7 @@
#include "gfdb_sqlite3.h"
#include "gfdb_sqlite3_helper.h"
+#include "libglusterfs-messages.h"
/******************************************************************************
*
@@ -24,8 +25,9 @@ gf_sql_connection_init ()
gf_sql_conn = GF_CALLOC (1, sizeof(gf_sql_connection_t),
gf_mt_sql_connection_t);
if (gf_sql_conn == NULL) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Error allocating memory to gf_sql_connection_t ");
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, ENOMEM,
+ LG_MSG_NO_MEMORY, "Error allocating memory to "
+ "gf_sql_connection_t ");
}
return gf_sql_conn;
@@ -156,8 +158,9 @@ sql_stmt_init ()
gf_common_mt_char);
if (!sql_stmt) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Error allocating memory to SQL Statement ");
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, ENOMEM,
+ LG_MSG_NO_MEMORY, "Error allocating memory to SQL "
+ "Statement ");
goto out;
}
out:
@@ -189,7 +192,7 @@ gf_open_sqlite3_conn(char *sqlite3_db_path, int flags)
/*Creates DB if not created*/
ret = sqlite3_open_v2(sqlite3_db_path, &sqlite3_db_conn, flags, NULL);
if (ret) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0, LG_MSG_DB_ERROR,
"FATAL: Could open %s : %s",
sqlite3_db_path, sqlite3_errmsg(sqlite3_db_conn));
}
@@ -206,9 +209,10 @@ gf_close_sqlite3_conn(sqlite3 *sqlite3_db_conn)
if (sqlite3_db_conn) {
ret = sqlite3_close (sqlite3_db_conn);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "FATAL: sqlite3 close connection failed %s",
- sqlite3_errmsg(sqlite3_db_conn));
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_CONNECTION_ERROR, "FATAL: sqlite3 close"
+ " connection failed %s",
+ sqlite3_errmsg(sqlite3_db_conn));
ret = -1;
goto out;
}
@@ -269,9 +273,8 @@ create_filetable (sqlite3 *sqlite3_db_conn)
ret = sqlite3_exec (sqlite3_db_conn, sql_stmt, NULL, NULL,
&sql_strerror);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed executing: %s : %s",
- sql_stmt, sql_strerror);
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0, LG_MSG_EXEC_FAILED,
+ "Failed executing: %s : %s", sql_stmt, sql_strerror);
sqlite3_free (sql_strerror);
ret = -1;
goto out;
@@ -398,13 +401,15 @@ gf_sqlite3_init (dict_t *args, void **db_conn) {
GF_ASSERT (db_conn);
if (*db_conn != NULL) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "DB Connection is not empty!");
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_CONNECTION_ERROR, "DB Connection is not "
+ "empty!");
return 0;
}
if (!sqlite3_threadsafe()) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_NOT_MULTITHREAD_MODE,
"sqlite3 is not in multithreaded mode");
goto out;
}
@@ -430,7 +435,8 @@ gf_sqlite3_init (dict_t *args, void **db_conn) {
SQLITE_OPEN_READWRITE |
SQLITE_OPEN_CREATE);
if (!sql_conn->sqlite3_db_conn) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_CONNECTION_ERROR,
"Failed creating db connection");
goto out;
}
@@ -444,17 +450,18 @@ gf_sqlite3_init (dict_t *args, void **db_conn) {
/*Apply sqlite3 params to database*/
ret = apply_sql_params_db(sql_conn, args);
if (ret) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed applying sql params to %s",
- sql_conn->sqlite3_db_path);
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_SET_PARAM_FAILED, "Failed applying sql params"
+ " to %s", sql_conn->sqlite3_db_path);
goto out;
}
/*Create the schema if NOT present*/
ret = create_filetable (sql_conn->sqlite3_db_conn);
if (ret) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed Creating %s Table", GF_FILE_TABLE);
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_CREATE_FAILED, "Failed Creating %s Table",
+ GF_FILE_TABLE);
goto out;
}
@@ -517,7 +524,7 @@ int gf_sqlite3_insert(void *db_conn, gfdb_db_record_t *gfdb_db_record)
/*This is for debugging bug. Will be removed with a bug fix*/
if ((GFDB_FOP_WIND == gfdb_db_record->gfdb_fop_path) &&
(strncmp(gfdb_db_record->file_path, "<gfid", 5) == 0)) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0, LG_MSG_SKIP_PATH,
"Skip path <gfid fop=%d",
gfdb_db_record->gfdb_fop_type);
goto out;
@@ -527,16 +534,16 @@ int gf_sqlite3_insert(void *db_conn, gfdb_db_record_t *gfdb_db_record)
case GFDB_FOP_WIND:
ret = gf_sql_insert_wind(sql_conn, gfdb_db_record);
if (ret) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed wind insert");
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_INSERT_FAILED, "Failed wind insert");
goto out;
}
break;
case GFDB_FOP_UNWIND:
ret = gf_sql_insert_unwind (sql_conn, gfdb_db_record);
if (ret) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed unwind insert");
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_INSERT_FAILED, "Failed unwind insert");
goto out;
}
break;
@@ -544,8 +551,9 @@ int gf_sqlite3_insert(void *db_conn, gfdb_db_record_t *gfdb_db_record)
case GFDB_FOP_WDEL:
ret = gf_sql_update_delete_wind(sql_conn, gfdb_db_record);
if (ret) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed updating delete during wind");
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_UPDATE_FAILED, "Failed updating delete "
+ "during wind");
goto out;
}
break;
@@ -553,14 +561,14 @@ int gf_sqlite3_insert(void *db_conn, gfdb_db_record_t *gfdb_db_record)
case GFDB_FOP_UNDEL_ALL:
ret = gf_sql_delete_unwind(sql_conn, gfdb_db_record);
if (ret) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed deleting");
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_DELETE_FAILED, "Failed deleting");
goto out;
}
break;
case GFDB_FOP_INVALID:
default:
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0, LG_MSG_INVALID_FOP,
"Cannot record to DB: Invalid FOP");
goto out;
}
@@ -620,8 +628,9 @@ gf_sqlite3_find_all (void *db_conn, gf_query_callback_t query_callback,
ret = sqlite3_prepare(sql_conn->sqlite3_db_conn, query_str, -1,
&prep_stmt, 0);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed preparing statment %s : %s", query_str,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_PREPARE_FAILED, "Failed preparing statment %s :"
+ "%s", query_str,
sqlite3_errmsg(sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
@@ -629,7 +638,7 @@ gf_sqlite3_find_all (void *db_conn, gf_query_callback_t query_callback,
ret = gf_sql_query_function(prep_stmt, query_callback, query_cbk_args);
if (ret) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0, LG_MSG_QUERY_FAILED,
"Failed Query %s", query_str);
goto out;
}
@@ -681,8 +690,9 @@ gf_sqlite3_find_recently_changed_files(void *db_conn,
ret = sqlite3_prepare(sql_conn->sqlite3_db_conn, query_str, -1,
&prep_stmt, 0);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed preparing statment %s : %s", query_str,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_PREPARE_FAILED, "Failed preparing statment %s :"
+ " %s", query_str,
sqlite3_errmsg(sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
@@ -691,9 +701,9 @@ gf_sqlite3_find_recently_changed_files(void *db_conn,
/*Bind write wind time*/
ret = sqlite3_bind_int64(prep_stmt, 1, from_time_usec);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed binding from_time_usec %ld : %s",
- from_time_usec,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_BINDING_FAILED, "Failed binding from_time_usec "
+ "%ld : %s", from_time_usec,
sqlite3_errmsg(sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
@@ -702,9 +712,9 @@ gf_sqlite3_find_recently_changed_files(void *db_conn,
/*Bind read wind time*/
ret = sqlite3_bind_int64(prep_stmt, 2, from_time_usec);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed binding from_time_usec %ld : %s ",
- from_time_usec,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_BINDING_FAILED, "Failed binding from_time_usec "
+ "%ld : %s ", from_time_usec,
sqlite3_errmsg(sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
@@ -713,7 +723,7 @@ gf_sqlite3_find_recently_changed_files(void *db_conn,
/*Execute the query*/
ret = gf_sql_query_function(prep_stmt, query_callback, query_cbk_args);
if (ret) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0, LG_MSG_QUERY_FAILED,
"Failed Query %s", query_str);
goto out;
}
@@ -765,8 +775,9 @@ gf_sqlite3_find_unchanged_for_time (void *db_conn,
ret = sqlite3_prepare(sql_conn->sqlite3_db_conn, query_str, -1,
&prep_stmt, 0);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed preparing statment %s : %s", query_str,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_PREPARE_FAILED, "Failed preparing statment %s :"
+ " %s", query_str,
sqlite3_errmsg(sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
@@ -775,8 +786,9 @@ gf_sqlite3_find_unchanged_for_time (void *db_conn,
/*Bind write wind time*/
ret = sqlite3_bind_int64(prep_stmt, 1, for_time_usec);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed binding for_time_usec %ld : %s", for_time_usec,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_BINDING_FAILED, "Failed binding for_time_usec "
+ "%ld : %s", for_time_usec,
sqlite3_errmsg(sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
@@ -785,8 +797,9 @@ gf_sqlite3_find_unchanged_for_time (void *db_conn,
/*Bind read wind time*/
ret = sqlite3_bind_int64(prep_stmt, 2, for_time_usec);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed binding for_time_usec %ld : %s", for_time_usec,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_BINDING_FAILED, "Failed binding for_time_usec "
+ "%ld : %s", for_time_usec,
sqlite3_errmsg(sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
@@ -795,7 +808,7 @@ gf_sqlite3_find_unchanged_for_time (void *db_conn,
/*Execute the query*/
ret = gf_sql_query_function(prep_stmt, query_callback, query_cbk_args);
if (ret) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0, LG_MSG_QUERY_FAILED,
"Failed Query %s", query_str);
goto out;
}
@@ -859,8 +872,9 @@ gf_sqlite3_find_recently_changed_files_freq (void *db_conn,
ret = sqlite3_prepare(sql_conn->sqlite3_db_conn, query_str, -1,
&prep_stmt, 0);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed preparing statment %s : %s", query_str,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_PREPARE_FAILED, "Failed preparing statment %s :"
+ " %s", query_str,
sqlite3_errmsg(sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
@@ -869,9 +883,9 @@ gf_sqlite3_find_recently_changed_files_freq (void *db_conn,
/*Bind write wind time*/
ret = sqlite3_bind_int64(prep_stmt, 1, from_time_usec);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed binding from_time_usec %ld : %s",
- from_time_usec,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_BINDING_FAILED, "Failed binding from_time_usec "
+ "%ld : %s", from_time_usec,
sqlite3_errmsg(sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
@@ -880,8 +894,9 @@ gf_sqlite3_find_recently_changed_files_freq (void *db_conn,
/*Bind write frequency thresold*/
ret = sqlite3_bind_int(prep_stmt, 2, freq_write_cnt);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed binding freq_write_cnt %d : %s", freq_write_cnt,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_BINDING_FAILED, "Failed binding freq_write_cnt "
+ "%d : %s", freq_write_cnt,
sqlite3_errmsg(sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
@@ -891,9 +906,9 @@ gf_sqlite3_find_recently_changed_files_freq (void *db_conn,
/*Bind read wind time*/
ret = sqlite3_bind_int64(prep_stmt, 3, from_time_usec);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed binding from_time_usec %ld : %s",
- from_time_usec,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_BINDING_FAILED, "Failed binding from_time_usec "
+ "%ld : %s", from_time_usec,
sqlite3_errmsg(sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
@@ -902,8 +917,9 @@ gf_sqlite3_find_recently_changed_files_freq (void *db_conn,
/*Bind read frequency thresold*/
ret = sqlite3_bind_int(prep_stmt, 4, freq_read_cnt);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed binding freq_read_cnt %d : %s", freq_read_cnt,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_BINDING_FAILED, "Failed binding freq_read_cnt "
+ "%d : %s", freq_read_cnt,
sqlite3_errmsg(sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
@@ -912,7 +928,7 @@ gf_sqlite3_find_recently_changed_files_freq (void *db_conn,
/*Execute the query*/
ret = gf_sql_query_function(prep_stmt, query_callback, query_cbk_args);
if (ret) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0, LG_MSG_QUERY_FAILED,
"Failed Query %s", query_str);
goto out;
}
@@ -923,8 +939,9 @@ gf_sqlite3_find_recently_changed_files_freq (void *db_conn,
if (clear_counters) {
ret = gf_sql_clear_counters(sql_conn);
if (ret) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed clearing counters!");
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_CLEAR_COUNTER_FAILED, "Failed clearing"
+ " counters!");
goto out;
}
}
@@ -1000,8 +1017,9 @@ gf_sqlite3_find_unchanged_for_time_freq (void *db_conn,
ret = sqlite3_prepare (sql_conn->sqlite3_db_conn, query_str, -1,
&prep_stmt, 0);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed preparing delete statment %s : %s", query_str,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_PREPARE_FAILED, "Failed preparing delete "
+ "statment %s : %s", query_str,
sqlite3_errmsg(sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
@@ -1010,9 +1028,9 @@ gf_sqlite3_find_unchanged_for_time_freq (void *db_conn,
/*Bind write wind time*/
ret = sqlite3_bind_int64 (prep_stmt, 1, for_time_usec);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed binding for_time_usec %ld : %s",
- for_time_usec,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_BINDING_FAILED, "Failed binding for_time_usec "
+ "%ld : %s", for_time_usec,
sqlite3_errmsg(sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
@@ -1021,9 +1039,9 @@ gf_sqlite3_find_unchanged_for_time_freq (void *db_conn,
/*Bind write frequency thresold*/
ret = sqlite3_bind_int (prep_stmt, 2, freq_write_cnt);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed binding freq_write_cnt %d : %s",
- freq_write_cnt,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_BINDING_FAILED, "Failed binding freq_write_cnt"
+ " %d : %s", freq_write_cnt,
sqlite3_errmsg(sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
@@ -1032,9 +1050,9 @@ gf_sqlite3_find_unchanged_for_time_freq (void *db_conn,
/*Bind write wind time*/
ret = sqlite3_bind_int64 (prep_stmt, 3, for_time_usec);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed binding for_time_usec %ld : %s",
- for_time_usec,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_BINDING_FAILED, "Failed binding for_time_usec "
+ "%ld : %s", for_time_usec,
sqlite3_errmsg(sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
@@ -1045,9 +1063,9 @@ gf_sqlite3_find_unchanged_for_time_freq (void *db_conn,
/*Bind read wind time*/
ret = sqlite3_bind_int64 (prep_stmt, 4, for_time_usec);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed binding for_time_usec %ld : %s",
- for_time_usec,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_BINDING_FAILED, "Failed binding for_time_usec "
+ "%ld : %s", for_time_usec,
sqlite3_errmsg(sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
@@ -1056,9 +1074,9 @@ gf_sqlite3_find_unchanged_for_time_freq (void *db_conn,
/*Bind read frequency thresold*/
ret = sqlite3_bind_int (prep_stmt, 5, freq_read_cnt);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed binding freq_read_cnt %d : %s",
- freq_read_cnt,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_BINDING_FAILED, "Failed binding freq_read_cnt "
+ "%d : %s", freq_read_cnt,
sqlite3_errmsg(sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
@@ -1067,9 +1085,9 @@ gf_sqlite3_find_unchanged_for_time_freq (void *db_conn,
/*Bind read wind time*/
ret = sqlite3_bind_int64 (prep_stmt, 6, for_time_usec);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed binding for_time_usec %ld : %s",
- for_time_usec,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_BINDING_FAILED, "Failed binding for_time_usec "
+ "%ld : %s", for_time_usec,
sqlite3_errmsg(sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
@@ -1078,7 +1096,7 @@ gf_sqlite3_find_unchanged_for_time_freq (void *db_conn,
/*Execute the query*/
ret = gf_sql_query_function (prep_stmt, query_callback, query_cbk_args);
if (ret) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0, LG_MSG_QUERY_FAILED,
"Failed Query %s", query_str);
goto out;
}
@@ -1088,8 +1106,9 @@ gf_sqlite3_find_unchanged_for_time_freq (void *db_conn,
if (clear_counters) {
ret = gf_sql_clear_counters (sql_conn);
if (ret) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed clearing counters!");
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_CLEAR_COUNTER_FAILED, "Failed clearing "
+ "counters!");
goto out;
}
}
diff --git a/libglusterfs/src/gfdb/gfdb_sqlite3.h b/libglusterfs/src/gfdb/gfdb_sqlite3.h
index 5b6921eafe2..213693136fe 100644
--- a/libglusterfs/src/gfdb/gfdb_sqlite3.h
+++ b/libglusterfs/src/gfdb/gfdb_sqlite3.h
@@ -17,6 +17,7 @@
#include "logging.h"
#include "gfdb_data_store_types.h"
#include "gfdb_mem-types.h"
+#include "libglusterfs-messages.h"
#define GF_STMT_SIZE_MAX 2048
@@ -132,7 +133,8 @@ typedef struct gf_sql_connection {
do {\
GF_VALIDATE_OR_GOTO(GFDB_STR_SQLITE3, sql_conn, out);\
if (!sql_conn->sqlite3_db_conn) {\
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,\
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,\
+ LG_MSG_CONNECTION_INIT_FAILED,\
"sqlite3 connection not initialized");\
goto out;\
};\
@@ -145,7 +147,7 @@ do {\
ret = sqlite3_exec (sql_conn->sqlite3_db_conn, sqlite3_config_str,\
NULL, NULL, NULL);\
if (ret != SQLITE_OK) {\
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,\
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0, LG_MSG_EXEC_FAILED,\
"Failed executing: %s : %s",\
sqlite3_config_str, sqlite3_errmsg\
(sql_conn->sqlite3_db_conn));\
diff --git a/libglusterfs/src/gfdb/gfdb_sqlite3_helper.c b/libglusterfs/src/gfdb/gfdb_sqlite3_helper.c
index 03ebb1f1c8a..f3e0e9711a9 100644
--- a/libglusterfs/src/gfdb/gfdb_sqlite3_helper.c
+++ b/libglusterfs/src/gfdb/gfdb_sqlite3_helper.c
@@ -9,6 +9,7 @@
*/
#include "gfdb_sqlite3_helper.h"
+#include "libglusterfs-messages.h"
#define GFDB_SQL_STMT_SIZE 256
@@ -44,9 +45,9 @@ gf_sql_delete_all (gf_sql_connection_t *sql_conn,
ret = sqlite3_prepare(sql_conn->sqlite3_db_conn, delete_link_str, -1,
&delete_link_stmt, 0);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed preparing delete statment %s : %s",
- delete_link_str,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_PREPARE_FAILED, "Failed preparing delete "
+ "statment %s : %s", delete_link_str,
sqlite3_errmsg (sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
@@ -55,9 +56,9 @@ gf_sql_delete_all (gf_sql_connection_t *sql_conn,
/*Bind gfid*/
ret = sqlite3_bind_text (delete_link_stmt, 1, gfid, -1, NULL);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed binding gfid %s : %s", gfid,
- sqlite3_errmsg (sql_conn->sqlite3_db_conn));
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_BINDING_FAILED, "Failed binding gfid %s : %s",
+ gfid, sqlite3_errmsg (sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
}
@@ -65,7 +66,7 @@ gf_sql_delete_all (gf_sql_connection_t *sql_conn,
/*Execute the prepare statement*/
if (sqlite3_step (delete_link_stmt) != SQLITE_DONE) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0, LG_MSG_EXEC_FAILED,
"Failed executing the prepared stmt %s : %s",
delete_link_str,
sqlite3_errmsg (sql_conn->sqlite3_db_conn));
@@ -82,9 +83,9 @@ gf_sql_delete_all (gf_sql_connection_t *sql_conn,
ret = sqlite3_prepare (sql_conn->sqlite3_db_conn, delete_file_str, -1,
&delete_file_stmt, 0);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed preparing delete statment %s : %s",
- delete_file_str,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_PREPARE_FAILED, "Failed preparing delete "
+ "statment %s : %s", delete_file_str,
sqlite3_errmsg (sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
@@ -93,16 +94,16 @@ gf_sql_delete_all (gf_sql_connection_t *sql_conn,
/*Bind gfid*/
ret = sqlite3_bind_text (delete_file_stmt, 1, gfid, -1, NULL);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed binding gfid %s : %s", gfid,
- sqlite3_errmsg (sql_conn->sqlite3_db_conn));
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_BINDING_FAILED, "Failed binding gfid %s : %s",
+ gfid, sqlite3_errmsg (sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
}
/*Execute the prepare statement*/
if (sqlite3_step (delete_file_stmt) != SQLITE_DONE) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0, LG_MSG_EXEC_FAILED,
"Failed executing the prepared stmt %s : %s",
delete_file_str,
sqlite3_errmsg (sql_conn->sqlite3_db_conn));
@@ -139,8 +140,9 @@ gf_sql_delete_link (gf_sql_connection_t *sql_conn,
ret = sqlite3_prepare (sql_conn->sqlite3_db_conn, delete_str, -1,
&delete_stmt, 0);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed preparing delete statment %s : %s", delete_str,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_PREPARE_FAILED, "Failed preparing delete "
+ "statment %s : %s", delete_str,
sqlite3_errmsg (sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
@@ -149,7 +151,8 @@ gf_sql_delete_link (gf_sql_connection_t *sql_conn,
/*Bind gfid*/
ret = sqlite3_bind_text (delete_stmt, 1, gfid, -1, NULL);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_BINDING_FAILED,
"Failed binding gfid %s : %s", gfid,
sqlite3_errmsg (sql_conn->sqlite3_db_conn));
ret = -1;
@@ -159,8 +162,9 @@ gf_sql_delete_link (gf_sql_connection_t *sql_conn,
/*Bind pargfid*/
ret = sqlite3_bind_text (delete_stmt, 2, pargfid, -1, NULL);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed binding parent gfid %s : %s", pargfid,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_BINDING_FAILED, "Failed binding parent gfid %s "
+ ": %s", pargfid,
sqlite3_errmsg (sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
@@ -169,8 +173,9 @@ gf_sql_delete_link (gf_sql_connection_t *sql_conn,
/*Bind basename*/
ret = sqlite3_bind_text (delete_stmt, 3, basename, -1, NULL);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed binding basename %s : %s", basename,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_BINDING_FAILED, "Failed binding basename %s : "
+ "%s", basename,
sqlite3_errmsg (sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
@@ -178,7 +183,7 @@ gf_sql_delete_link (gf_sql_connection_t *sql_conn,
/*Execute the prepare statement*/
if (sqlite3_step(delete_stmt) != SQLITE_DONE) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0, LG_MSG_EXEC_FAILED,
"Failed executing the prepared stmt %s : %s",
delete_str,
sqlite3_errmsg (sql_conn->sqlite3_db_conn));
@@ -227,8 +232,9 @@ gf_sql_update_link_flags (gf_sql_connection_t *sql_conn,
ret = sqlite3_prepare (sql_conn->sqlite3_db_conn, update_str, -1,
&update_stmt, 0);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed preparing update statment %s : %s", update_str,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_PREPARE_FAILED, "Failed preparing update "
+ "statment %s : %s", update_str,
sqlite3_errmsg (sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
@@ -238,8 +244,9 @@ gf_sql_update_link_flags (gf_sql_connection_t *sql_conn,
/*Bind link_update*/
ret = sqlite3_bind_int (update_stmt, 1, update_flag);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed binding update_flag %d : %s", update_flag,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_BINDING_FAILED, "Failed binding update_flag %d "
+ ": %s", update_flag,
sqlite3_errmsg (sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
@@ -248,9 +255,9 @@ gf_sql_update_link_flags (gf_sql_connection_t *sql_conn,
/*Bind gfid*/
ret = sqlite3_bind_text (update_stmt, 2, gfid, -1, NULL);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed binding gfid %s : %s", gfid,
- sqlite3_errmsg (sql_conn->sqlite3_db_conn));
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_BINDING_FAILED, "Failed binding gfid %s : %s",
+ gfid, sqlite3_errmsg (sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
}
@@ -258,8 +265,9 @@ gf_sql_update_link_flags (gf_sql_connection_t *sql_conn,
/*Bind pargfid*/
ret = sqlite3_bind_text (update_stmt, 3, pargfid, -1, NULL);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed binding parent gfid %s : %s", pargfid,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_BINDING_FAILED, "Failed binding parent gfid %s "
+ ": %s", pargfid,
sqlite3_errmsg (sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
@@ -268,8 +276,9 @@ gf_sql_update_link_flags (gf_sql_connection_t *sql_conn,
/*Bind basename*/
ret = sqlite3_bind_text (update_stmt, 4, basename, -1, NULL);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed binding basename %s : %s", basename,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_BINDING_FAILED, "Failed binding basename %s : "
+ "%s", basename,
sqlite3_errmsg (sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
@@ -278,7 +287,7 @@ gf_sql_update_link_flags (gf_sql_connection_t *sql_conn,
/*Execute the prepare statement*/
if (sqlite3_step(update_stmt) != SQLITE_DONE) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0, LG_MSG_EXEC_FAILED,
"Failed executing the prepared stmt %s : %s",
update_str,
sqlite3_errmsg (sql_conn->sqlite3_db_conn));
@@ -323,8 +332,9 @@ gf_sql_insert_link (gf_sql_connection_t *sql_conn,
ret = sqlite3_prepare (sql_conn->sqlite3_db_conn, insert_str, -1,
&insert_stmt, 0);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed preparing insert statment %s : %s", insert_str,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_PREPARE_FAILED, "Failed preparing insert "
+ "statment %s : %s", insert_str,
sqlite3_errmsg (sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
@@ -333,9 +343,9 @@ gf_sql_insert_link (gf_sql_connection_t *sql_conn,
/*Bind gfid*/
ret = sqlite3_bind_text (insert_stmt, 1, gfid, -1, NULL);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed binding gfid %s : %s", gfid,
- sqlite3_errmsg (sql_conn->sqlite3_db_conn));
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_BINDING_FAILED, "Failed binding gfid %s : %s",
+ gfid, sqlite3_errmsg (sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
}
@@ -343,8 +353,9 @@ gf_sql_insert_link (gf_sql_connection_t *sql_conn,
/*Bind pargfid*/
ret = sqlite3_bind_text (insert_stmt, 2, pargfid, -1, NULL);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed binding parent gfid %s : %s", pargfid,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_BINDING_FAILED, "Failed binding parent gfid %s "
+ ": %s", pargfid,
sqlite3_errmsg (sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
@@ -353,7 +364,8 @@ gf_sql_insert_link (gf_sql_connection_t *sql_conn,
/*Bind basename*/
ret = sqlite3_bind_text (insert_stmt, 3, basename, -1, NULL);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_BINDING_FAILED,
"Failed binding basename %s : %s", basename,
sqlite3_errmsg (sql_conn->sqlite3_db_conn));
ret = -1;
@@ -363,8 +375,9 @@ gf_sql_insert_link (gf_sql_connection_t *sql_conn,
/*Bind basepath*/
ret = sqlite3_bind_text (insert_stmt, 4, basepath, -1, NULL);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed binding basepath %s : %s", basepath,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_BINDING_FAILED, "Failed binding basepath %s : "
+ "%s", basepath,
sqlite3_errmsg (sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
@@ -372,10 +385,9 @@ gf_sql_insert_link (gf_sql_connection_t *sql_conn,
/*Execute the prepare statement*/
if (sqlite3_step (insert_stmt) != SQLITE_DONE) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0, LG_MSG_EXEC_FAILED,
"Failed executing the prepared stmt %s %s %s %s %s : %s",
- gfid, pargfid, basename, basepath,
- insert_str,
+ gfid, pargfid, basename, basepath, insert_str,
sqlite3_errmsg (sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
@@ -426,8 +438,8 @@ gf_sql_update_link (gf_sql_connection_t *sql_conn,
ret = gf_sql_delete_link (sql_conn, gfid, old_pargfid,
old_basename);
if (ret) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed deleting old link");
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_DELETE_FAILED, "Failed deleting old link");
goto out;
}
@@ -440,8 +452,9 @@ gf_sql_update_link (gf_sql_connection_t *sql_conn,
ret = sqlite3_prepare (sql_conn->sqlite3_db_conn, insert_str, -1,
&insert_stmt, 0);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed preparing insert statment %s : %s", insert_str,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_PREPARE_FAILED, "Failed preparing insert "
+ "statment %s : %s", insert_str,
sqlite3_errmsg (sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
@@ -450,9 +463,9 @@ gf_sql_update_link (gf_sql_connection_t *sql_conn,
/*Bind gfid*/
ret = sqlite3_bind_text (insert_stmt, 1, gfid, -1, NULL);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed binding gfid %s : %s", gfid,
- sqlite3_errmsg (sql_conn->sqlite3_db_conn));
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_BINDING_FAILED, "Failed binding gfid %s : %s",
+ gfid, sqlite3_errmsg (sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
}
@@ -460,8 +473,9 @@ gf_sql_update_link (gf_sql_connection_t *sql_conn,
/*Bind new pargfid*/
ret = sqlite3_bind_text (insert_stmt, 2, pargfid, -1, NULL);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed binding parent gfid %s : %s", pargfid,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_BINDING_FAILED, "Failed binding parent gfid %s "
+ ": %s", pargfid,
sqlite3_errmsg (sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
@@ -470,8 +484,9 @@ gf_sql_update_link (gf_sql_connection_t *sql_conn,
/*Bind new basename*/
ret = sqlite3_bind_text (insert_stmt, 3, basename, -1, NULL);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed binding basename %s : %s", basename,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_BINDING_FAILED, "Failed binding basename %s : "
+ "%s", basename,
sqlite3_errmsg (sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
@@ -480,8 +495,9 @@ gf_sql_update_link (gf_sql_connection_t *sql_conn,
/*Bind new basepath*/
ret = sqlite3_bind_text (insert_stmt, 4, basepath, -1, NULL);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed binding basename %s : %s", basepath,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_BINDING_FAILED, "Failed binding basename %s : "
+ "%s", basepath,
sqlite3_errmsg (sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
@@ -489,7 +505,7 @@ gf_sql_update_link (gf_sql_connection_t *sql_conn,
/*Execute the prepare statement*/
if (sqlite3_step (insert_stmt) != SQLITE_DONE) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0, LG_MSG_EXEC_FAILED,
"Failed executing the prepared stmt %s : %s",
insert_str,
sqlite3_errmsg (sql_conn->sqlite3_db_conn));
@@ -527,8 +543,9 @@ gf_sql_insert_write_wind_time (gf_sql_connection_t *sql_conn,
ret = sqlite3_prepare (sql_conn->sqlite3_db_conn, insert_str, -1,
&insert_stmt, 0);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed preparing insert statment %s : %s", insert_str,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_PREPARE_FAILED, "Failed preparing insert "
+ "statment %s : %s", insert_str,
sqlite3_errmsg (sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
@@ -537,9 +554,9 @@ gf_sql_insert_write_wind_time (gf_sql_connection_t *sql_conn,
/*Bind gfid*/
ret = sqlite3_bind_text (insert_stmt, 1, gfid, -1, NULL);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed binding gfid %s : %s", gfid,
- sqlite3_errmsg (sql_conn->sqlite3_db_conn));
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_BINDING_FAILED, "Failed binding gfid %s : %s",
+ gfid, sqlite3_errmsg (sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
}
@@ -547,9 +564,9 @@ gf_sql_insert_write_wind_time (gf_sql_connection_t *sql_conn,
/*Bind wind secs*/
ret = sqlite3_bind_int (insert_stmt, 2, wind_time->tv_sec);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed binding parent wind secs %ld : %s",
- wind_time->tv_sec,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_BINDING_FAILED, "Failed binding parent wind "
+ "secs %ld : %s", wind_time->tv_sec,
sqlite3_errmsg (sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
@@ -558,9 +575,9 @@ gf_sql_insert_write_wind_time (gf_sql_connection_t *sql_conn,
/*Bind wind msecs*/
ret = sqlite3_bind_int (insert_stmt, 3, wind_time->tv_usec);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed binding parent wind msecs %ld : %s",
- wind_time->tv_usec,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_BINDING_FAILED, "Failed binding parent wind "
+ "msecs %ld : %s", wind_time->tv_usec,
sqlite3_errmsg (sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
@@ -568,10 +585,9 @@ gf_sql_insert_write_wind_time (gf_sql_connection_t *sql_conn,
/*Execute the prepare statement*/
if (sqlite3_step (insert_stmt) != SQLITE_DONE) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0, LG_MSG_EXEC_FAILED,
"Failed executing the prepared stmt GFID:%s %s : %s",
- gfid,
- insert_str,
+ gfid, insert_str,
sqlite3_errmsg (sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
@@ -653,8 +669,9 @@ gf_update_time (gf_sql_connection_t *sql_conn,
ret = sqlite3_prepare (sql_conn->sqlite3_db_conn, update_str, -1,
&update_stmt, 0);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed preparing insert statment %s : %s", update_str,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_PREPARE_FAILED, "Failed preparing insert "
+ "statment %s : %s", update_str,
sqlite3_errmsg (sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
@@ -663,9 +680,9 @@ gf_update_time (gf_sql_connection_t *sql_conn,
/*Bind time secs*/
ret = sqlite3_bind_int (update_stmt, 1, update_time->tv_sec);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed binding parent wind secs %ld : %s",
- update_time->tv_sec,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_BINDING_FAILED, "Failed binding parent wind "
+ "secs %ld : %s", update_time->tv_sec,
sqlite3_errmsg (sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
@@ -674,9 +691,9 @@ gf_update_time (gf_sql_connection_t *sql_conn,
/*Bind time msecs*/
ret = sqlite3_bind_int (update_stmt, 2, update_time->tv_usec);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed binding parent wind msecs %ld : %s",
- update_time->tv_usec,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_BINDING_FAILED, "Failed binding parent wind "
+ "msecs %ld : %s", update_time->tv_usec,
sqlite3_errmsg (sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
@@ -685,16 +702,16 @@ gf_update_time (gf_sql_connection_t *sql_conn,
/*Bind gfid*/
ret = sqlite3_bind_text (update_stmt, 3, gfid, -1, NULL);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed binding gfid %s : %s", gfid,
- sqlite3_errmsg (sql_conn->sqlite3_db_conn));
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_BINDING_FAILED, "Failed binding gfid %s : %s",
+ gfid, sqlite3_errmsg (sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
}
/*Execute the prepare statement*/
if (sqlite3_step (update_stmt) != SQLITE_DONE) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0, LG_MSG_EXEC_FAILED,
"Failed executing the prepared stmt %s : %s",
update_str,
sqlite3_errmsg (sql_conn->sqlite3_db_conn));
@@ -735,8 +752,8 @@ gf_sql_insert_wind (gf_sql_connection_t *sql_conn,
gfid_str = gf_strdup (uuid_utoa (gfdb_db_record->gfid));
if (!gfid_str) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Creating gfid string failed.");
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_CREATE_FAILED, "Creating gfid string failed.");
goto out;
}
@@ -747,8 +764,9 @@ gf_sql_insert_wind (gf_sql_connection_t *sql_conn,
/*Parent GFID is always set*/
pargfid_str = gf_strdup (uuid_utoa (gfdb_db_record->pargfid));
if (!pargfid_str) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Creating gfid string failed.");
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_CREATE_FAILED, "Creating gfid string "
+ "failed.");
goto out;
}
@@ -761,8 +779,9 @@ gf_sql_insert_wind (gf_sql_connection_t *sql_conn,
gfdb_db_record->file_path,
gfdb_db_record->link_consistency);
if (ret) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed inserting link in DB");
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_INSERT_FAILED, "Failed "
+ "inserting link in DB");
goto out;
}
gfdb_db_record->islinkupdate = gfdb_db_record->
@@ -775,8 +794,9 @@ gf_sql_insert_wind (gf_sql_connection_t *sql_conn,
ret = gf_sql_insert_write_wind_time (sql_conn, gfid_str,
modtime);
if (ret) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed inserting wind time in DB");
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_INSERT_FAILED, "Failed "
+ "inserting wind time in DB");
goto out;
}
goto out;
@@ -788,7 +808,8 @@ gf_sql_insert_wind (gf_sql_connection_t *sql_conn,
old_pargfid_str = gf_strdup (uuid_utoa (
gfdb_db_record->old_pargfid));
if (!old_pargfid_str) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR,
+ 0, LG_MSG_CREATE_FAILED,
"Creating gfid string failed.");
goto out;
}
@@ -801,7 +822,8 @@ gf_sql_insert_wind (gf_sql_connection_t *sql_conn,
gfdb_db_record->
link_consistency);
if (ret) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR,
+ 0, LG_MSG_UPDATE_FAILED,
"Failed updating link");
goto out;
}
@@ -816,8 +838,9 @@ gf_sql_insert_wind (gf_sql_connection_t *sql_conn,
gfdb_db_record->file_path,
gfdb_db_record->link_consistency);
if (ret) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed inserting link in DB");
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR,
+ 0, LG_MSG_INSERT_FAILED,
+ "Failed inserting link in DB");
goto out;
}
gfdb_db_record->islinkupdate = gfdb_db_record->
@@ -834,8 +857,9 @@ gf_sql_insert_wind (gf_sql_connection_t *sql_conn,
its_wind,
isreadfop (gfdb_db_record->gfdb_fop_type));
if (ret) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed update wind time in DB");
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_UPDATE_FAILED, "Failed update wind time"
+ " in DB");
goto out;
}
}
@@ -867,8 +891,8 @@ gf_sql_insert_unwind (gf_sql_connection_t *sql_conn,
gfid_str = gf_strdup (uuid_utoa(gfdb_db_record->gfid));
if (!gfid_str) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Creating gfid string failed.");
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_CREATE_FAILED, "Creating gfid string failed.");
goto out;
}
@@ -881,8 +905,9 @@ gf_sql_insert_unwind (gf_sql_connection_t *sql_conn,
(!its_wind),
isreadfop (gfdb_db_record->gfdb_fop_type));
if (ret) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed update unwind time in DB");
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_UPDATE_FAILED, "Failed update unwind "
+ "time in DB");
goto out;
}
}
@@ -893,7 +918,8 @@ gf_sql_insert_unwind (gf_sql_connection_t *sql_conn,
pargfid_str = gf_strdup(uuid_utoa(gfdb_db_record->pargfid));
if (!pargfid_str) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_CREATE_FAILED,
"Creating pargfid_str string failed.");
goto out;
}
@@ -901,8 +927,9 @@ gf_sql_insert_unwind (gf_sql_connection_t *sql_conn,
ret = gf_sql_update_link_flags (sql_conn, gfid_str, pargfid_str,
gfdb_db_record->file_name, 0, _gf_true);
if (ret) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed updating link flags in unwind");
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_UPDATE_FAILED, "Failed updating link "
+ "flags in unwind");
goto out;
}
}
@@ -928,15 +955,16 @@ gf_sql_update_delete_wind (gf_sql_connection_t *sql_conn,
gfid_str = gf_strdup (uuid_utoa(gfdb_db_record->gfid));
if (!gfid_str) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Creating gfid string failed.");
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_CREATE_FAILED, "Creating gfid string failed.");
goto out;
}
pargfid_str = gf_strdup (uuid_utoa(gfdb_db_record->pargfid));
if (!pargfid_str) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Creating pargfid_str string failed.");
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_CREATE_FAILED, "Creating pargfid_str "
+ "string failed.");
goto out;
}
@@ -945,7 +973,8 @@ gf_sql_update_delete_wind (gf_sql_connection_t *sql_conn,
gfdb_db_record->file_name, 1,
_gf_false);
if (ret) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_UPDATE_FAILED,
"Failed updating link flags in wind");
goto out;
}
@@ -972,8 +1001,8 @@ gf_sql_delete_unwind (gf_sql_connection_t *sql_conn,
gfid_str = gf_strdup (uuid_utoa(gfdb_db_record->gfid));
if (!gfid_str) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Creating gfid string failed.");
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_CREATE_FAILED, "Creating gfid string failed.");
goto out;
}
@@ -986,8 +1015,9 @@ gf_sql_delete_unwind (gf_sql_connection_t *sql_conn,
pargfid_str = gf_strdup(uuid_utoa(gfdb_db_record->pargfid));
if (!pargfid_str) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Creating pargfid_str string failed.");
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_CREATE_FAILED, "Creating pargfid_str "
+ "string failed.");
goto out;
}
@@ -1004,7 +1034,8 @@ gf_sql_delete_unwind (gf_sql_connection_t *sql_conn,
_gf_true,
isreadfop (gfdb_db_record->gfdb_fop_type));
if (ret) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_UPDATE_FAILED,
"Failed update wind time in DB");
goto out;
}
@@ -1015,8 +1046,8 @@ gf_sql_delete_unwind (gf_sql_connection_t *sql_conn,
ret = gf_sql_delete_link(sql_conn, gfid_str, pargfid_str,
gfdb_db_record->file_name);
if (ret) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed deleting link");
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_DELETE_FAILED, "Failed deleting link");
goto out;
}
@@ -1027,14 +1058,15 @@ gf_sql_delete_unwind (gf_sql_connection_t *sql_conn,
_gf_false,
isreadfop(gfdb_db_record->gfdb_fop_type));
if (ret) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed update unwind time in DB");
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_UPDATE_FAILED, "Failed update "
+ "unwind time in DB");
goto out;
}
}
} else {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Invalid unlink option");
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_INVALID_UPLINK, "Invalid unlink option");
goto out;
}
ret = 0;
@@ -1066,8 +1098,9 @@ gf_sql_query_function (sqlite3_stmt *prep_stmt,
gfdb_query_record = gfdb_query_record_init ();
if (!gfdb_query_record) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed to create gfdb_query_record");
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_CREATE_FAILED, "Failed to create "
+ "gfdb_query_record");
goto out;
}
@@ -1083,14 +1116,16 @@ gf_sql_query_function (sqlite3_stmt *prep_stmt,
text_column = (char *)sqlite3_column_text
(prep_stmt, 0);
if (!text_column) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed retriving GF_ID");
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_GET_ID_FAILED, "Failed "
+ "retriving GF_ID");
goto out;
}
ret = gf_uuid_parse (text_column, gfdb_query_record->gfid);
if (ret) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed parsing GF_ID");
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_PARSE_FAILED, "Failed parsing "
+ "GF_ID");
goto out;
}
@@ -1108,7 +1143,8 @@ gf_sql_query_function (sqlite3_stmt *prep_stmt,
ret = query_callback (gfdb_query_record,
_query_cbk_args);
if (ret) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_QUERY_CALL_BACK_FAILED,
"Query Call back failed!");
goto out;
}
@@ -1118,9 +1154,9 @@ gf_sql_query_function (sqlite3_stmt *prep_stmt,
}
if (ret != SQLITE_DONE) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
- "Failed retriving records from db : %s",
- sqlite3_errmsg (db_conn));
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0,
+ LG_MSG_GET_RECORD_FAILED, "Failed retriving records "
+ "from db : %s", sqlite3_errmsg (db_conn));
ret = -1;
goto out;
}
@@ -1150,7 +1186,7 @@ gf_sql_clear_counters (gf_sql_connection_t *sql_conn)
ret = sqlite3_exec (sql_conn->sqlite3_db_conn, query_str, NULL, NULL,
&sql_strerror);
if (ret != SQLITE_OK) {
- gf_log (GFDB_STR_SQLITE3, GF_LOG_ERROR,
+ gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0, LG_MSG_EXEC_FAILED,
"Failed executing: %s : %s",
query_str, sql_strerror);
sqlite3_free (sql_strerror);