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

sql: disallow GRANT/REVOKE on system tables #53683

Closed
wants to merge 1 commit into from

Conversation

rohany
Copy link
Contributor

@rohany rohany commented Aug 31, 2020

Fixes #43842.

Disallow GRANT/REVOKE operations on system objects to avoid potential
deadlocks related to version bumps.

Release justification: bug fix
Release note (sql change): Disallow GRANT/REVOKE operations on system
tables.
Release note (bug fix): Fix a bug where GRANT/REVOKE on the
system.lease table would result in a deadlock.

Fixes cockroachdb#43842.

Disallow GRANT/REVOKE operations on system objects to avoid potential
deadlocks related to version bumps.

Release justification: bug fix
Release note (sql change): Disallow `GRANT/REVOKE` operations on system
tables.
Release note (bug fix): Fix a bug where `GRANT/REVOKE` on the
`system.lease` table would result in a deadlock.
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Contributor

@ajwerner ajwerner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 2 of 2 files at r1.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @lucy-zhang)

@rohany
Copy link
Contributor Author

rohany commented Aug 31, 2020

It seems like we have some migrations and tests that depend on this behavior. Would it be reasonable to go back to disallowing grants on just the system.lease table?

@ajwerner
Copy link
Contributor

Do the tests seem reasonable? Should we change the tests instead?

@rohany
Copy link
Contributor Author

rohany commented Aug 31, 2020

Yeah nvm the tests, we can always change those. The problem is just this system.comments migration. It uses grant and has a revoke in the rollback. Can we just skip this migration?

@ajwerner
Copy link
Contributor

Yeah nvm the tests, we can always change those. The problem is just this system.comments migration. It uses grant and has a revoke in the rollback. Can we just skip this migration?

Did we properly bake it in? If so, then I suppose yes. If not, I propose we rework this PR to allow grant and revoke by the node user. Generally I think that that would be sound.

@thoszhang thoszhang removed their request for review February 26, 2021 22:45
Copy link
Contributor

@ajwerner ajwerner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RichardJCai any interest in sprucing this up?

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained

@RichardJCai
Copy link
Contributor

@RichardJCai any interest in sprucing this up?

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained

Sure I'll take this over

@RichardJCai
Copy link
Contributor

Closing in favour of #61410

@RichardJCai RichardJCai closed this Mar 3, 2021
craig bot pushed a commit that referenced this pull request Mar 3, 2021
61214: importccl: avoid random() collisions between KV batches r=pbardea a=pbardea

An import may parallelize the work to convert SQL rows into KVs. During
this phase, default expressions are evaluated. Previously, IMPORT's
implementations of random number generates that are evaluated in default
expressions assumed that all of the given row IDs were contiguous. This
is not the case since 1 row converter may be responsible for converting
several non-contiguous batches of rows. This resulted in random_values
colliding between different batches of KV space.

This commit fixes this bug by feeding in the current position and
resetting the random source backing these methods. This ensures that
import treats a new contiguous batch of rows separately.

Fixes #61203.

Release justification: bug fix
Release note (bug fix): Fix a bug where random numbers generated as
default expressions during IMPORT would collide a few hundred rows apart
from eachother.

61300: sql: set zone configs before backfill on ALTER TABLE LOCALITY/PRIMARY KEY r=arulajmani,ajstorm a=otan

Ensure that the zone configurations are correctly set before the
backfill runs, so data is backfilled to the correct location upfront for
REGIONAL BY ROW tables. Note this bug also exists on existing ALTER
PRIMARY KEY statements.

Release justification: bug fixes and low-risk updates to new
functionality

Release note (bug fix): Fix bug where zone configurations on indexes
were not copied before the backfill of an ALTER PRIMARY KEY. They used
to be copied afterwards instead.



61349: sql: add is_temporary and is_virtual columns to crdb_internal.create_statements r=rafiss a=RichardJCai

These columns are useful for filtering for generating output for
SHOW CREATE ALL TABLES.

Release justification: None, change to internal table.
Release note: None

61356: server: fix node decommissioning itself r=knz,tbg a=erikgrinaker

Previously, if a node was asked to decommission itself, the
decommissioning process would sometimes hang or fail since the node
would become decommissioned and lose RPC access to the rest of the
cluster while it was building the response.

This patch returns an empty response from the
`adminServer.Decommission()` call when setting the final
`DECOMMISSIONED` status, thereby avoiding further use of cluster RPC
after decommissioning itself. It also defers self-decommissioning until
the end if multiple nodes are being decommissioned.

This change is backwards-compatible with old CLI versions, which will
simply output the now-empty status result set before completing with
"No more data reported on target nodes". The CLI has been updated to
simply omit the empty response.

Resolves #56718.

A separate commit ensures errors with `codes.PermissionDenied` abort
RPC retries and return immediately, to prevent operations hanging with
indefinite internal retries when RPC access is lost.

Release justification: bug fixes and low-risk updates to new functionality

Release note (bug fix): Fixed a bug from 21.1-alpha where a node
decommissioning process could sometimes hang or fail when the
decommission request was submitted via the node being decommissioned.

61376: opt: prune unnecessary columns in uniqueness checks r=mgartner a=mgartner

Projects now wrap semi-joins of unique checks which pass-through the
columns of the unique constraint. This allows normalization rules to
prune unnecessary columns from the expression.

Release justification: This is a low-risk change to new functionality,
implicitly partitioned unique indexes.

Release note (performance improvement): The columns fetched for
uniqueness checks of implicitly partitioned unique indexes are now
pruned to only include columns necessary for determining uniqueness.


61410: sql: disallow GRANT/REVOKE on system tables r=RichardJCai a=RichardJCai

Disallow GRANT/REVOKE operations on system objects to avoid potential
deadlocks related to version bumps.

Release justification: bug fix
Release note (sql change): Disallow `GRANT/REVOKE` operations on system
tables.
Release note (bug fix): Fix a bug where `GRANT/REVOKE` on the
`system.lease` table would result in a deadlock.

Fixes #43842

Picking up PR from here:
#53683

It seems like the `system.comments` migration that used the GRANT/REVOKE is gone now (comment here: #53683 (comment))

61427: geomfn: prevent smaller densifyFrac for ST_{Frechet,Hausdorff}Distance r=rafiss a=otan

Release justification: low-risk change to existing functionality

Resolves #61367.

Release note (sql change): Prevent densifyFracs < 1e-6 for
ST_FrechetDistance and ST_HausdorffDistance to protect panics and out of
memory errors.

Co-authored-by: Paul Bardea <pbardea@gmail.com>
Co-authored-by: Oliver Tan <otan@cockroachlabs.com>
Co-authored-by: richardjcai <caioftherichard@gmail.com>
Co-authored-by: Erik Grinaker <grinaker@cockroachlabs.com>
Co-authored-by: Marcus Gartner <marcus@cockroachlabs.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sql: GRANT mistakenly allowed on system.lease, causing deadlocks
4 participants