-
Notifications
You must be signed in to change notification settings - Fork 442
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix storelogs #222
Fix storelogs #222
Conversation
pkg/db/interface.go
Outdated
// in worker_metrics. | ||
rows, err := d.db.Query( | ||
"SELECT worker_lastlogs.time, name, value FROM worker_lastlogs "+ | ||
"LEFT JOIN worker_metrics ON (worker_lastlogs.worker_id = worker_metrics.worker_id AND worker_lastlogs.time = worker_metrics.time) "+ |
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.
Why not using ` to make a multiple line string?
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.
Fixed.
The function has been storing into worker_metrics with duplicates and wrong timestamps for some time. The fix changes the worker_lastlogs DB table definition. DBs must be recreated. Signed-off-by: IWAMOTO Toshihiro <iwamoto@valinux.co.jp>
e4642ce
to
3c8a872
Compare
name VARCHAR(255), | ||
value TEXT, | ||
is_objective TINYINT, | ||
FOREIGN KEY (worker_id) REFERENCES workers(id) ON DELETE CASCADE)`) |
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.
Could you replace " +
to ` on other tables?
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.
My idea was to minimize the size of diff. It might be better to tidy all the things now. Just a sec.
…tting This patch make sure worker_* rows have matching row in the worker table. Also changes multi-line string formatting for readability. Signed-off-by: IWAMOTO Toshihiro <iwamoto@valinux.co.jp>
3c8a872
to
5861ad6
Compare
@toshiiw Great, Thanks! |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: YujiOshima The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This PR ensures worker logs are stored correctly.
Also tweak DB table definitions for consistency.
This change is