Add data filters to gfix validation: -skip_data, -include_data, -skip_schema_data, -include_schema_data - #9179
Open
ChudaykinAlex wants to merge 1 commit into
Open
ChudaykinAlex wants to merge 1 commit into
ChudaykinAlex wants to merge 1 commit into
Conversation
…_schema_data, -include_schema_data gfix -v -full and gfix -mend may fail to complete on a database with damaged records in unimportant tables. The new switches allow to exclude records of such tables from validation, so the rest of the database can still be checked and repaired. They are similar to the same gbak switches. - New gfix switches -skip_d(ata), -include(_data), -skip_schema_d(ata) and -include_schema_d(ata) accept a regular expression in SIMILAR TO syntax, matching is case insensitive. The switches require -full (or -mend), it's checked after parsing of all switches, so their order doesn't matter (also in services API). The pattern is checked when the switch is parsed. - Records of a table are skipped by the same rules as in BurpGlobals::skipRelation(): the table is filtered out either by the table name switches or by the schema name switches. The filters are not applied to system tables. - Records of a filtered relation, including large records and blobs, are not walked, so -mend doesn't change them: VDR_records is cleared for the relation in walk_relation() and its records are not passed to walk_record() and walk_blob(). Pointer, data and index pages of the relation are still walked as without -full. Orphan pages detection is disabled when records of some relation were actually skipped. - New DPB items isc_dpb_verify_skip_data, isc_dpb_verify_include_data, isc_dpb_verify_skip_schema_data, isc_dpb_verify_include_schema_data. gfix builds DPB with ClumpletReader::dpbList, so patterns longer than 255 bytes upgrade it to version 2. - New SPB items of isc_action_svc_repair isc_spb_rpr_skip_data, isc_spb_rpr_include_data, isc_spb_rpr_skip_schema_data, isc_spb_rpr_include_schema_data, fbsvcmgr options rpr_skip_data, rpr_include_data, rpr_skip_schema_data, rpr_include_schema_data. - gfix is linked with re2 (posix and MSVC builds). - Documentation: doc/README.gfix_data_filters.md.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
gfix -v -fullandgfix -mendmay fail to complete on a database with damagedrecords in unimportant tables, whose data could be restored from other sources.
This PR allows to exclude records of such tables from validation, so the rest of
the database can still be checked and repaired.
The switches are similar to the same
gbakswitches.Changes
gfix
-SKIP_D(ATA)-INCLUDE(_DATA)-SKIP_SCHEMA_D(ATA)-INCLUDE_SCHEMA_D(ATA)SIMILAR TOsyntax, matching is case insensitive.-validate -full(or-mend), otherwise an error is reported.The requirement is checked after parsing of all switches, so the order of switches doesn't
matter, including the order of SPB items in services API.
reported before attaching the database. Patterns longer than 255 bytes are supported:
gfixbuilds DPB withClumpletReader::dpbList, which allows upgrade to DPB version 2.gfix -v -full -skip_data T1 database.fdb gfix -mend -skip_data "LOG\_%" database.fdb gfix -v -full -include_schema_data S1 -include_data T1 database.fdbRules
Records of a table are skipped by the same rules as in
BurpGlobals::skipRelation():the table is filtered out either by the table name switches or by the schema name switches.
If a name matches both skip and include patterns, records are skipped.
The filters are applied to user tables only, records of system tables are always validated.
Engine
blobs, so
-menddoesn't change them:VDR_recordsis cleared for the relation inValidation::walk_relation()(and restored after it), and its records are not passed towalk_record()/walk_blob().-full:the checks of full validation (record version chains, index entries against records,
consistency of index tree levels) are not performed for it.
pages of its big records and blobs were not walked. A filter that skips nothing doesn't
disable it.
API
isc_dpb_verify):isc_dpb_verify_skip_data(108),isc_dpb_verify_include_data(109),isc_dpb_verify_skip_schema_data(110),isc_dpb_verify_include_schema_data(111).isc_action_svc_repair:isc_spb_rpr_skip_data(53),isc_spb_rpr_include_data(54),isc_spb_rpr_skip_schema_data(55),isc_spb_rpr_include_schema_data(56).The items are string items, they are converted to UTF-8 like other string items.
rpr_skip_data,rpr_include_data,rpr_skip_schema_data,rpr_include_schema_data.Build
gfixnow usesSimilarToRegex, so it's linked with re2 (builds/posix/Makefile.in,builds/win32/msvc15/gfix.vcxproj), likegbak.Documentation
doc/README.gfix_data_filters.md