PDA

View Full Version : Restoring to new database kills off old database



JtX
09-09-2010, 05:55 AM
I had a problem where one of my tables was corrupted in a way that didn't affect HEM functions, but the database could not be backuped after that. So I thought that I can do a restore, import hands from archive and compare the notes to see if I have got everything. So, when I did a restore to a new database, to my surprise the old database had disappeared.

This bug can be reproduced with 1.11.04 with following steps:

1. Make a backup of your database.
2. Restore the backup to same computer (backup needs to have the same database name as the database that will be deleted from PostGreSQL). If you have a HoldemManager-database in the backup and you restore to a new database called HEM, if there is already a HoldemManager-database on the server, it will be deleted.
3. After backup has been successfully restored, your database has been deleted (in this example, HoldemManager database would be deleted, but there would be a new database called HEM).

In my opinion this is a quite critical bug in the restore tool. Restoring anything from backups should NEVER result in data loss. If backup & restore tool can't be trusted, it's as good as it would not exist.

netsrak
09-09-2010, 08:54 AM
Thanks, i'll forward it.

B-Money
09-09-2010, 01:03 PM
I'm clear on what you are claiming, but when I follow your steps this image is my result.


Here I backed up my Winamax Database
When I restore the database I chose to "overwrite" old Database
When it prompted me to rename my database I left that box alone so it used the exact same Winamax name.


As you can see I now have 2 "Winamax" databases. The old one that was overwritten. Not overwritten, just has a name change, and my new Winamax database.

There's also options to not overwrite your database when restoring your database. Even if you chose to overwrite we give another prompt to rename your new database. Pretty sure I followed the path that could potentially delete your database but when I designed this with the Programmer we used the rule you talk about. NEVER DELETE DATA.

Is there a different method you used to make your old database disappear?
You also say it deleted your "HoldemManager" database. As you can see in the screen mine is still there and intact at the top.

-B

JtX
09-09-2010, 10:33 PM
I should probably have been even more clear on my first post.

I did not try to overwrite my old database, I restored the database under a new name. It doesn't ask anywhere do I want to overwrite the old one when I do it like that. It doesn't overwrite the old database, it destroys the old database.

I have a database on my computer named HoldemManager.
I make a backup.
I need to restore the database to my computer.
My old database still works, but not perfectly, I would like it to remain.
I restore my database under a new name, HEM.
End result, there's only a database named HEM remaining in the PostGreSQL server.

I made a small test database, where I imported only one day's hands and will provide the following pictures on my settings and what kind of databases there are on my PostGreSQL-database during the process. I'm sorry that I used Finnish pgAdmin III to do these pictures, I didn't find anywhere how I could get the software to use English. "Tietokannat" means "Databases" in English.

First image, Backup.png shows my backup settings.
Second image, Restoresettings.png shows my restore settings before pressing start restore.
Third image, RestoringToHoldemManagerTest.png shows that I restore to a new database and have given it a distinctive name that is not a database name I already have on my PostGreSQL server.
Fourth image, DuringRestore.png shows what happens during the restore, I had only time to refresh my database list in pgAdmin III (I had such a small database that it restored it in a few seconds) and it shows that it uses a tmp database to restore the database. So even when it says "Finished restore" in Holdem Manager Backup, pgAdmin database list has been updated during the restore.
Fifth image, AfterRestore.png shows what is the situation after restore. As you can see from my pgAdmin database listing, the HMTest-database has been deleted. There's no confirmation dialogs.

Can you please now take this report seriously, or do I need to do a video for you to believe that your restore tool actually can delete data without confirmation dialogs?

B-Money
09-10-2010, 12:34 PM
Thanks,

I was able to duplicate this. I have the contractor who wrote the tool scheduled to do some cleanup on the tool starting the week of the 19th.

I'll make sure this is in there.

I noticed it only deleted the database that it restored. So everything should still be there if the restore process was a success, right? Even so, you are correct, it should never remove a database like that without some kind of warning at least. I'll make sure it's fixed in his pass at fixing other bugs related to it.

Thanks for the detailed instructions.

-B

JtX
09-10-2010, 02:20 PM
I was able to duplicate this. I have the contractor who wrote the tool scheduled to do some cleanup on the tool starting the week of the 19th.

