summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/gfdb/gfdb_sqlite3_helper.c
diff options
context:
space:
mode:
authorJoseph Fernandes <josferna@redhat.com>2015-12-15 18:29:06 +0530
committerDan Lambright <dlambrig@redhat.com>2015-12-22 07:14:10 -0800
commit439de31320315872d988720991e9baaead8712db (patch)
treeaf9003c4b83ad4983c2597c44f5c476664934074 /libglusterfs/src/gfdb/gfdb_sqlite3_helper.c
parent074158e7081ff0118c719aac7cf1bcde92ee8f7d (diff)
ctr/sql: Providing for vol set for sqlcachesize and sqlWALsize and skip recording path
1. Providing vol set option for cache size and wal autocheck point so that performance can be tuned. 2. Removed recording of file path in the db. Trimming database columns. Path need not be stored in the db, as PARGFID, GFID, Basename is suffice to derive the path during migration. Change-Id: I2cb590451a6d244bc91fe66c6dbffe2c2059dfb8 BUG: 1293034 Signed-off-by: Joseph Fernandes <josferna@redhat.com> Reviewed-on: http://review.gluster.org/12972 Reviewed-by: N Balachandran <nbalacha@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Tested-by: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Dan Lambright <dlambrig@redhat.com> Tested-by: Dan Lambright <dlambrig@redhat.com>
Diffstat (limited to 'libglusterfs/src/gfdb/gfdb_sqlite3_helper.c')
-rw-r--r--libglusterfs/src/gfdb/gfdb_sqlite3_helper.c42
1 files changed, 6 insertions, 36 deletions
diff --git a/libglusterfs/src/gfdb/gfdb_sqlite3_helper.c b/libglusterfs/src/gfdb/gfdb_sqlite3_helper.c
index 17480e1ff4a..906fdd261f7 100644
--- a/libglusterfs/src/gfdb/gfdb_sqlite3_helper.c
+++ b/libglusterfs/src/gfdb/gfdb_sqlite3_helper.c
@@ -319,7 +319,6 @@ gf_sql_insert_link (gf_sql_connection_t *sql_conn,
char *gfid,
char *pargfid,
char *basename,
- char *basepath,
gf_boolean_t link_consistency,
gf_boolean_t ignore_errors)
{
@@ -329,16 +328,15 @@ gf_sql_insert_link (gf_sql_connection_t *sql_conn,
sprintf (insert_str, "INSERT INTO "
GF_FILE_LINK_TABLE
- " (GF_ID, GF_PID, FNAME, FPATH,"
+ " (GF_ID, GF_PID, FNAME,"
" W_DEL_FLAG, LINK_UPDATE) "
- " VALUES (?, ?, ?, ?, 0, %d);",
+ " VALUES (?, ?, ?, 0, %d);",
link_consistency);
CHECK_SQL_CONN (sql_conn, out);
GF_VALIDATE_OR_GOTO (GFDB_STR_SQLITE3, gfid, out);
GF_VALIDATE_OR_GOTO (GFDB_STR_SQLITE3, pargfid, out);
GF_VALIDATE_OR_GOTO (GFDB_STR_SQLITE3, basename, out);
- GF_VALIDATE_OR_GOTO (GFDB_STR_SQLITE3, basepath, out);
/*Prepare statement*/
ret = sqlite3_prepare (sql_conn->sqlite3_db_conn, insert_str, -1,
@@ -387,26 +385,14 @@ gf_sql_insert_link (gf_sql_connection_t *sql_conn,
goto out;
}
- /*Bind basepath*/
- ret = sqlite3_bind_text (insert_stmt, 4, basepath, -1, NULL);
- if (ret != SQLITE_OK) {
- 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;
- }
-
/*Execute the prepare statement*/
if (sqlite3_step (insert_stmt) != SQLITE_DONE) {
gf_msg (GFDB_STR_SQLITE3,
_gfdb_log_level (GF_LOG_ERROR, ignore_errors),
0, LG_MSG_EXEC_FAILED,
"Failed executing the prepared "
- "stmt %s %s %s %s %s : %s",
- gfid, pargfid, basename, basepath, insert_str,
+ "stmt %s %s %s %s : %s",
+ gfid, pargfid, basename, insert_str,
sqlite3_errmsg (sql_conn->sqlite3_db_conn));
ret = -1;
goto out;
@@ -425,7 +411,6 @@ gf_sql_update_link (gf_sql_connection_t *sql_conn,
char *gfid,
char *pargfid,
char *basename,
- char *basepath,
char *old_pargfid,
char *old_basename,
gf_boolean_t link_consistency,
@@ -437,16 +422,15 @@ gf_sql_update_link (gf_sql_connection_t *sql_conn,
sprintf (insert_str, "INSERT INTO "
GF_FILE_LINK_TABLE
- " (GF_ID, GF_PID, FNAME, FPATH,"
+ " (GF_ID, GF_PID, FNAME,"
" W_DEL_FLAG, LINK_UPDATE) "
- " VALUES (? , ?, ?, ?, 0, %d);",
+ " VALUES (? , ?, ?, 0, %d);",
link_consistency);
CHECK_SQL_CONN (sql_conn, out);
GF_VALIDATE_OR_GOTO (GFDB_STR_SQLITE3, gfid, out);
GF_VALIDATE_OR_GOTO (GFDB_STR_SQLITE3, pargfid, out);
GF_VALIDATE_OR_GOTO (GFDB_STR_SQLITE3, basename, out);
- GF_VALIDATE_OR_GOTO (GFDB_STR_SQLITE3, basepath, out);
GF_VALIDATE_OR_GOTO (GFDB_STR_SQLITE3, old_pargfid, out);
GF_VALIDATE_OR_GOTO (GFDB_STR_SQLITE3, old_basename, out);
@@ -513,17 +497,6 @@ gf_sql_update_link (gf_sql_connection_t *sql_conn,
goto out;
}
- /*Bind new basepath*/
- ret = sqlite3_bind_text (insert_stmt, 4, basepath, -1, NULL);
- if (ret != SQLITE_OK) {
- 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;
- }
-
/*Execute the prepare statement*/
if (sqlite3_step (insert_stmt) != SQLITE_DONE) {
gf_msg (GFDB_STR_SQLITE3,
@@ -805,7 +778,6 @@ gf_sql_insert_wind (gf_sql_connection_t *sql_conn,
ret = gf_sql_insert_link(sql_conn,
gfid_str, pargfid_str,
gfdb_db_record->file_name,
- gfdb_db_record->file_path,
gfdb_db_record->link_consistency,
_gf_true);
if (ret) {
@@ -869,7 +841,6 @@ gf_sql_insert_wind (gf_sql_connection_t *sql_conn,
ret = gf_sql_update_link (sql_conn, gfid_str,
pargfid_str,
gfdb_db_record->file_name,
- gfdb_db_record->file_path,
old_pargfid_str,
gfdb_db_record->old_file_name,
gfdb_db_record->
@@ -891,7 +862,6 @@ gf_sql_insert_wind (gf_sql_connection_t *sql_conn,
ret = gf_sql_insert_link (sql_conn,
gfid_str, pargfid_str,
gfdb_db_record->file_name,
- gfdb_db_record->file_path,
gfdb_db_record->
link_consistency,
gfdb_db_record->ignore_errors);