-
Notifications
You must be signed in to change notification settings - Fork 926
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
Allow TAM chunk creation as non-owner #7913
base: main
Are you sure you want to change the base?
Allow TAM chunk creation as non-owner #7913
Conversation
47545fd
to
f4f6474
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7913 +/- ##
==========================================
+ Coverage 80.06% 81.92% +1.85%
==========================================
Files 190 249 +59
Lines 37181 46147 +8966
Branches 9450 11569 +2119
==========================================
+ Hits 29770 37806 +8036
- Misses 2997 3784 +787
- Partials 4414 4557 +143 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
f4f6474
to
5fb5bef
Compare
When using Hypercore TAM on the hypertable, new chunks are created as hypercore chunks, including the compressed relation. This means that the compressed relation is created as the inserting user. However, if the inserting user is not the table owner, this operation failed. The reason it failed was because some toast settings were changed on the compressed chunk during its creation without switching to a role with proper permissions. This is easily fixed by extending the section of code that is executed under the permissive role.
5fb5bef
to
b41204d
Compare
@@ -82,6 +82,7 @@ if mkdir ${TEST_OUTPUT_DIR}/.pg_init 2>/dev/null; then | |||
ALTER USER ${TEST_ROLE_SUPERUSER} WITH SUPERUSER; | |||
ALTER USER ${TEST_ROLE_CLUSTER_SUPERUSER} WITH SUPERUSER; | |||
ALTER USER ${TEST_ROLE_DEFAULT_PERM_USER} WITH CREATEROLE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAICT, the idea with the "default permissions user" is to have something that cannot do to much and test with that. If you allow it to create new roles, it is not a "default permission user". Can't you use a role with superuser privileges to create new roles?
-- An insert should create a new hypercore chunk, including the compressed chunk | ||
insert into conditions values ('2024-01-02', 'school', 99.5); | ||
select chunk, amname, cs.compress_relid | ||
from show_chunks('conditions') as chunk | ||
join pg_class on (pg_class.oid = chunk) | ||
join pg_am on (relam = pg_am.oid) | ||
join _timescaledb_catalog.compression_settings cs on (cs.relid = chunk); | ||
chunk | amname | compress_relid | ||
------------------------------------------+-----------+-------------------------------------------------- | ||
_timescaledb_internal._hyper_12_49_chunk | hypercore | _timescaledb_internal.compress_hyper_13_50_chunk | ||
(1 row) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also show the owner in result set (for both the compressed and non-compressed chunk)? I can imagine situations where you by mistake change the code so that inserts work well but the owner is not correct.
When using Hypercore TAM on the hypertable, new chunks are created as hypercore chunks, including the compressed relation. This means that the compressed relation is created as the inserting user. However, if the inserting user is not the table owner, this operation failed.
The reason it failed was because some toast settings were changed on the compressed chunk during its creation without switching to a role with proper permissions. This is easily fixed by extending the section of code that is executed under the permissive role.