Fix inconsistency in determining the timestamp of the db statfile.
We use the timestamp of the global statfile if we are not able to determine it for a particular database in case the entry for that database doesn't exist. However, we were using it even when the statfile is corrupt. As there is no user reported issue and it is not clear if there is any impact of this on actual application so decided not to backpatch. Reported-by: Amit Kapila Author: Amit Kapila Reviewed-by: Sawada Masahiko, Magnus Hagander and Alvaro Herrera Discussion: https://postgr.es/m/CAA4eK1J3oTJKyVq6v7K4d3jD+vtnruG9fHRib6UuWWsrwAR6Aw@mail.gmail.com
This commit is contained in:
parent
ddd5f6d260
commit
03c7f1f37a
@ -5557,7 +5557,8 @@ done:
|
||||
* pgstat_read_db_statsfile_timestamp() -
|
||||
*
|
||||
* Attempt to determine the timestamp of the last db statfile write.
|
||||
* Returns true if successful; the timestamp is stored in *ts.
|
||||
* Returns true if successful; the timestamp is stored in *ts. The caller must
|
||||
* rely on timestamp stored in *ts iff the function returns true.
|
||||
*
|
||||
* This needs to be careful about handling databases for which no stats file
|
||||
* exists, such as databases without a stat entry or those not yet written:
|
||||
@ -5665,7 +5666,8 @@ pgstat_read_db_statsfile_timestamp(Oid databaseid, bool permanent,
|
||||
ereport(pgStatRunningInCollector ? LOG : WARNING,
|
||||
(errmsg("corrupted statistics file \"%s\"",
|
||||
statfile)));
|
||||
goto done;
|
||||
FreeFile(fpin);
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -5684,10 +5686,13 @@ pgstat_read_db_statsfile_timestamp(Oid databaseid, bool permanent,
|
||||
goto done;
|
||||
|
||||
default:
|
||||
ereport(pgStatRunningInCollector ? LOG : WARNING,
|
||||
(errmsg("corrupted statistics file \"%s\"",
|
||||
statfile)));
|
||||
goto done;
|
||||
{
|
||||
ereport(pgStatRunningInCollector ? LOG : WARNING,
|
||||
(errmsg("corrupted statistics file \"%s\"",
|
||||
statfile)));
|
||||
FreeFile(fpin);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user