Opened 17 years ago
Closed 17 years ago
#3115 closed enhancement (fixed)
HouseKeeper - Add cleanup of tvchain table
Reported by: | Owned by: | cpinkham | |
---|---|---|---|
Priority: | minor | Milestone: | unknown |
Component: | mythtv | Version: | head |
Severity: | low | Keywords: | |
Cc: | Ticket locked: | no |
Description
Housekeeping: HouseKeeper::CleanupOldLivetvChains?(void)
Entries in the tvchain DB table are usually cleaned up properly, but occasionally if the frontend/backend crashes etc. there can be orphaned entries in the tvchain db table. This probably doesn't happen much for normal usage but livetv is used for testing a lot and many devs have many orphaned entries.
Attached is a housekeeping patch that cleans up any orphaned tvchains left in the table. It runs once a day and is fairly conservative in what it deletes. It only deletes tvchains that don't have any endtimes that are more recent than four hours ago. Seems to work fine here but needs review.
Attachments (4)
Change History (9)
Changed 17 years ago by
Attachment: | myth_clean_tvchain.diff added |
---|
comment:1 Changed 17 years ago by
Please hold off on this, there may be a problem. I will re-open this ticket later.
comment:2 Changed 17 years ago by
Severity: | medium → low |
---|---|
Type: | patch → enhancement |
I have added an updated version. It fixes two issues:
- bindValue() was adding extra quoting that was causing problems. Switched to QString().
- there was a small window between the two queries where a new livetv chain could be created and then erroneously deleted. The check against 'endtime' in the delete query should protect against that. (That points out another problem! I'll upload a third version shortly :)
Changed 17 years ago by
Attachment: | myth_clean_tvchain3.diff added |
---|
Final update - Don't use TRUNCATE to protect against race with new livetv chain being created after the first select call and before the delete.
Changed 17 years ago by
Attachment: | myth_clean_tvchain4.diff added |
---|
Give the function a more accurate name: CleanupOldLivetvChains?() to CleanupOrphanedLivetvChains?()
comment:3 Changed 17 years ago by
Owner: | changed from Isaac Richards to cpinkham |
---|
comment:4 Changed 17 years ago by
Version: | 0.20 → head |
---|
housekeeper: cleanup tvchain table