mirror of
https://github.com/postgres/postgres.git
synced 2025-10-29 22:49:41 +03:00
hash: Add write-ahead logging support.
The warning about hash indexes not being write-ahead logged and their use being discouraged has been removed. "snapshot too old" is now supported for tables with hash indexes. Most importantly, barring bugs, hash indexes will now be crash-safe and usable on standbys. This commit doesn't yet add WAL consistency checking for hash indexes, as we now have for other index types; a separate patch has been submitted to cure that lack. Amit Kapila, reviewed and slightly modified by me. The larger patch series of which this is a part has been reviewed and tested by Álvaro Herrera, Ashutosh Sharma, Mark Kirkwood, Jeff Janes, and Jesper Pedersen. Discussion: http://postgr.es/m/CAA4eK1JOBX=YU33631Qh-XivYXtPSALh514+jR8XeD7v+K3r_Q@mail.gmail.com
This commit is contained in:
12
src/backend/utils/cache/relcache.c
vendored
12
src/backend/utils/cache/relcache.c
vendored
@@ -5880,13 +5880,10 @@ RelationIdIsInInitFile(Oid relationId)
|
||||
/*
|
||||
* Tells whether any index for the relation is unlogged.
|
||||
*
|
||||
* Any index using the hash AM is implicitly unlogged.
|
||||
*
|
||||
* Note: There doesn't seem to be any way to have an unlogged index attached
|
||||
* to a permanent table except to create a hash index, but it seems best to
|
||||
* keep this general so that it returns sensible results even when they seem
|
||||
* obvious (like for an unlogged table) and to handle possible future unlogged
|
||||
* indexes on permanent tables.
|
||||
* to a permanent table, but it seems best to keep this general so that it
|
||||
* returns sensible results even when they seem obvious (like for an unlogged
|
||||
* table) and to handle possible future unlogged indexes on permanent tables.
|
||||
*/
|
||||
bool
|
||||
RelationHasUnloggedIndex(Relation rel)
|
||||
@@ -5908,8 +5905,7 @@ RelationHasUnloggedIndex(Relation rel)
|
||||
elog(ERROR, "cache lookup failed for relation %u", indexoid);
|
||||
reltup = (Form_pg_class) GETSTRUCT(tp);
|
||||
|
||||
if (reltup->relpersistence == RELPERSISTENCE_UNLOGGED
|
||||
|| reltup->relam == HASH_AM_OID)
|
||||
if (reltup->relpersistence == RELPERSISTENCE_UNLOGGED)
|
||||
result = true;
|
||||
|
||||
ReleaseSysCache(tp);
|
||||
|
||||
Reference in New Issue
Block a user