Edgewall Software
Modify

Opened 15 years ago

Closed 15 years ago

#517 closed defect (fixed)

upgrade.migrate_logs_to_files() writes "xxx.log.level" but model.BuildLog.delete() removes "xxx.log.levels"

Reported by: wormyourhonor@… Owned by: dfraser
Priority: major Milestone: 0.6
Component: Infrastructure Version: 0.6b2
Keywords: Cc: dfraser, thomas.moschny@…
Operating System: Linux

Description

migrate_logs_to_files creates a log with a .level extension.

however, delete removes logs with .levels extension.

if system attempted to delete an old/pre-upgrade build, level logs would get left behind.

verdad?

Attachments (2)

filename-upgrade-517.patch (2.6 KB) - added by dfraser 15 years ago.
Patch that also fixes misnamed files from bad previous upgrade
filename-upgrade-517-2.patch (5.9 KB) - added by hodgestar 15 years ago.
Patch that renames all .log.level files in log_dir to .log.levels equivalents. Includes test.

Download all attachments as: .zip

Change History (12)

comment:1 Changed 15 years ago by anonymous

  • Summary changed from upgrdade.migrate_logs_to_files() writes "xxx.log.level" but model.BuildLog.delete() removes "xxx.log.levels" to upgrade.migrate_logs_to_files() writes "xxx.log.level" but model.BuildLog.delete() removes "xxx.log.levels"

comment:2 Changed 15 years ago by osimons

  • Milestone changed from 0.6.1 to 0.6
  • Owner set to osimons

In [714] I added deleting of files that was previously ignored - as part of #424. It sure seems like a typo for correct name for level file. I'll correct it.

comment:3 Changed 15 years ago by osimons

  • Cc dfraser added

Oh dear. In bitten.models.BuildLog.insert() we make files with .levels ending. And same with test cases that also use this ending. So an upgraded install will have both kinds... This inconsistency seems to be present all the way back to [590] where the logs where initially migrated to files. We definately should make this a contant in the models.py file to make sure we read and write the same ending.

We can assume all upgraded logs will have .level files, while all builds done since upgrade will use .levels. That said, I've never really looked into the pupose of this file or its use, and must say I'm a bit surprised that this inconsistency have not been noticed earlier. This suggests to me that these files have little or no use, but I'd like to hear from dfraser about that. #462 also touches on reorganizing how the log files are done, btw.

comment:4 Changed 15 years ago by dfraser

  • Owner changed from osimons to dfraser
  • Status changed from new to assigned

Fixed the upgrade script and added the constant suggested in r805

For the record, the levels are used, although minimally - there's a CSS class attached to the <code> element that displays the message of $info.level - so it just alters the style at present

Changed 15 years ago by dfraser

Patch that also fixes misnamed files from bad previous upgrade

comment:5 Changed 15 years ago by thomas.moschny@…

  • Cc thomas.moschny@… added

(trying to make it ham by adding some text)

comment:6 Changed 15 years ago by osimons

Looking at the patch, I don't think it will catch the cases with stray .level files. What if the script instead finds all the .level files, and either:

  • renames if a) a build exists in db, and b) a corresponding .levels file does not already exist (like if the build was deleted and then rebuilt)
  • or, deletes the file if there is nothing relevant in the db anymore

This should provide the file list:

wrong_files = [f for f in os.listdir(logs_dir) if f.endswith('.level')]

Changed 15 years ago by hodgestar

Patch that renames all .log.level files in log_dir to .log.levels equivalents. Includes test.

comment:7 Changed 15 years ago by hodgestar

Attached updated patch that updates all .log.level files found in logs_dir regardless of what log entries are in the database. Does not overwrite existing files. Includes test.

comment:8 Changed 15 years ago by osimons

Looks nice and simple. I see in my logs directory a lot of stray files (from invalidating, rebuilding and testing). Could we also make the assumption that if nnn.log does not exist, then nnn.log.levels is a stray file that can just be deleted?

comment:9 Changed 15 years ago by dfraser

Thanks hodgestar and osimons - yes nnn.log.levels should be deleted if nnn.log doesn't exist

comment:10 Changed 15 years ago by hodgestar

  • Resolution set to fixed
  • Status changed from assigned to closed

Fixed in trunk in r813. Final committed patch was similar to patch 2 but including changes to delete stray nnn.log.level files as suggested by osimons. Backported to 0.6dev along with r805 in commit r814.

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain dfraser.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.