Navigation Menu

Skip to content
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

Circular index references in corrupt database causes fbserver to loop infinitely [CORE1127] #1548

Closed
firebird-automations opened this issue Feb 12, 2007 · 18 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Diane Downie (dianedownie)

Attachments:
Circular Index.zip
Circular Index.zip

Fbserver.exe does not detect circular index references in a corrupt database during in the walk_index phase of validation. Attached please find logs illustrating the problem and code changes that detect the problem and allow the database to be successfully repaired. Unfortunately, I cannot supply the database as it belongs to a 3rd party, but am able to test/verify any proposed changes to fbserver.

Commits: 75a7e65 e4b66b9 119a702

@firebird-automations
Copy link
Collaborator Author

Commented by: Diane Downie (dianedownie)

Before and after fbserver.log that illustrate the problems and code changes that detect the problem. (FB Developers may be aware of a better to address this issue that has been present since 1.5.)

@firebird-automations
Copy link
Collaborator Author

Modified by: Diane Downie (dianedownie)

Attachment: Circular Index.zip [ 10250 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: Diane Downie (dianedownie)

description: Fbserver.exe does not detect circular index references in a corrupt database during validation in the walk_index. Attached please find logs illustrating the problem and code changes that detect the problem and allow the database to be successfully repaired. Unfortunately, I cannot supply the database as it belongs to a 3rd party. => Fbserver.exe does not detect circular index references in a corrupt database during in the walk_index phase of validation. Attached please find logs illustrating the problem and code changes that detect the problem and allow the database to be successfully repaired. Unfortunately, I cannot supply the database as it belongs to a 3rd party, but am able to test/verify any proposed changes to fbserver.

@firebird-automations
Copy link
Collaborator Author

Commented by: Diane Downie (dianedownie)

Added Readme.txt to the archive.

@firebird-automations
Copy link
Collaborator Author

Modified by: Diane Downie (dianedownie)

Attachment: Circular Index.zip [ 10251 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @hvlad

Diane, thank you for contribution.
I reworked your patch for validation.cpp, please test it on corrupted database you have

Index: jrd/validation.cpp

RCS file: /cvsroot/firebird/firebird2/src/jrd/validation.cpp,v
retrieving revision 1.16
diff -u -w -b -r1.16 validation.cpp
--- jrd/validation.cpp 6 Apr 2006 08:18:42 -0000 1.16
+++ jrd/validation.cpp 13 Feb 2007 09:03:52 -0000
@@ -647,7 +647,8 @@
"Transaction inventory pages confused, sequence %ld",
"Relation has %ld orphan backversions (%ld in use)",
"Index %d is corrupt (missing entries)",
- "Index %d has orphan child page at page %ld"
+ "Index %d has orphan child page at page %ld",
+ "Index %d has a circular reference at page %ld"
};

@@ -1430,11 +1431,16 @@
SCHAR flags = 0;
UCHAR* pointer;
IndexNode node, lastNode;
+ PageBitmap visited_pages; // used to check circular page references, Diane Downie 2/9/07

while \(next\) \{
	WIN window\(\-1\);
	btree\_page\* page = 0;
	fetch\_page\(tdbb, control, next, pag\_index, &window, &page\);

+
+ // remember each page for circular reference detection
+ visited_pages.set(next);
+
if ((next != page_number) &&
(page->btr_header.pag_flags & BTR_FLAG_COPY_MASK) !=
(flags & BTR_FLAG_COPY_MASK))
@@ -1686,6 +1692,13 @@
nullKeyHandled = !(unique && null_key);
}

+ // check for circular referenes
+ if (next && visited_pages.test(next))
+ {
+ corrupt(tdbb, control, VAL_INDEX_CYCLE, relation,
+ id + 1, next);
+ next = 0;
+ }
CCH_RELEASE(tdbb, &window);
}

@firebird-automations
Copy link
Collaborator Author

Modified by: @hvlad

assignee: Vlad Horsun [ hvlad ]

@firebird-automations
Copy link
Collaborator Author

Commented by: Diane Downie (dianedownie)

Yes, your reworked changs also allowed the database to be recovered.
Thanks,
-Diane

@firebird-automations
Copy link
Collaborator Author

Modified by: @hvlad

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 2.0.1 [ 10090 ]

Fix Version: 2.1 [ 10041 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @pmakowski

Reporter said that it is ok, so we can close

@firebird-automations
Copy link
Collaborator Author

Modified by: @pmakowski

status: Resolved [ 5 ] => Closed [ 6 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @pcisar

Reopened to update ticket information.

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

status: Closed [ 6 ] => Reopened [ 4 ]

resolution: Fixed [ 1 ] =>

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

Fix Version: 2.1 Alpha 1 [ 10150 ]

Fix Version: 2.1.0 [ 10041 ] =>

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

status: Reopened [ 4 ] => Closed [ 6 ]

resolution: Fixed [ 1 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

Workflow: jira [ 11593 ] => Firebird [ 15455 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

QA Status: No test

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Closed [ 6 ] => Closed [ 6 ]

QA Status: No test => Cannot be tested

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment