diff options
author | Dan Lambright <dlambrig@redhat.com> | 2015-03-24 13:59:00 -0400 |
---|---|---|
committer | Niels de Vos <ndevos@redhat.com> | 2015-04-06 02:35:37 -0700 |
commit | 37bbcf6861590aa3d980846042855ee4212c89df (patch) | |
tree | 3f6ac3e4a627b25e424ab12b789d827858e2e334 /libglusterfs/src/gfdb | |
parent | 90f72efed8313efe0410634677f36d0fbdc5eab4 (diff) |
cluster/dht: fix tier.c problems found prior to feature freeze
This patch resolves tiering translator issues taken from the list
in bug 1203776. These issues have been selected to be fixed
first. The rest will be fixed in a subsequent patch (or are not a
problem).
3. Replace hardcoded #defines of promote/demote file names
6. Use loc_wipe() in migrate_using_query_file()
9. Only promote/demote files on the same node on which they reside.
14. Replace calloc with GF_CALLOC in tier.c and ensure freeing done
properly.
15. Handle if parse_query_str fails
22. Only load gfdb library on server side, remove SQL references
from client.
Change-Id: I6563b11e58ab2e4c6b1ce44db755781ad6d930fb
BUG: 1203776
Signed-off-by: Dan Lambright <dlambrig@redhat.com>
Reviewed-on: http://review.gluster.org/9987
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: N Balachandran <nbalacha@redhat.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Diffstat (limited to 'libglusterfs/src/gfdb')
-rw-r--r-- | libglusterfs/src/gfdb/gfdb_data_store.c | 12 | ||||
-rw-r--r-- | libglusterfs/src/gfdb/gfdb_data_store.h | 42 |
2 files changed, 53 insertions, 1 deletions
diff --git a/libglusterfs/src/gfdb/gfdb_data_store.c b/libglusterfs/src/gfdb/gfdb_data_store.c index b250ece91e4..ec92f7a4d20 100644 --- a/libglusterfs/src/gfdb/gfdb_data_store.c +++ b/libglusterfs/src/gfdb/gfdb_data_store.c @@ -8,6 +8,7 @@ cases as published by the Free Software Foundation. */ +#include "gfdb_sqlite3.h" #include "gfdb_data_store.h" #include "list.h" @@ -647,3 +648,14 @@ find_recently_changed_files_freq(gfdb_conn_node_t *_conn_node, return ret; } + +void get_gfdb_methods (gfdb_methods_t *methods) +{ + methods->init_db = init_db; + methods->fini_db = fini_db; + 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->dbpath = strdup(GFDB_SQL_PARAM_DBPATH); +} diff --git a/libglusterfs/src/gfdb/gfdb_data_store.h b/libglusterfs/src/gfdb/gfdb_data_store.h index ffe590b84bd..977794df5cb 100644 --- a/libglusterfs/src/gfdb/gfdb_data_store.h +++ b/libglusterfs/src/gfdb/gfdb_data_store.h @@ -24,7 +24,6 @@ #include <sys/time.h> #include "gfdb_data_store_types.h" -#include "gfdb_sqlite3.h" /* GFDB Connection Node: * ~~~~~~~~~~~~~~~~~~~~ @@ -52,6 +51,8 @@ typedef struct gfdb_conn_node_t gfdb_conn_node_t; gfdb_conn_node_t * init_db(dict_t *arg, gfdb_db_type_t db_type); +typedef gfdb_conn_node_t * (*init_db_t) (dict_t *args, + gfdb_db_type_t gfdb_db_type); @@ -65,6 +66,7 @@ init_db(dict_t *arg, gfdb_db_type_t db_type); int fini_db(gfdb_conn_node_t *); +typedef int (*fini_db_t) (gfdb_conn_node_t *_conn_node); @@ -138,6 +140,11 @@ int find_unchanged_for_time(gfdb_conn_node_t *, gf_query_callback_t query_callback, void *_query_cbk_args, gfdb_time_t *for_time); +typedef int (*find_unchanged_for_time_t) (gfdb_conn_node_t *_conn_node, + gf_query_callback_t query_callback, + void *_query_cbk_args, + gfdb_time_t *for_time); + @@ -157,6 +164,10 @@ int find_recently_changed_files(gfdb_conn_node_t *_conn, gf_query_callback_t query_callback, void *_query_cbk_args, gfdb_time_t *from_time); +typedef int (*find_recently_changed_files_t) (gfdb_conn_node_t *_conn_node, + gf_query_callback_t query_callback, + void *_query_cbk_args, + gfdb_time_t *from_time); @@ -186,6 +197,13 @@ int find_unchanged_for_time_freq(gfdb_conn_node_t *_conn, int read_freq_thresold, gf_boolean_t _clear_counters); +typedef int (*find_unchanged_for_time_freq_t) (gfdb_conn_node_t *_conn_node, + gf_query_callback_t query_callback, + void *_query_cbk_args, + gfdb_time_t *for_time, + int write_freq_thresold, + int read_freq_thresold, + gf_boolean_t _clear_counters); @@ -215,4 +233,26 @@ int find_recently_changed_files_freq(gfdb_conn_node_t *_conn, int read_freq_thresold, gf_boolean_t _clear_counters); +typedef int (*find_recently_changed_files_freq_t) (gfdb_conn_node_t *_conn_node, + gf_query_callback_t query_callback, + void *_query_cbk_args, + gfdb_time_t *from_time, + int write_freq_thresold, + int read_freq_thresold, + gf_boolean_t _clear_counters); + +typedef struct gfdb_methods_s { + init_db_t init_db; + fini_db_t fini_db; + find_unchanged_for_time_t find_unchanged_for_time; + find_recently_changed_files_t find_recently_changed_files; + find_unchanged_for_time_freq_t find_unchanged_for_time_freq; + find_recently_changed_files_freq_t find_recently_changed_files_freq; + char *dbpath; +} gfdb_methods_t; + +void get_gfdb_methods (gfdb_methods_t *methods); + +typedef void (*get_gfdb_methods_t) (gfdb_methods_t *methods); + #endif |