Skip to content

Commit

Permalink
optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
RekGRpth committed Dec 17, 2024
1 parent ae3edc1 commit 5031028
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
7 changes: 3 additions & 4 deletions src/gp_activetable.c
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,7 @@ load_table_size(StringInfoData *active_oids)
deconstruct_array(array, ARR_ELEMTYPE(array), typlen, typbyval, typalign, &sizes, NULL, &nelems);
Assert(nelems == SEGCOUNT + 1);
for (int16 segid = -1; segid < SEGCOUNT; segid++)
update_active_table_size(tableid, DatumGetInt64(sizes[segid + 1]), segid, NULL);
update_active_table_size(tableid, DatumGetInt64(sizes[segid + 1]), segid);
pfree(sizes);
}
SPI_freetuptable(SPI_tuptable);
Expand Down Expand Up @@ -1086,12 +1086,11 @@ pull_active_table_size_from_seg(const char *active_oids)
int64 size = atoll(PQgetvalue(pgresult, j, 1));
int16 segid = atoi(PQgetvalue(pgresult, j, 2));

update_active_table_size(oid, size, segid, NULL);
update_active_table_size(oid, size, segid);
oid_size = hash_search(oid_size_map, &oid, HASH_ENTER, &found);
/* tablesize for master is the sum of tablesize of master and all segments */
oid_size->size = (found ? oid_size->size : 0) + size;
}
// update_active_table_size(tableid0, size0, -1, NULL);
}
cdbdisp_clearCdbPgResults(&cdb_pgresults);

Expand All @@ -1101,7 +1100,7 @@ pull_active_table_size_from_seg(const char *active_oids)

while ((oid_size = hash_seq_search(&iter)) != NULL)
{
update_active_table_size(oid_size->oid, oid_size->size, -1, NULL);
update_active_table_size(oid_size->oid, oid_size->size, -1);
}

hash_destroy(oid_size_map);
Expand Down
2 changes: 1 addition & 1 deletion src/gp_activetable.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ extern void gp_fetch_active_tables(bool is_init, StringInfoData *active_oids);
extern void init_active_table_hook(void);
extern void init_shm_worker_active_tables(void);
extern void init_lock_active_tables(void);
extern void update_active_table_size(Oid tableid, int64 size, int16 segid, void *arg);
extern void update_active_table_size(Oid tableid, int64 size, int16 segid);

extern HTAB *monitored_dbid_cache;

Expand Down
4 changes: 2 additions & 2 deletions src/quotamodel.c
Original file line number Diff line number Diff line change
Expand Up @@ -930,9 +930,9 @@ get_tsentry(Oid tableid, int16 segid)
}

void
update_active_table_size(Oid tableid, int64 size, int16 segid, void *arg)
update_active_table_size(Oid tableid, int64 size, int16 segid)
{
TableSizeEntry *tsentry = arg != NULL ? arg : get_tsentry(tableid, segid);
TableSizeEntry *tsentry = get_tsentry(tableid, segid);

if (tsentry == NULL)
{
Expand Down

0 comments on commit 5031028

Please sign in to comment.