Edgewall Software

Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#6032 closed defect (worksforme)

Database Fried

Reported by: anonymous Owned by: Jonas Borgström
Priority: normal Milestone:
Component: general Version: 0.10.4
Severity: normal Keywords:
Cc: brett@… Branch:
Release Notes:
API Changes:
Internal Changes:

Description (last modified by Christian Boos)

Hi there I need help! our trac database is broken. I tried a restore and no go which is odd.. what can i do?

Traceback (most recent call last):
  File "/usr/lib/python2.3/site-packages/trac/web/main.py", line 387, in dispatch_request
  File "/usr/lib/python2.3/site-packages/trac/web/main.py", line 237, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/lib/python2.3/site-packages/trac/ticket/web_ui.py", line 127, in process_request
    self._do_create(req, db)
  File "/usr/lib/python2.3/site-packages/trac/ticket/web_ui.py", line 190, in _do_create
  File "/usr/lib/python2.3/site-packages/trac/ticket/model.py", line 170, in insert
    "VALUES (%s,%s,%s)", [(tkt_id, name, self[name])
  File "/usr/lib/python2.3/site-packages/trac/db/util.py", line 57, in executemany
    return self.cursor.executemany(sql_escape_percent(sql), args)
  File "/usr/lib/python2.3/site-packages/sqlite/main.py", line 276, in executemany
    self.execute(query, _i)
  File "/usr/lib/python2.3/site-packages/sqlite/main.py", line 255, in execute
    self.rs = self.con.db.execute(SQL % parms)
IntegrityError: columns ticket, name are not unique

Attachments (0)

Change History (13)

comment:1 by anonymous, 15 years ago

oh this is when I try to create a new ticket!

comment:2 by ThurnerRupert, 15 years ago

Resolution: worksforme
Status: newclosed

pls check out http://trac.edgewall.org/wiki/PySqlite#Checkifdatabaseisok, could be here in ticket/model.py and sqlite_backend.py:

 tkt_id = db.get_last_id(cursor, 'ticket')


    if have_pysqlite == 2:
        def get_last_id(self, cursor, table, column='id'):
            return cursor.lastrowid
        def get_last_id(self, cursor, table, column='id'):
            return self.cnx.db.sqlite_last_insert_rowid()

comment:3 by anonymous, 15 years ago

Resolution: worksforme
Status: closedreopened

none of these worked! any other ideas?

in reply to:  3 comment:4 by Emmanuel Blot, 15 years ago

Replying to anonymous:

none of these worked! any other ideas?

Which version of Trac are you using? If you're using a 0.10.x release, please be sure you're running the latest one (0.10.4)

comment:5 by anonymous, 15 years ago

I upgraded to 10.4 from 10.3 last night, same issue.

It looks like there is a duplicate entry in the database for some reason. is there a way to increment it by one so it starts with the next ticket number?

comment:6 by Christian Boos, 15 years ago

Description: modified (diff)

Duplicate custom field?

comment:7 by anonymous, 15 years ago

Version: 0.10.4

there are no custom fields to my knowlege, just a stock sqlite. I did take this over from another admin, I know we are using email2trac but I doubt that would have caused this. I can put the dbase someplace for you to download and look at if that would help

comment:8 by Christian Boos, 15 years ago

Eventually, yes, but the conf/trac.ini file as well. And if you're using a global trac.ini file, that one too.

I don't know the implementation details of email2trac, but if that is adding a custom field and you happen to have one defined somewhere you didn't expect (in the global trac.ini?), that might explain the error you're seeing.

comment:9 by anonymous, 15 years ago

strange.. nothings changed in over a year since implementation of it. Here is a tar file of our entire trac setup, the trac.db is under trac/gawker_trac_emv/db

ok I can't put a URL in, cause its spam, I'll reply to a msg you sent with the url

comment:10 by anonymous, 15 years ago

hey there wondeing if there is an update on this?

what I don't understand if I restore to an earlier dbase it's still the same problem!

comment:11 by Christian Boos, 15 years ago

I was able to reproduce the problem - stay tuned.

comment:12 by Christian Boos, 15 years ago

Resolution: worksforme
Status: reopenedclosed

Looks like you had several "incomplete" tickets:

sqlite> select max(id) from ticket;
sqlite> select max(ticket) from ticket_custom;
sqlite> select * from ticket_custom where ticket = 2485;
2485|sites|All Sites

The next New Ticket will pick the id 2485, and there are already values for the custom fields for that ticket. There are also attachments, by the way, but I'm not sure they are meaningfull (see select * from attachment where id > 2484;).

What you can do is to clean-up the ticket_custom table (delete from ticket_custom where id > 2484), then create a bunch of tickets (until 2499) and try to retrieve their meaning by looking at the attachments. Or simpler, if the attachments are garbage as well, also clean-up the attachment table the same way.

I've seen that you're using email2trac, so you may want to investigate in that direction for the original cause of the problem.

comment:13 by anonymous, 15 years ago

thank you.. after I updated the ticket yesterday I decided to restore to an older version and clean up the extra tickets, but this is great info in case it happens again!

thanks guys

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Jonas Borgström.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jonas Borgström 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.