diff options
author | Joseph Fernandes <josferna@redhat.com> | 2015-09-18 19:57:54 +0530 |
---|---|---|
committer | Dan Lambright <dlambrig@redhat.com> | 2015-10-08 12:00:31 -0700 |
commit | 58d1a9be562630bd1ed8af3e496ca05e087adece (patch) | |
tree | 5feb32ff9e6ad3c38d87759589426471a4044671 /libglusterfs/src/gfdb/gfdb_data_store.c | |
parent | 81d4aa18b3a1cdad0e0e8df43fe4c8c141c06618 (diff) |
tier/ctr: Solution for db locks for tier migrator and ctr using sqlite version less than 3.7 i.e rhel 6.7
Problem: On RHEL 6.7, we have sqlite version 3.6.2 which doesnt support
WAL journaling mode, as this journaling mode is only available in sqlite 3.7 and above.
As a result we cannot have to progreses concurrently accessing sqlite, without
running into db locks! Well WAL is also need for performace on CTR side.
Solution: This solution is to use CTR db connection for doing queries when WAL mode is
absent. i,e tier migrator will send sync_op ipc calls to CTR, which in turn will
do the query and create/update the query file suggested by tier migrator.
Pending: Well this solution will stop the db locks but the performance is still an issue for CTR.
We are developing an in-Memory Transaction Log (iMeTaL) which will help boost the CTR
performance by doing in memory udpates on the IO path and later flush the updates to
the db in a batch/segment flush.
Change-Id: Ie3149643ded159234b5cc6aa6cf93b9022c2f124
BUG: 1240577
Signed-off-by: Joseph Fernandes <josferna@redhat.com>
Signed-off-by: Dan Lambright <dlambrig@redhat.com>
Signed-off-by: Joseph Fernandes <josferna@redhat.com>
Reviewed-on: http://review.gluster.org/12191
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Luis Pabon <lpabon@redhat.com>
Diffstat (limited to 'libglusterfs/src/gfdb/gfdb_data_store.c')
-rw-r--r-- | libglusterfs/src/gfdb/gfdb_data_store.c | 105 |
1 files changed, 87 insertions, 18 deletions
diff --git a/libglusterfs/src/gfdb/gfdb_data_store.c b/libglusterfs/src/gfdb/gfdb_data_store.c index e409e0ddc69..af4be2116d0 100644 --- a/libglusterfs/src/gfdb/gfdb_data_store.c +++ b/libglusterfs/src/gfdb/gfdb_data_store.c @@ -236,7 +236,7 @@ init_db (dict_t *args, gfdb_db_type_t gfdb_db_type) if (!_conn_node) { gf_msg (GFDB_DATA_STORE, GF_LOG_ERROR, ENOMEM, LG_MSG_NO_MEMORY, "Failed mem alloc for " - "gfdb_conn_node_t!"); + "gfdb_conn_node_t"); goto alloc_failed; } @@ -384,7 +384,7 @@ insert_record (gfdb_conn_node_t *_conn_node, if (ret) { gf_msg (GFDB_DATA_STORE, GF_LOG_ERROR, 0, LG_MSG_INSERT_OR_UPDATE_FAILED, "Insert/Update" - " operation failed!"); + " operation failed"); } } @@ -424,7 +424,7 @@ delete_record (gfdb_conn_node_t *_conn_node, if (ret) { gf_msg (GFDB_DATA_STORE, GF_LOG_ERROR, 0, LG_MSG_DELETE_FAILED, "Delete operation " - "failed!"); + "failed"); } } @@ -464,7 +464,7 @@ find_all(gfdb_conn_node_t *_conn_node, gf_query_callback_t query_callback, if (ret) { gf_msg (GFDB_DATA_STORE, GF_LOG_ERROR, 0, LG_MSG_FIND_OP_FAILED, "Find all operation " - "failed!"); + "failed"); } } @@ -511,7 +511,7 @@ find_unchanged_for_time(gfdb_conn_node_t *_conn_node, if (ret) { gf_msg (GFDB_DATA_STORE, GF_LOG_ERROR, 0, LG_MSG_FIND_OP_FAILED, "Find unchanged " - "operation failed!"); + "operation failed"); } } @@ -556,7 +556,7 @@ find_recently_changed_files(gfdb_conn_node_t *_conn_node, if (ret) { gf_msg (GFDB_DATA_STORE, GF_LOG_ERROR, 0, LG_MSG_FIND_OP_FAILED, - "Find changed operation failed!"); + "Find changed operation failed"); } } @@ -613,7 +613,7 @@ find_unchanged_for_time_freq(gfdb_conn_node_t *_conn_node, if (ret) { gf_msg (GFDB_DATA_STORE, GF_LOG_ERROR, 0, LG_MSG_FIND_OP_FAILED, - "Find unchanged with freq operation failed!"); + "Find unchanged with freq operation failed"); } } @@ -669,7 +669,7 @@ find_recently_changed_files_freq(gfdb_conn_node_t *_conn_node, if (ret) { gf_msg (GFDB_DATA_STORE, GF_LOG_ERROR, 0, LG_MSG_FIND_OP_FAILED, - "Find changed with freq operation failed!"); + "Find changed with freq operation failed"); } } @@ -683,35 +683,100 @@ find_recently_changed_files_freq(gfdb_conn_node_t *_conn_node, /*Libgfdb API Function: Clear the heat for all the files * * Arguments: - * _conn_node : GFDB Connection node + * conn_node : GFDB Connection node * * Returns : if successful return 0 or * -ve value in case of failure **/ int -clear_files_heat (gfdb_conn_node_t *_conn_node) { +clear_files_heat (gfdb_conn_node_t *conn_node) { int ret = 0; - gfdb_db_operations_t *db_operations_t = NULL; + gfdb_db_operations_t *db_operations = NULL; void *gf_db_connection = NULL; - CHECK_CONN_NODE(_conn_node); + CHECK_CONN_NODE(conn_node); - db_operations_t = &_conn_node->gfdb_connection.gfdb_db_operations; - gf_db_connection = _conn_node->gfdb_connection.gf_db_connection; + db_operations = &conn_node->gfdb_connection.gfdb_db_operations; + gf_db_connection = conn_node->gfdb_connection.gf_db_connection; - if (db_operations_t->clear_files_heat_op) { - ret = db_operations_t->clear_files_heat_op (gf_db_connection); + if (db_operations->clear_files_heat_op) { + ret = db_operations->clear_files_heat_op (gf_db_connection); if (ret) { gf_msg (GFDB_DATA_STORE, GF_LOG_ERROR, 0, LG_MSG_FIND_OP_FAILED, - "Clear files heat operation failed!"); + "Clear files heat operation failed"); + } + } + + return ret; +} + + +/* Libgfdb API Function: Function to extract version of the db + * Input: + * gfdb_conn_node_t *conn_node : GFDB Connection node + * char **version : the version is extracted as a string and will be stored in + * this variable. The freeing of the memory should be done by + * the caller. + * Return: + * On success return the lenght of the version string that is + * extracted. + * On failure return -1 + * */ +int +get_db_version (gfdb_conn_node_t *conn_node, char **version) +{ + int ret = 0; + gfdb_db_operations_t *db_operations = NULL; + void *gf_db_connection = NULL; + + CHECK_CONN_NODE(conn_node); + + db_operations = &conn_node->gfdb_connection.gfdb_db_operations; + gf_db_connection = conn_node->gfdb_connection.gf_db_connection; + + if (db_operations->get_db_version) { + ret = db_operations->get_db_version (gf_db_connection, + version); + if (ret < 0) { + gf_msg (GFDB_DATA_STORE, GF_LOG_ERROR, 0, + LG_MSG_FIND_OP_FAILED, + "Get version failed"); } } return ret; } +int +get_db_setting (gfdb_conn_node_t *conn_node, char *param_key, + char **param_value) +{ + int ret = -1; + gfdb_db_operations_t *db_operations = NULL; + void *gf_db_connection = NULL; + + CHECK_CONN_NODE(conn_node); + + db_operations = &conn_node->gfdb_connection.gfdb_db_operations; + gf_db_connection = conn_node->gfdb_connection.gf_db_connection; + + if (db_operations->get_db_setting) { + ret = db_operations->get_db_setting (gf_db_connection, + param_key, param_value); + if (ret < 0) { + gf_msg (GFDB_DATA_STORE, GF_LOG_ERROR, 0, + LG_MSG_FIND_OP_FAILED, + "Get setting failed"); + } + } + + return ret; +} + + + static const char *get_db_path_key() { @@ -725,7 +790,11 @@ void get_gfdb_methods (gfdb_methods_t *methods) methods->find_unchanged_for_time = find_unchanged_for_time; methods->find_recently_changed_files = find_recently_changed_files; methods->find_unchanged_for_time_freq = find_unchanged_for_time_freq; - methods->find_recently_changed_files_freq = find_recently_changed_files_freq; + methods->find_recently_changed_files_freq = + find_recently_changed_files_freq; + methods->clear_files_heat = clear_files_heat; + methods->get_db_version = get_db_version; + methods->get_db_setting = get_db_setting; methods->get_db_path_key = get_db_path_key; } |