Bug 1085149
Summary: | if CSV import fails, Beaker commits changes to system_status_duration instead of rolling back | ||
---|---|---|---|
Product: | [Retired] Beaker | Reporter: | Dan Callaghan <dcallagh> |
Component: | web UI | Assignee: | Dan Callaghan <dcallagh> |
Status: | CLOSED CURRENTRELEASE | QA Contact: | tools-bugs <tools-bugs> |
Severity: | unspecified | Docs Contact: | |
Priority: | unspecified | ||
Version: | 0.16 | CC: | aigao, asaha, dcallagh, rmancy, xjia |
Target Milestone: | 0.16.2 | ||
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2014-04-28 23:00:33 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Dan Callaghan
2014-04-08 01:44:12 UTC
On Gerrit: http://gerrit.beaker-project.org/3003 As far as I can tell the only side-effect of the failure to roll back is the corrupted system_status_duration rows, which causes an exception like the one in comment 0 when changing system status. To find systems with corrupted system_status_duration rows you can use this query: SELECT fqdn FROM system WHERE NOT EXISTS ( SELECT 1 FROM system_status_duration WHERE finish_time IS NULL AND system_id = system.id); To fix the bad rows you can clear the finish_time from the latest row: UPDATE system_status_duration INNER JOIN (SELECT MAX(id) max_id FROM system_status_duration GROUP BY system_id) x ON system_status_duration.id = max_id SET finish_time = NULL; Verify: 1. Secret=1 (1)Before importing: mysql> select id,fqdn from system where fqdn="test1"; +----+-------+ | id | fqdn | +----+-------+ | 35 | test1 | +----+-------+ 1 row in set (0.00 sec) mysql> select * from system_status_duration where id=35; +----+-----------+--------+---------------------+---------------------+ | id | system_id | status | start_time | finish_time | +----+-----------+--------+---------------------+---------------------+ | 35 | 14 | Broken | 2013-04-02 19:28:58 | 2013-04-02 19:28:58 | +----+-----------+--------+---------------------+---------------------+ 1 row in set (0.00 sec) (2)After importing mysql> select * from system_status_duration where system_id = 35 -> ; +-----+-----------+-----------+---------------------+---------------------+ | id | system_id | status | start_time | finish_time | +-----+-----------+-----------+---------------------+---------------------+ | 195 | 35 | Automated | 2013-10-17 08:36:14 | 2013-11-12 12:05:13 | | 259 | 35 | Broken | 2013-11-12 12:05:13 | 2014-02-13 03:16:40 | | 327 | 35 | Automated | 2014-02-13 03:16:40 | 2014-02-13 03:17:32 | | 328 | 35 | Broken | 2014-02-13 03:17:32 | 2014-04-15 05:32:22 | | 372 | 35 | Automated | 2014-04-15 05:32:22 | NULL | +-----+-----------+-----------+---------------------+---------------------+ 5 rows in set (0.00 sec) 2.secret=None [jason@dhcp-65-193 Downloads]$ cat system.csv csv_type,fqdn,deleted,lender,location,mac_address,memory,model,serial,vendor,arch,lab_controller,owner,secret,status,type,cc system,test1,False,test1,,1:1:1:2:2,,,,,x86_64,lab-devel-03.rhts.eng.bos.redhat.com,jinzhang,,Automated,Machine, (1)Before importing: mysql> select id,fqdn from system where fqdn="test1"; +----+-------+ | id | fqdn | +----+-------+ | 35 | test1 | +----+-------+ 1 row in set (0.00 sec) mysql> select * from system_status_duration where system_id = 35; +-----+-----------+-----------+---------------------+---------------------+ | id | system_id | status | start_time | finish_time | +-----+-----------+-----------+---------------------+---------------------+ | 195 | 35 | Automated | 2013-10-17 08:36:14 | 2013-11-12 12:05:13 | | 259 | 35 | Broken | 2013-11-12 12:05:13 | 2014-02-13 03:16:40 | | 327 | 35 | Automated | 2014-02-13 03:16:40 | 2014-02-13 03:17:32 | | 328 | 35 | Broken | 2014-02-13 03:17:32 | 2014-04-15 05:32:22 | | 372 | 35 | Automated | 2014-04-15 05:32:22 | 2014-04-15 05:44:43 | | 373 | 35 | Broken | 2014-04-15 05:44:43 | NULL | +-----+-----------+-----------+---------------------+---------------------+ (2)After importing: Show error message on Importing Page: Error Log Error importing line 2: test1: Invalid secret None mysql> select * from system_status_duration where system_id = 35; +-----+-----------+-----------+---------------------+---------------------+ | id | system_id | status | start_time | finish_time | +-----+-----------+-----------+---------------------+---------------------+ | 195 | 35 | Automated | 2013-10-17 08:36:14 | 2013-11-12 12:05:13 | | 259 | 35 | Broken | 2013-11-12 12:05:13 | 2014-02-13 03:16:40 | | 327 | 35 | Automated | 2014-02-13 03:16:40 | 2014-02-13 03:17:32 | | 328 | 35 | Broken | 2014-02-13 03:17:32 | 2014-04-15 05:32:22 | | 372 | 35 | Automated | 2014-04-15 05:32:22 | 2014-04-15 05:44:43 | | 373 | 35 | Broken | 2014-04-15 05:44:43 | NULL | +-----+-----------+-----------+---------------------+---------------------+ So move this bug to "VERIFIED" Beaker 0.16.2 has been released. |