-
Notifications
You must be signed in to change notification settings - Fork 938
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to adapt to support for sqlite
, in which case there is no OrchestratorMySQLHost
nor OrchestratorMySQLPort
.
I'd like to please properly visualize the case where config.Config.IsSQLite
Regardless, you've created the columns NULL
-able -- how does the app react when the values are NULL
?
I'd advise NOT NULL
columns, as the golang
handling of NULL
values is so dirty. An empty value for hostname is a great hint for "no value".
go/db/db.go
Outdated
` | ||
ALTER TABLE node_health | ||
ADD COLUMN mysql_backend_hostname varchar(128) CHARACTER SET ascii, | ||
ADD COLUMN mysql_backend_port smallint UNSIGNED |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
columns are NULL
-able
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think of using NOT NULL DEFAULT "" and NOT NULL DEFAULT 0 respectively?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was my suggestion in the comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool. I will then test this and also add support for sqlite
go/process/health_dao.go
Outdated
AppVersion: m.GetString("app_version"), | ||
FirstSeenActive: m.GetString("first_seen_active"), | ||
LastSeenActive: m.GetString("last_seen_active"), | ||
MySQLBackendHostname: m.GetString("mysql_backend_hostname"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if column was NULL
?
go/process/health_dao.go
Outdated
FirstSeenActive: m.GetString("first_seen_active"), | ||
LastSeenActive: m.GetString("last_seen_active"), | ||
MySQLBackendHostname: m.GetString("mysql_backend_hostname"), | ||
MySQLBackendPort: m.GetInt("mysql_backend_port"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comments inline
go/process/health_dao.go
Outdated
db_backend = config.Config.SQLite3DataFile | ||
} else { | ||
db_backend = config.Config.MySQLOrchestratorHost + ":" + | ||
fmt.Sprintf("%d", config.Config.MySQLOrchestratorPort) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick, but the golang
way, since you've already chosen fmt
, is:
db_backend = fmt.Sprintf("%s:%d", config.Config.MySQLOrchestratorHost, config.Config.MySQLOrchestratorPort)
while at it, please change db_backend
to dbBackend
. golang
's naming conventions use camelBack
In order to not have to manually check which mysql backend (host:port) orchestrator is configured to talk to but rather see it on the GUI under /web/status.