## Forum archive 2000-2006

### Mark Schmitt - Strange DB Problem

by Arnold Pizer -
Number of replies: 0
 Strange DB Problem topic started 3/16/2004; 10:01:47 AMlast post 3/18/2004; 9:09:12 AM
Mark Schmitt - Strange DB Problem
3/16/2004; 10:01:47 AM (reads: 904, responses: 5)
One of my WeBWorK courses has just started exhibiting a strange Database error.  A phantom problem set has started showing up, called simply "Set"

I then get the following error roughly once for each student:

#### Compiler warnings:

* Use of uninitialized value in hash element at /usr/local/webwork/system/scripts/DBglue8.pl line 768.

##More details:

-------- main::getAllProbSetNumbersHash called at /usr/local/webwork/system/cgi/cgi-scripts/profLogin.pl line 102

--------------------------------------

Any idea what the culprit might be, and more importantly how to fix it?  Thanks in advance.

Mark

<| Post or View Comments |>

 Arnold K. Pizer - Re: Strange DB Problem  3/16/2004; 11:33:26 AM (reads: 1082, responses: 0) Hi Mark, This is something we have never seen before.  I do not know how to create a set with an empty name (using a set definition file called set.def is not allowed) so I have no idea  what happened. Here's what I would try.  1. Go to the housekeeping page and compress the gdbm database so that it's a managable size.  Note that this is something everyone should do once a month or so. 2. From the server, make a backup of the webwork_DB. It's in the DATA directory.  Just cp it to e.g.  webwork_DB_save.  If things go wrong, you can restore things by copying this back. 3. From the prof page, delete the set with an empty name using "Delete Problem Sets".  I'm assuming the set shows up there. 4. If this doesn't work, you can export the database in a human readable form.  Maybe that will give you a clue as to what happened.  You can even edit the file and then import it back but that certainly a last resort option.  In fact that is the only way I can think of to create this type of error. Arnie <| Post or View Comments |>

Mark Schmitt - Re: Strange DB Problem
3/16/2004; 12:10:14 PM (reads: 1083, responses: 0)
I tried to delete the problem set, and got the following error:

## Error: DBglue: getAllProbSetKeysForSet: Can't find index for set number

One reason you will see this error is if there are no existing problem sets.  For exampleyou will get this error if you delete all problem sets and then return to the prof page orif you login and then goto Begin Problem Set when no problem sets exist.  If this is thecase (i.e. you have deleted all sets), you can log into the server, goto the directory.../DATA/ and rename (or delete) the file webwork-database (MAKE SURE YOU ARE DELETING ORRENAMING THE webwork-database FOR THE CORRECT COURSE). Then when you go to the prof page,you will be able to build new problem sets.I never attempted to build a set without a name, so I'm not exactly sure how this happened.How exactly is the system pulling out the set names?  I suspect that could be a part of the problem.I've looked at a text version, and I don't see anything that makes me suspicious, but that doesn't mean the problem isn't in there.Mark

<| Post or View Comments |>

 Arnold K. Pizer - Re: Strange DB Problem  3/17/2004; 2:54:38 PM (reads: 1052, responses: 0) Hi Mark, The list of sets is grabed from the data base.  Are you  running standard code or have you altered your code somewhat?  Could that be the problem? Arnie <| Post or View Comments |>

 Mark Schmitt - Re: Strange DB Problem  3/18/2004; 6:32:16 AM (reads: 1029, responses: 0) Arnie, We're running standard code for all interactions with the database.  After talking with my teachers, it sounds like a problem set build went bad for some reason.  A teacher reported trying to build a set but having the server "hang" on the request.  The course involved is the same one that is having the problem, so I think that is the issue.  Any idea how I can purge the setname that seems to be in the DB, but that I can't seem to find in the text version? If not, I'll just live with the issue until the end of the school year and fix the course for the future. Thanks again, Mark<| Post or View Comments |>

 Arnold K. Pizer - Re: Strange DB Problem  3/18/2004; 9:09:12 AM (reads: 1051, responses: 0) Hi Mark, That sounds reasonable.  Probably the database got partiallly written when something died in midstream.  First definitely make a backup of the database or be anal and make two. Before you do this compress the database to make it a more managable size. Then run export_webwork-database.pl which will tell you the correct syntax (basically export_webwork-database.pl mth100 text_db). The very last entries in the text_db will be of the form:[set<>name1]   apizer = 597652   gage = 123456 where in your case I assume "name1",  the name of the offending set, is empty.  You should remove this list.  This might do it, but I'm not sure.  In fact you may well have to go to the next step. The next to last entries are of the form [login<>apizer]  name1=597652  name2=760524 which for each login gives the psvn's of the assigned sets.  In your case you might have to remove all the entries (if any) of the form   =12345  (i.e those with an empty name) I think the list of sets is generated bygetAllSetNumbersForStudentLoginHash which uses the above index.  To be absoluely sure, I would have to look at the code which I am not doing right now. If after doing this you still have problems, you might have to remove the stuff from the guts of the database. A typical entry looks like [597652] andt=1104562800 dudt=1104562800 opdt=884430000 pat1=0 pat2=0 pca1=0 pca2=0 pfn1=TA_evaluation_spring04.pg pfn2=WeBWorK_questionnaire_spring04.pg phfn= pia1=0 pia2=0 pmia1=-1 pmia2=-1 pse1=2447 pse2=20 pst1=0 pst2=0 pva1=0 pva2=0 shfn= stlg=74 stnm=name1 The last item  stnm=name1 identifies the name of the set which is associated to the given psvn (597652 in the example).  If you find any entries with  stnm= you might have to remove them, i.e. remove everything from [597652] to stnm=  . To leave the database absolutely clean, if you remove a psvn (e.g. 597652), you should remove all references to it.  A single psvn appears in three locations (under [set..., under [login..., and under itself [597652] After cleaning up the database, you can import it with import_webwork-database.pl Good luck, be careful, and keep backups.   Arnie <| Post or View Comments |>