diff options
| author | Joseph Fernandes <josferna@redhat.com> | 2015-05-21 11:17:59 +0530 | 
|---|---|---|
| committer | Vijay Bellur <vbellur@redhat.com> | 2015-05-30 08:07:35 -0700 | 
| commit | 3b4980919bf23b952fa5155bc8f9d59613cbafb7 (patch) | |
| tree | 3e9e234eaf67ebd81d2aac6c7fc288a53bcd0c1c /libglusterfs | |
| parent | 0308c7a2800f52810093af780c42b6c6616c2aed (diff) | |
tier/tier.t: Fixing tier.t crash in regression runs
1) If the database file exists
   a. Dont try re-creating the db schema
   b. Dont try re-configuring the db.
2) Dont assert in fini_db () when connection is NULL
>> Signed-off-by: Joseph Fernandes <josferna@redhat.com>
>> Reviewed-on: http://review.gluster.org/10870
>> Tested-by: NetBSD Build System
>> Tested-by: Gluster Build System <jenkins@build.gluster.com>
>> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
>> Signed-off-by: Joseph Fernandes <josferna@redhat.com>
>>Change-Id: Idd2833f55caaa6b3a77d935d877d6c4d2994da6a
Change-Id: Ia2e044fce4e41bccc8fdada1cb21f240fdbd55df
BUG: 1225077
Signed-off-by: Joseph Fernandes <josferna@redhat.com>
Reviewed-on: http://review.gluster.org/10992
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Tested-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'libglusterfs')
| -rw-r--r-- | libglusterfs/src/gfdb/gfdb_data_store.c | 14 | ||||
| -rw-r--r-- | libglusterfs/src/gfdb/gfdb_sqlite3.c | 11 | 
2 files changed, 17 insertions, 8 deletions
diff --git a/libglusterfs/src/gfdb/gfdb_data_store.c b/libglusterfs/src/gfdb/gfdb_data_store.c index ec92f7a4d20..5699b750068 100644 --- a/libglusterfs/src/gfdb/gfdb_data_store.c +++ b/libglusterfs/src/gfdb/gfdb_data_store.c @@ -55,6 +55,16 @@ do {\          GF_ASSERT (_conn_node->gfdb_connection.gf_db_connection);\  } while (0) +/* Checks the sanity of the connection node and goto */ +#define CHECK_CONN_NODE_GOTO(_conn_node, label)\ +do {\ +        if (!_conn_node) {\ +                goto label;\ +        };\ +        if (!_conn_node->gfdb_connection.gf_db_connection) {\ +                goto label;\ +        };\ +} while (0)  /*Check if the conn node is first in the list*/  #define IS_FIRST_NODE(db_conn_list, _conn_node)\ @@ -297,7 +307,7 @@ fini_db (gfdb_conn_node_t *_conn_node)          int ret = -1;          gfdb_db_operations_t *db_operations_t   = NULL; -        CHECK_CONN_NODE(_conn_node); +        CHECK_CONN_NODE_GOTO (_conn_node, empty);          db_operations_t = &_conn_node->gfdb_connection.gfdb_db_operations; @@ -316,7 +326,7 @@ fini_db (gfdb_conn_node_t *_conn_node)                  gf_log (GFDB_DATA_STORE, GF_LOG_ERROR,                                  "Failed deleting connection node from list");          } - +empty:          ret = 0;  out:          return ret; diff --git a/libglusterfs/src/gfdb/gfdb_sqlite3.c b/libglusterfs/src/gfdb/gfdb_sqlite3.c index b9de3d3a3a6..02d60857498 100644 --- a/libglusterfs/src/gfdb/gfdb_sqlite3.c +++ b/libglusterfs/src/gfdb/gfdb_sqlite3.c @@ -436,9 +436,9 @@ gf_sqlite3_init (dict_t *args, void **db_conn) {          }          /* If the file exist we skip the config part -         * and create the schema if NOT Present*/ +         * and creation of the schema */          if (is_dbfile_exist) -                goto create_table; +                goto db_exists;          /*Apply sqlite3 params to database*/ @@ -450,17 +450,16 @@ gf_sqlite3_init (dict_t *args, void **db_conn) {                  goto out;          } -/*Create the schema if NOT present*/ -create_table: - +        /*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);                 goto out;          } -        ret = 0; +db_exists: +        ret = 0;  out:          if (ret) {                  gf_sqlite3_fini ((void **)&sql_conn);  | 
