Edgewall Software
Modify

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#10535 closed defect (fixed)

[patch] TRAC DB flooded with useless entries

Reported by: Dirk Stöcker Owned by: Remy Blank
Priority: normal Milestone: 0.12.4
Component: general Version:
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description (last modified by Thijs Triemstra)

My trac database is flooded with lots of useless entries copying the default values. Especially as this is true for anonymous users the database really gets problems due to this. Below is a patch which prevents adding the timeline entries when they equal the defaults. This does not change beaviour of the software, but reduces required space.

The added 'ifs' simply tests if the new values equal the default and prevent storage. If different values are already stored, the default is nevertheless saved.

  • web_ui.

    old new  
    200200            data['context'] = rss_context                                                                                                                                                                     
    201201            return 'timeline.rss', data, 'application/rss+xml'                                                                                                                                               
    202202        else:                                                                                                                                                                                                 
    203             req.session['timeline.daysback'] = daysback                                                                                                                                                       
    204             req.session['timeline.authors'] = authors                                                                                                                                                         
     203            if(as_int(req.session.get('timeline.daysback',                                                                                                                                                   
     204            self.default_daysback), None) != daysback):                                                                                                                                                       
     205                req.session['timeline.daysback'] = daysback                                                                                                                                                   
     206            if(req.session.get('timeline.authors', '') != authors):                                                                                                                                           
     207                req.session['timeline.authors'] = authors                                                                                                                                                     
    205208            html_context = Context.from_request(req)
    206209            html_context.set_hints(wiki_flavor='oneliner',
    207210                                   shorten_lines=self.abbreviated_messages)

Attachments (0)

Change History (7)

in reply to:  description ; comment:1 by Remy Blank, 12 years ago

Replying to dstoecker:

This does not change beaviour of the software, but reduces required space.

That's not quite 100% true. It will change the behavior if the default values are changed in Trac at some point. This could actually be considered a feature.

in reply to:  1 comment:2 by Dirk Stöcker, 12 years ago

Replying to rblank:

Replying to dstoecker:

This does not change beaviour of the software, but reduces required space.

That's not quite 100% true. It will change the behavior if the default values are changed in Trac at some point. This could actually be considered a feature.

True. Actually I would consider it a feature.

comment:3 by Thijs Triemstra, 12 years ago

Description: modified (diff)

comment:4 by Dirk Stöcker, 12 years ago

Please apply that, so I don't need to carry that patch around in the future. This small patch increased the stability of my Trac instance a lot. sqlite gets speed troubles, when too many entries are in the session database and this patch prevents that issue.

comment:5 by Christian Boos, 12 years ago

Milestone: 0.12.4

comment:6 by Remy Blank, 12 years ago

Resolution: fixed
Status: newclosed

I have added a new method DetachedSession.set() in [11085] that takes the key, value and the default value, where the variable is removed from the session if its value is equal to the default value. This is then used in the timeline, diff prefs and wiki editor prefs.

comment:7 by Remy Blank, 12 years ago

Owner: set to Remy Blank

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Remy Blank.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Remy Blank to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.