I'll make sure this is in there.

Great.


I noticed it only deleted the database that it restored. So everything should still be there if the restore process was a success, right? Even so, you are correct, it should never remove a database like that without some kind of warning at least. I'll make sure it's fixed in his pass at fixing other bugs related to it.

You're right, that if you make a backup and instantly make a restore, you don't lose any data if restore was successful. It only needs a database that is named the same in the backups than exists only on the server, it doesn't compare if they have exactly the same data before removing the database. Think about what happens if you restore a backup you made earlier to the same computer. If you would have for example two weeks old backup, you would have two weeks old data even if restore process was a success. In my case I think I lost only notes made to HM database, I'm not sure about did I lose any hands there. So I have first hand experience that this can result in lost data.

HowdyDoodee
09-12-2010, 04:42 PM
I did a backup and restore of my database.
Now I can not find my player name (or any player name).

I have optimized and then reindexed the database, same result.

Tried an export of hands. Nothing there now.

The database is there, but nothing is showing in HEM.

I have 3 backups from this last week. I was not worried about losing data in the process. Now I am worried that I lost my info for the last year.
VERSION: 1.11.05 beta 11

HowdyDoodee
09-12-2010, 06:03 PM
As a test, I have tried to use a table scanner.
All players are unknown (no stats).

Plan B: I have requested complete hand-histories from Pokerstars. I am going to rebuild the database. I cannot wait a week for the BackupUtility guy to get a fix.

This is a disaster for the Backup&Restore utility. It cannot be trusted. I am really concerned about this.

B-Money
09-13-2010, 12:30 PM
As a test, I have tried to use a table scanner.
All players are unknown (no stats).

Plan B: I have requested complete hand-histories from Pokerstars. I am going to rebuild the database. I cannot wait a week for the BackupUtility guy to get a fix.

This is a disaster for the Backup&Restore utility. It cannot be trusted. I am really concerned about this.

Are you positive HM is set to use the new database you just restored? This would be the first report of a restored database not having any players.


Did you get any errors when you backed everything up?
Did you get any errors when you restored the database?
When you backed up everything did you let it finish or did you stop it early?
How many hands were in your backed up database? IE, do you mine hands?


I wouldn't mind checking things out on a Team Viewer session if you can't figure it out. Send me a PM with your SKYPE info if this interests you.

HowdyDoodee
09-13-2010, 12:50 PM
Are you positive HM is set to use the new database you just restored? This would be the first report of a restored database not having any players.


Did you get any errors when you backed everything up?
Did you get any errors when you restored the database?
When you backed up everything did you let it finish or did you stop it early?
How many hands were in your backed up database? IE, do you mine hands?


I wouldn't mind checking things out on a Team Viewer session if you can't figure it out. Send me a PM with your SKYPE info if this interests you.

Absolutely positive it was using the database. In fact, importing old hands showed up as duplicates.

Zero errors in backup or restore.

I usually kick off the backup after I am done with the computer (and walk away). I know not to mess with this process, unless I am restarting it.

412+K hands. I finally just asked Pokerstars for the hands, and spent the rest of the evening rebuilding the database.


If this will help you, I will do the skype/teamviewer. But I have already rebuilt the database. I'd just like to know that this utility can be trusted in the future.
Thanks.

B-Money
09-13-2010, 01:25 PM
One other possibility is the stake filter is null until you open the main filters and Save/Close them.

So if you have a new stake in your database it won't show up until you enter the main filter screen and save/close it. (Another known issue)

If you are good on your new database, no need for a Team Viewer session. I am concerned about your restore not having anything in there. Either way, we will fix the removing of old database for sure and this should help.

Thanks for your feedback.

-B

JtX
10-05-2010, 07:55 PM
The backup & restore tool is still broken like this in 1.11.05 Beta 17 - is the fix scheduled for 1.11.05 final?

B-Money
10-05-2010, 08:27 PM
Not likely to make .05 Final; however, I do have files that you can replace to fix it. Let me know if you want them.

I'd personally use it as you normally would. Tell it to overwrite your old database and it currently backs that one up with a new file name.

-B