Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tablespace for compressed hypertable and corresponding toast #5525

Merged
merged 1 commit into from May 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -31,6 +31,7 @@ accidentally triggering the load of a previous DB version.**
* #5614 Enable run_job() for telemetry job
* #5578 Fix on-insert decompression after schema changes
* #5613 Quote username identifier appropriately
* #5525 Fix tablespace for compressed hypertable and corresponding toast

**Thanks**
* @kovetskiy and @DZDomi for reporting peformance regression in Realtime Continuous Aggregates
Expand Down
10 changes: 7 additions & 3 deletions tsl/src/compression/create.c
Expand Up @@ -569,7 +569,7 @@ set_toast_tuple_target_on_compressed(Oid compressed_table_id)
}

static int32
create_compression_table(Oid owner, CompressColInfo *compress_cols)
create_compression_table(Oid owner, CompressColInfo *compress_cols, Oid tablespace_oid)
{
ObjectAddress tbladdress;
char relnamebuf[NAMEDATALEN];
Expand All @@ -589,9 +589,12 @@ create_compression_table(Oid owner, CompressColInfo *compress_cols)
create->constraints = NIL;
create->options = NULL;
create->oncommit = ONCOMMIT_NOOP;
create->tablespacename = NULL;
create->tablespacename = get_tablespace_name(tablespace_oid);
create->if_not_exists = false;

/* Invalid tablespace_oid <=> NULL tablespace name */
Assert(!OidIsValid(tablespace_oid) == (create->tablespacename == NULL));

/* create the compression table */
/* NewRelationCreateToastTable calls CommandCounterIncrement */
ts_catalog_database_info_become_owner(ts_catalog_database_info_get(), &sec_ctx);
Expand Down Expand Up @@ -1154,7 +1157,8 @@ tsl_process_compress_table(AlterTableCmd *cmd, Hypertable *ht,
}
else
{
compress_htid = create_compression_table(ownerid, &compress_cols);
Oid tablespace_oid = get_rel_tablespace(ht->main_table_relid);
compress_htid = create_compression_table(ownerid, &compress_cols, tablespace_oid);
ts_hypertable_set_compressed(ht, compress_htid);
}

Expand Down