Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 293938

Excess UPDATE {block} queries from _block_rehash()

$
0
0

Problem/Motivation

Currently, _block_rehash() writes to {block} far more often than it has to. Recently, we ran into issues caused by an excesses number of UPDATE {block} queries being run on cron run or a cache-clear. I traced this back to _block_rehash().

Proposed resolution

_block_rehash() begins by comparing what is in {block} to what is defined in modules'hook_block_info. By comparing the results of the {block} query to what is defined in hook_block_info before attempting to write to {block}, we can avoid a large number of the UPDATE {block} queries. A simple if wrapper around the drupal_write_record prevents the excess number of UPDATE {block} queries.

NOTE:_block_rehash() has been re-architected in D8 and this same issue is not present there.


Viewing all articles
Browse latest Browse all 293938

Trending Articles