mirror of
https://gitee.com/he3db/he3pg.git
synced 2024-12-03 12:47:34 +08:00
hot data precache bug fix
This commit is contained in:
parent
6dc26f4fc2
commit
f0be4235d8
@ -792,15 +792,15 @@ ReadBufferExtended(Relation reln, ForkNumber forkNum, BlockNumber blockNum,
|
||||
*/
|
||||
pgstat_count_buffer_read(reln);
|
||||
/* precache index */
|
||||
if (isPreCacheIndex && preCacheIndexNode == reln->rd_node.relNode)
|
||||
if (isPreCacheIndex && !isPreCacheIndexDone && preCacheIndexNode == reln->rd_node.relNode)
|
||||
{
|
||||
BlockNumber precacheblocks;
|
||||
precacheblocks = smgrnblocks(reln->rd_smgr, forkNum);
|
||||
for(BlockNumber i=0; i < precacheblocks; i++)
|
||||
{
|
||||
ReadBuffer_common(reln->rd_smgr, reln->rd_rel->relpersistence, forkNum, i, mode, strategy, &hit);
|
||||
ReleaseBuffer(ReadBuffer_common(reln->rd_smgr, reln->rd_rel->relpersistence, forkNum, i, mode, strategy, &hit));
|
||||
}
|
||||
isPreCacheIndex = false;
|
||||
isPreCacheIndexDone = true;
|
||||
}
|
||||
|
||||
buf = ReadBuffer_common(reln->rd_smgr, reln->rd_rel->relpersistence,
|
||||
|
@ -88,6 +88,7 @@
|
||||
*/
|
||||
bool isPreCacheTable = false;
|
||||
bool isPreCacheIndex = false;
|
||||
bool isPreCacheIndexDone = false;
|
||||
bool needPreCacheEscape = false;
|
||||
Oid preCacheIndexNode = 0;
|
||||
const char *debug_query_string; /* client-supplied query string */
|
||||
@ -1219,6 +1220,10 @@ exec_simple_query(const char *query_string)
|
||||
{
|
||||
needPreCacheEscape = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
needPreCacheEscape = false;
|
||||
}
|
||||
/*
|
||||
* Run the portal to completion, and then drop it (and the receiver).
|
||||
*/
|
||||
@ -4515,6 +4520,7 @@ PostgresMain(int argc, char *argv[], bool PrivateConn,
|
||||
else if (strstr(query_string, "precache index ") != NULL && query_string - strstr(query_string, "precache index ") == 0)
|
||||
{
|
||||
isPreCacheIndex = true;
|
||||
isPreCacheIndexDone = false;
|
||||
exec_simple_query(query_string + strlen("precache index "));
|
||||
isPreCacheIndex = false;
|
||||
}
|
||||
|
@ -81,6 +81,7 @@ extern int bulk_io_in_progress_count;
|
||||
|
||||
extern bool isPreCacheTable;
|
||||
extern bool isPreCacheIndex;
|
||||
extern bool isPreCacheIndexDone
|
||||
extern bool needPreCacheEscape;
|
||||
extern Oid preCacheIndexNode;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user