Skip to content

Commit

Permalink
Backported fix for CORE-5501: Unclear gstat's diagnostic when damaged…
Browse files Browse the repository at this point in the history
… page in DB file appears encrypted
  • Loading branch information
AlexPeshkoff committed Mar 10, 2017
1 parent d8fd4b9 commit 3e5ac85
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/jrd/CryptoManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1028,7 +1028,6 @@ namespace Jrd {

if (page->pag_flags & Ods::crypted_page)
{
fb_assert(cryptPlugin);
if (!cryptPlugin)
{
Arg::Gds(isc_decrypt_error).copyTo(sv);
Expand Down
2 changes: 1 addition & 1 deletion src/msgs/facilities2.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ set bulk_insert INSERT INTO FACILITIES (LAST_CHANGE, FACILITY, FAC_CODE, MAX_NUM
('2006-09-10 03:04:31', 'JRD_BUGCHK', 15, 307)
('2016-01-18 19:20:48', 'ISQL', 17, 195)
('2010-07-10 10:50:30', 'GSEC', 18, 105)
('2015-01-07 18:01:51', 'GSTAT', 21, 58)
('2017-03-09 21:51:33', 'GSTAT', 21, 59)
('2013-12-19 17:31:31', 'FBSVCMGR', 22, 58)
('2009-07-18 12:12:12', 'UTL', 23, 2)
('2015-01-07 18:01:51', 'NBACKUP', 24, 77)
Expand Down
1 change: 1 addition & 0 deletions src/msgs/messages2.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3223,6 +3223,7 @@ Analyzing database pages ...', NULL, NULL);
(NULL, 'main', 'dba.epp', NULL, 21, 55, NULL, 'no encrypted database support, only -e and -h can be used', NULL, NULL)
(NULL, 'main', 'dba.epp', NULL, 21, 56, NULL, ' Empty pages: @1, full pages: @2', NULL, NULL);
(NULL, 'dba_in_sw_table', 'dbaswi.h', NULL, 21, 57, NULL, ' -role SQL role name', NULL, NULL);
(NULL, 'main', 'dba.epp', NULL, 21, 58, NULL, 'Other pages: total @1, ENCRYPTED @2 (DB problem!), non-crypted @3', NULL, NULL)
-- FBSVCMGR
-- All messages use the new format.
('fbsvcmgr_bad_am', 'putAccessMode', 'fbsvcmgr.cpp', NULL, 22, 1, NULL, 'Wrong value for access mode', NULL, NULL);
Expand Down
12 changes: 11 additions & 1 deletion src/utilities/gstat/dba.epp
Original file line number Diff line number Diff line change
Expand Up @@ -676,10 +676,15 @@ int gstat(Firebird::UtilSvc* uSvc)
++non;
}

bool hasCrypted()
{
return enc > 0;
}

private:
ULONG enc, non;
};
Statist data, index, blob;
Statist data, index, blob, other;

for (page = 0; true; ++page)
{
Expand All @@ -700,13 +705,18 @@ int gstat(Firebird::UtilSvc* uSvc)
case pag_blob:
blob.log(p->pag_flags);
break;
default:
other.log(p->pag_flags);
break;
}
}

uSvc->printf(false, "\n");
data.print(52);
index.print(53);
blob.print(54);
if (other.hasCrypted())
other.print(58);

dba_exit(FINI_OK, tddba);
}
Expand Down

0 comments on commit 3e5ac85

Please sign in to comment.