diff options
| author | Joseph Fernandes <josferna@redhat.com> | 2015-08-27 17:23:07 +0530 |
|---|---|---|
| committer | Dan Lambright <dlambrig@redhat.com> | 2015-09-08 05:13:00 -0700 |
| commit | 96af474045c9ba5ab74ca76daa823d91a0a0c610 (patch) | |
| tree | b9f8991807f1d5a41eee82ff69788161af815e72 /libglusterfs/src/gfdb/gfdb_sqlite3.c | |
| parent | 9efce73fb31d520706a6d47de4daa4fb3366e6a6 (diff) | |
tier/ctr: Solving DB Lock issue due to write contention from db connections
Problem: The DB on the brick is been accessed by CTR, for write and
tier migrator, for read and write. The write from tier migrator is reseting
the heat counters after a cycle. Since we are using sqlite, two connections
trying to write would cause a db lock contention. As a result CTR used to fail
to update the db.
Solution: Using the same db connection of CTR for reseting the heat counters.
1) Introducted a new IPC FOP for CTR
2) After the query do a ipc syncop to the underlying client xlator associated
to the brick.
3) CTR in brick will catch the IPC FOP and cleat the heat counters.
Change-Id: I53306bfc08dcdba479deb4ccc154896521336150
BUG: 1260730
Signed-off-by: Joseph Fernandes <josferna@redhat.com>
Reviewed-on: http://review.gluster.org/12031
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Dan Lambright <dlambrig@redhat.com>
Tested-by: Dan Lambright <dlambrig@redhat.com>
Diffstat (limited to 'libglusterfs/src/gfdb/gfdb_sqlite3.c')
| -rw-r--r-- | libglusterfs/src/gfdb/gfdb_sqlite3.c | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/libglusterfs/src/gfdb/gfdb_sqlite3.c b/libglusterfs/src/gfdb/gfdb_sqlite3.c index 4b1163d3ce4..f5f494f53a7 100644 --- a/libglusterfs/src/gfdb/gfdb_sqlite3.c +++ b/libglusterfs/src/gfdb/gfdb_sqlite3.c @@ -248,6 +248,8 @@ gf_sqlite3_fill_db_operations(gfdb_db_operations_t *gfdb_db_ops) gf_sqlite3_find_unchanged_for_time_freq; gfdb_db_ops->find_recently_changed_files_freq_op = gf_sqlite3_find_recently_changed_files_freq; + + gfdb_db_ops->clear_files_heat_op = gf_sqlite3_clear_files_heat; } @@ -726,15 +728,6 @@ gf_sqlite3_find_recently_changed_files(void *db_conn, goto out; } - /*Clear freq counters of un-selected data*/ - ret = gf_sql_clear_counters(sql_conn); - if (ret) { - gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0, - LG_MSG_CLEAR_COUNTER_FAILED, "Failed clearing" - " counters!"); - goto out; - } - ret = 0; out: sqlite3_finalize(prep_stmt); @@ -820,15 +813,6 @@ gf_sqlite3_find_unchanged_for_time (void *db_conn, goto out; } - /*Clear freq counters of un-selected data*/ - ret = gf_sql_clear_counters(sql_conn); - if (ret) { - gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0, - LG_MSG_CLEAR_COUNTER_FAILED, "Failed clearing" - " counters!"); - goto out; - } - ret = 0; out: sqlite3_finalize(prep_stmt); @@ -1134,3 +1118,26 @@ out: sqlite3_finalize(prep_stmt); return ret; } + + +int +gf_sqlite3_clear_files_heat (void *db_conn) +{ + int ret = -1; + gf_sql_connection_t *sql_conn = db_conn; + + CHECK_SQL_CONN (sql_conn, out); + + ret = gf_sql_clear_counters (sql_conn); + if (ret) { + gf_msg (GFDB_STR_SQLITE3, GF_LOG_ERROR, 0, + LG_MSG_CLEAR_COUNTER_FAILED, "Failed clearing " + "files heat!"); + goto out; + } + + ret = 0; +out: + return ret; +} + |
