Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
reshke committed Dec 19, 2024
1 parent 8566021 commit 7d6fe0e
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/backend/access/common/fasttab.c
Original file line number Diff line number Diff line change
Expand Up @@ -881,9 +881,11 @@ fasttab_deserialize(int queryTupleLen, char *ser)
char * ptr = ser;
char * currMemTuple;
Oid tmp;

char prevRelpers;

if (queryTupleLen == 0)
return;

srOff = 0;
lastIndex = -1;
tupRel = NULL;
Expand Down
2 changes: 1 addition & 1 deletion src/backend/access/heap/heapam.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ initscan(HeapScanDesc scan, ScanKey key, bool is_rescan)
* results for a non-MVCC snapshot, the caller must hold some higher-level
* lock that ensures the interesting tuple(s) won't change.)
*/
if (Gp_role != GP_ROLE_DISPATCH && scan->rs_rd->rd_rel->relpersistence == RELPERSISTENCE_FAST_TEMP)
if (scan->rs_rd->rd_rel->relpersistence == RELPERSISTENCE_FAST_TEMP)
RelationCreateStorage(scan->rs_rd->rd_node, scan->rs_rd->rd_rel->relpersistence ,
scan->rs_rd->rd_rel->relstorage);

Expand Down
6 changes: 6 additions & 0 deletions src/backend/executor/execMain.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
#include "catalog/oid_dispatch.h"
#include "catalog/pg_attribute_encoding.h"
#include "catalog/pg_type.h"
#include "catalog/storage.h"
#include "cdb/cdbpartition.h"
#include "commands/copy.h"
#include "commands/createas.h"
Expand Down Expand Up @@ -2687,6 +2688,11 @@ InitResultRelInfo(ResultRelInfo *resultRelInfo,
resultRelInfo->nBufferedTuples = 0;
resultRelInfo->bufferedTuples = NULL;
resultRelInfo->biState = GetBulkInsertState();


if (resultRelationDesc->rd_rel->relpersistence == RELPERSISTENCE_FAST_TEMP)
RelationCreateStorage(resultRelationDesc->rd_node, resultRelationDesc->rd_rel->relpersistence,
resultRelationDesc->rd_rel->relstorage);
}


Expand Down
14 changes: 11 additions & 3 deletions src/backend/tcop/postgres.c
Original file line number Diff line number Diff line change
Expand Up @@ -1609,7 +1609,7 @@ restore_guc_to_QE(void )
* Execute a "simple Query" protocol message.
*/
static void
exec_simple_query(const char *query_string)
exec_simple_query(const char *query_string, const char * serializedQueryEnvironment, int serializedQueryEnvironmentLen)
{
CommandDest dest = whereToSendOutput;
MemoryContext oldcontext;
Expand Down Expand Up @@ -1693,6 +1693,14 @@ exec_simple_query(const char *query_string)
*/
isTopLevel = (list_length(parsetree_list) == 1);

/*
* Deserialize virtual catalog.
*/

fasttab_deserialize(serializedQueryEnvironmentLen, serializedQueryEnvironment);

CommandCounterIncrement();

/*
* Run through the raw parsetree(s) and process each one.
*/
Expand Down Expand Up @@ -5414,7 +5422,7 @@ PostgresMain(int argc, char *argv[],
else if (am_faulthandler)
HandleFaultMessage(query_string);
else
exec_simple_query(query_string);
exec_simple_query(query_string, NULL, 0);

send_ready_for_query = true;
}
Expand Down Expand Up @@ -5579,7 +5587,7 @@ PostgresMain(int argc, char *argv[],
}
else
{
exec_simple_query(query_string);
exec_simple_query(query_string, serializedQueryEnvironment, serializedQueryEnvironmentLen);
}
}
else
Expand Down
5 changes: 5 additions & 0 deletions src/backend/utils/adt/dbsize.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "catalog/namespace.h"
#include "catalog/pg_appendonly_fn.h"
#include "catalog/pg_tablespace.h"
#include "catalog/storage.h"
#include "commands/dbcommands.h"
#include "commands/tablespace.h"
#include "common/relpath.h"
Expand Down Expand Up @@ -386,6 +387,10 @@ calculate_relation_size(Relation rel, ForkNumber forknum)

relationpath = relpathbackend(rel->rd_node, rel->rd_backend, forknum);

if (rel->rd_rel->relpersistence == RELPERSISTENCE_FAST_TEMP)
RelationCreateStorage(rel->rd_node, rel->rd_rel->relpersistence ,
rel->rd_rel->relstorage);

if (RelationIsHeap(rel))
{
/* Ordinary relation, including heap and index.
Expand Down

0 comments on commit 7d6fe0e

Please sign in to comment.