#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 )
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 200 200 data['context'] = rss_context 201 201 return 'timeline.rss', data, 'application/rss+xml' 202 202 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 205 208 html_context = Context.from_request(req) 206 209 html_context.set_hints(wiki_flavor='oneliner', 207 210 shorten_lines=self.abbreviated_messages)
Attachments (0)
Change History (7)
follow-up: 2 comment:1 by , 13 years ago
comment:2 by , 13 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 , 13 years ago
Description: | modified (diff) |
---|
comment:4 by , 13 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 , 13 years ago
Milestone: | → 0.12.4 |
---|
comment:6 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
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 , 12 years ago
Owner: | set to |
---|
Replying to dstoecker:
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.