• T
    Remove unnecessary relcache flushes after changing btree metapages. · ac8bc3b6
    Tom Lane 提交于
    These flushes were added in my commit d2896a9e, which added the btree
    logic that keeps a cached copy of the index metapage data in index relcache
    entries.  The idea was to ensure that other backends would promptly update
    their cached copies after a change.  However, this is not really necessary,
    since _bt_getroot() has adequate defenses against believing a stale root
    page link, and _bt_getrootheight() doesn't have to be 100% right.
    Moreover, if it were necessary, a relcache flush would be an unreliable way
    to do it, since the sinval mechanism believes that relcache flush requests
    represent transactional updates, and therefore discards them on transaction
    rollback.  Therefore, we might as well drop these flush requests and save
    the time to rebuild the whole relcache entry after a metapage change.
    
    If we ever try to support in-place truncation of btree indexes, it might
    be necessary to revisit this issue so that _bt_getroot() can't get caught
    by trying to follow a metapage link to a page that no longer exists.
    A possible solution to that is to make use of an smgr, rather than
    relcache, inval request to force other backends to discard their cached
    metapages.  But for the moment this is not worth pursuing.
    ac8bc3b6
nbtpage.c 47.4 KB