data_too_old - handle incorrect or missing timestamp values
macbre opened this issue · 1 comments
macbre commented
File "/opt/wikia/index-digest/indexdigest/linters/linter_0028_data_too_old.py", line 70, in check_data_too_old
diff = now - timestamps.get('min')
TypeError: unsupported operand type(s) for -: 'int' and 'NoneType'
>SELECT /* index-digest */ UNIX_TIMESTAMP(MIN(`old_timestamp`)) as `min`, UNIX_TIMESTAMP(MAX(`old_timestamp`)) as `max` FROM text;
+------+-------------------+
| min | max |
+------+-------------------+
| NULL | 1137507540.000000 |
+------+-------------------+
1 row in set, 1 warning (0.00 sec)
>show warnings;
+---------+------+------------------------------+
| Level | Code | Message |
+---------+------+------------------------------+
| Warning | 1292 | Incorrect datetime value: '' |
+---------+------+------------------------------+
1 row in set (0.00 sec)
`wl_notificationtimestamp` varchar(14) CHARACTER SET latin1 COLLATE latin1_bin DEFAULT NULL,
...
`old_timestamp` varchar(14) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '',
macbre commented
mysql> select * from 0028_revision;
+--------+----------------+
| rev_id | rev_timestamp |
+--------+----------------+
| 1 | 20180101000000 |
| 2 | 2018010 |
+--------+----------------+
2 rows in set (0,00 sec)
mysql> SELECT /* index-digest */ UNIX_TIMESTAMP(MIN(`rev_timestamp`)) as `min`, UNIX_TIMESTAMP(MAX(`rev_timestamp`)) as `max` FROM 0028_revision;
+------+-------------------+
| min | max |
+------+-------------------+
| NULL | 1514761200.000000 |
+------+-------------------+
1 row in set, 1 warning (0,00 sec)
mysql> show warnings;
+---------+------+-----------------------------------------------------------------+
| Level | Code | Message |
+---------+------+-----------------------------------------------------------------+
| Warning | 1292 | Incorrect datetime value: '2018010\x00\x00\x00\x00\x00\x00\x00' |
+---------+------+-----------------------------------------------------------------+
1 row in set (0,00 sec)