New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIN1250 characters in triggers/procedures CORRUPTING databases (at backup/restore) [CORE4723] #5030
Comments
Commented by: PizzaProgram Ltd. (szakilaci) Screenshot: |
Modified by: PizzaProgram Ltd. (szakilaci)summary: WIN1250 characters in triggers/procedures may CORRUPTING databases (maybe at backup/restore) => WIN1250 characters in triggers/procedures CORRUPTING databases (at backup/restore) |
Commented by: @mrotteveel This looks more like a support question than a bug report. I'd suggest you post to the firebird-support mailinglist. You say that you -fix_metadata on every restore. You really should not do that! It is the (probable) cause of the problem you describe. You should use it only once, and only when you know that your metadata is actually in the wrong character set. Once applied, the metadata is in utf-8 and if you reapply -fix_metadata , the bytes are read as win1250 (and not as utf8) and then written out as utf-8, so essentially you are continually reinterpreting (and therefor corrupting) the characters. fix_metadata cannot "detect" that it is in the wrong character set: you are explicitly instructing Firebird to use the wrong character set, and in the end the only difference between character sets is in the way bytes (or combinations of bytes) are interpreted as characters. |
Commented by: PizzaProgram Ltd. (szakilaci) Yes, I think this is a bug. Using a simple backup-restore procedure by using the official gbak.exe program should NOT corrupt the database ! ... >> IF << it's really THAT causing the problem.1.) it is NOT possible to know for us, end users: 2.) IMHO the gbak.exe itself should recognize that, (I've thought database files already containing such a variable to recognize the current charset since FB changed to metadata to Unicode ... are you telling me they don't? Than HOW do they know, how to interpret the data stored inside themselves?) |
Commented by: PizzaProgram Ltd. (szakilaci) THANK YOU !!! |
Commented by: @asfernandes First thing: you created the bug, when not understood things and started to put invalid characters in database. Firebird 2.1 just allowed it. Second, you didn't read the documentation and are using things incorrectly. |
Commented by: PizzaProgram Ltd. (szakilaci) Yes, I have red ALL the documentation about fix_metadata. Also reported a bug once before about it, and you guys fixed it nicely from 2.5.2 > to 2.5.3. from gbak help: ... no word mentioning something about: from Relase notes 2.5.3: ... again: no word mentioning something about: Page 40 Page 100 Page 109 >> even RECOMMENDS it (because I've used the old /misc/upgrade/metadata scripts sometimes So blaming me for this alone ... is not very nice. |
Commented by: PizzaProgram Ltd. (szakilaci) But I don't want to argue, because Firebird is GREAT !!! I love it, use it since version 0.9, donated for it, (and will again) etc. Many thanks for doing this great work. I just would like to see this bug fixed. Because I had no sleep since than. That's all. THANK YOU ! |
Commented by: PizzaProgram Ltd. (szakilaci) Can Anyone verify (by downloading the example DB) that the error occurred because the -fix_metadata switches? |
Commented by: Sean Leyne (seanleyne) @mark and Adriano, While I agree that the issue is caused by needlessly using the "fix_fss_xxx" switches over-and-over, so there is no technical/engine bug. I believe that Laszlo comment about the documentation not advising on the "one time use" is an issue, so this case should be changed to a documentation case, no? IMO, the subject/description of the case should read "Multiple use of GBAK/Restore "-fix_fss_xxx" switches can lead to corrupted metadata", OK? |
Commented by: PizzaProgram Ltd. (szakilaci) @sean Leyne So the only "way" to test it, to TEST it twice: Ignoring the -fss_... switches inside gbak.exe while restoring a converted backup file would be the most clear and user-friendly solution. Personally, as a programmer myself I do not really understand, how did it happen, that the backup/restore procedure does not log this conversion event, to prevent of misusing such a destructive option twice. |
Commented by: @asfernandes Data in one character set may be valid in another character set and mean something completely different. You should know your data or your access (read/write) pattern of your applications, operating systems, etc. There is no such a thing as detect an invalid (in the meaning of it don't being what you want) data. If it's really invalid (in bytes, not the glyphs you expect), a restore without fix options will tell you what it knows, i.e., that it's invalid. |
Commented by: PizzaProgram Ltd. (szakilaci) I assumed that too, that auto-recognizing an invalid charset would not be so easy. So basically it's ca. 5 lines of code: While running a restore:1. Try to READ out boolean from backup file's metadata: FIX_FSS_ONCE_ALREADY_APPLIED 1.1: IF (it's already Exists) >>>>>> 1.2: IF (it does not Exists) AND (Fix_fss_ switch presents) >>>>>> |
Commented by: Sean Leyne (seanleyne) Laszlo, It seems that you are alone in thinking that: So, I don't see this case proceeding as you would like. Accordingly, unless there are objections raised by other community members by the end of April 2015, this case will be closed as "Won't Fix". |
Commented by: @hvlad Adriano, we already discussed this issue in the past and there was no good solution found. |
Commented by: PizzaProgram Ltd. (szakilaci) Dear Vlad, PS: as soon as it's done, would be nice to mention that in the documentation too ;) |
Commented by: Sean Leyne (seanleyne) Vlad pointer to CORE3336 makes it clear that this issue is a duplicate, so this item should be closed and any further discussion/comments be added to the older/first reported issue. |
Modified by: Sean Leyne (seanleyne)status: Open [ 1 ] => Resolved [ 5 ] resolution: Duplicate [ 3 ] |
Commented by: @asfernandes Let's recap... v2.1 has released many years ago. In it, we developed a upgrade script, because conversion of character set in DDL operations was fixed. But it still allowed users to do bad things. It also had some problems with blobs. Then v2.5 has released, also many years ago. Since it didn't allowed bad data anymore, and we didn't want people migrating from 2.0 to 2.5 directly to need to migrate to 2.1 to fix data, we developed the gbak options. So many and many people did the right thing, which were supposed to be done when migrating from 2.0 to 2.1. Two users had problems. Do you still think an effort should be put on this? It seems that the only correct approach is to treat v2.5 databases as having good data. But users who known what the GBAK options are already know that. |
Commented by: PizzaProgram Ltd. (szakilaci) @adriano |
Commented by: PizzaProgram Ltd. (szakilaci) @sean |
Commented by: Sean Leyne (seanleyne) Support for all pre-v2.5 Firebird versions was discontinued in January 2015, and since this issue only relates to the migration/restore of pre-2.5 databases, all of the related topics will remain closed. |
Modified by: @pcisarstatus: Resolved [ 5 ] => Closed [ 6 ] |
Modified by: @pavel-zotovQA Status: No test |
Submitted by: PizzaProgram Ltd. (szakilaci)
Duplicates CORE3336
Example:
http://pcpincer.hu/downloads/corruptdb/termipro.zip
(=10.5MB ... orig size=410MB)
History:
1.) We've changed from v2.1.5 to the new v2.5.3.
2.) We've used the "update metadata" sql script, and seemed to work everything fine
3.) .. and also using the -fix_metadata option at every (daily) restore
4.) Since than more and more customers reporting corrupted databases.
Symptoms:
1. by adding a few records and doing a backup/restore >> the DB size doubles !
after a few days 100K records = 400MB :( ... instead of 5MB
2. it's getting filled up with garbage
3. Sweep, Mend, repair, backup/restore does NOT help
4. Some triggers / procedures do not work
5. !!! >>> looking at those SPs > I've realized those SPs and Triggers containing Hungarian characters as comment or exception > ending at half...
6. When opening tables, etc > it's very slow (maybe the big filesize...)
Solution:
- nothing yet :( tried everything
- the only way I can "repair" is to :
1. export every data one by one,
2. make an empty DB (keeping only metadata) (from a not corrupted DB)
3. import data back
4. reactivate triggers and indexies
Personal:
- this "repair" procedure takes me 3-4 hours each time, I had no sleep since 4 days, because can work on remote computers only at night.
Today an other customer called me... have to do it again. And they blame me for loosing money by not getting correct invoice-money!
Question / possible problem:
- Is it possible that the restore function does not recognize > metadata already converted to unicode? And re-re-coding it, if we use -fix_metadata ... switches?
The text was updated successfully, but these errors were encountered: