-
Notifications
You must be signed in to change notification settings - Fork 20
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
icingadb-migrate: handle NULL event time columns #551
Conversation
ScheduledStartTime int64 | ||
ScheduledStartTime sql.NullInt64 | ||
ScheduledEndTime int64 | ||
ActualStartTime int64 |
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.
According to #550 (comment), actual_start_time
also was NULL
. Might be worth looking at the schema which columns are allowed to be NULL
an handle all these.
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.
Isn't worth it IMAO. Everything that has a reason to be NULL is already handled.
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.
"a reason to be NULL" may also be "there was an old icinga2 version that had a bug that didn't populate that column"
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.
*rolling eyes* s/reason/actual reason/
I'd rather wait for that bug also arriving here.
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.
Isn't worth it IMAO. Everything that has a reason to be NULL is already handled.
It's worth it. This bug report is proof of that.
I'd rather wait for that bug also arriving here.
I would rather fix them before. We know that almost everyone had or has an Icinga 2 version that has bugs 😆.
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.
I'm afraid there could be NULL literally everywhere ex. IDs.
$ grep -Fwie 'NOT NULL' <lib/db_ido_mysql/schema/mysql.sql |grep -vFe _id
$
On the other hand there's only 1 report yet.
Still sure about the effort/gain ratio?
Ignore such rows.
As reaction to basically an additional report – #550 (comment) – I've handled ALL timestamps now. |
@Al2Klimov Please adjust PR title and description. |
Compiled the icingadb-migrate from this PR and there are still errors. Assuming when inserting into the pgsql database:
|
Good catch! But as far as I see, history.SlaHistoryDowntime#EndTime is always non-nil there. However, the struct field itself misses the correct DB column. |
created this PR with more changes, with those the migrate worked without issues: |
i.e. ignore such rows.
Edit
This is the
bestonly thing we can do here.