Adding debugging to index creation (#7053)

* Adding debugging to index creation

* Fixing debug stmt

* Fixing debug stmt
Этот коммит содержится в:
Corey Hulen
2017-08-03 14:03:29 -07:00
коммит произвёл GitHub
родитель 304377c427
Коммит 2dbe30cba3

Просмотреть файл

@@ -557,9 +557,9 @@ func (ss *SqlSupplier) createIndexIfNotExists(indexName string, tableName string
} }
if utils.Cfg.SqlSettings.DriverName == model.DATABASE_DRIVER_POSTGRES { if utils.Cfg.SqlSettings.DriverName == model.DATABASE_DRIVER_POSTGRES {
_, err := ss.GetMaster().SelectStr("SELECT $1::regclass", indexName) _, errExists := ss.GetMaster().SelectStr("SELECT $1::regclass", indexName)
// It should fail if the index does not exist // It should fail if the index does not exist
if err == nil { if errExists == nil {
return false return false
} }
@@ -571,8 +571,9 @@ func (ss *SqlSupplier) createIndexIfNotExists(indexName string, tableName string
query = "CREATE " + uniqueStr + "INDEX " + indexName + " ON " + tableName + " (" + columnName + ")" query = "CREATE " + uniqueStr + "INDEX " + indexName + " ON " + tableName + " (" + columnName + ")"
} }
_, err = ss.GetMaster().ExecNoTimeout(query) _, err := ss.GetMaster().ExecNoTimeout(query)
if err != nil { if err != nil {
l4g.Critical(utils.T("store.sql.create_index.critical"), errExists)
l4g.Critical(utils.T("store.sql.create_index.critical"), err) l4g.Critical(utils.T("store.sql.create_index.critical"), err)
time.Sleep(time.Second) time.Sleep(time.Second)
os.Exit(EXIT_CREATE_INDEX_POSTGRES) os.Exit(EXIT_CREATE_INDEX_POSTGRES)