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: inject tenant ID in sqlServerArgs, pass through ExecutorConfig #48190

Merged
merged 3 commits into from
Apr 30, 2020

Commits on Apr 30, 2020

  1. sql: delete scanNode.isDeleteSource

    This has been unused for a while, possibly since Delete statements were pulled
    into the optimizer.
    nvanbenschoten committed Apr 30, 2020
    Configuration menu
    Copy the full SHA
    2333778 View commit details
    Browse the repository at this point in the history
  2. sql: pull full scan determination into execFactory, out of DistSQLPla…

    …nner
    
    This removes the only instance where the DistSQLPlanner was encoding keys.
    It allows us to avoid giving it a SQL codec in the next commit.
    nvanbenschoten committed Apr 30, 2020
    Configuration menu
    Copy the full SHA
    f1fae7e View commit details
    Browse the repository at this point in the history
  3. sql: inject tenant ID in sqlServerArgs, pass through ExecutorConfig

    Fixes cockroachdb#47903.
    
    Also known as "the grand plumbing", this commit replaces a few instances
    of `TODOSQLCodec` in `pkg/sql/sqlbase/index_encoding.go` and watches the
    house of cards fall apart. It then glues the world back together, this
    time using a properly injected tenant-bound SQLCodec to encode and
    decode all SQL table keys.
    
    A tenant ID field is added to `sqlServerArgs`. This is used to construct
    a tenant-bound `keys.SQLCodec` during server creation. This codec
    morally lives on the `sql.ExecutorConfig`. In practice, it is also
    copied onto `tree.EvalContext` and `execinfra.ServerConfig` to help
    carry it around. SQL code is adapted to use this codec whenever it
    needs to encode or decode keys.
    
    If all tests pass after this refactor, there is a good chance it got
    things right. This is because any use of an uninitialized SQLCodec will
    panic immediately when the codec is first used. This was helpful in
    ensuring that it was properly plumbed everywhere.
    nvanbenschoten committed Apr 30, 2020
    Configuration menu
    Copy the full SHA
    164f82b View commit details
    Browse the repository at this point in the history