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

roachpb,gc,mvcc: add UseClearRange option to GCRequest_GCKey #7

Open
wants to merge 3,270 commits into
base: ajwerner/optimize-MVCCGarbageCollect
Choose a base branch
from
This pull request is big! We’re only showing the most recent 250 commits.

Commits on Oct 20, 2020

  1. Merge cockroachdb#55654

    55654: xform: reorganize rules and tests for consistency r=RaduBerinde a=mgartner
    
    #### xform: organize rules by the type of expressions they match
    
    This commit organizes exploration rules by the type of expressions they
    match. `GenerateZigzagJoins` and `GenerateInvertedZigzagJoins` have been
    moved to `select.opt`. All other rules were correctly organized.
    
    Release note: None
    
    #### xform: reorganize tests to match the organization of the rules
    
    This commit moves around (and makes some minor necessary changes) to
    exploration tests so that tests for rules in `foo.opt` can be found in
    `testdata/foo`. Most of the changes were related to zigzag join rules
    which moved from `join` to `select`, and some tests for
    `GenerateConstrainedScans` that have lived in `scan` for years.
    
    The goal of this change is to make it easier to find tests for a
    specific rule and to set a precedent for future tests.
    
    Release note: None
    
    
    Co-authored-by: Marcus Gartner <marcus@cockroachlabs.com>
    craig[bot] and mgartner committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    e25436f View commit details
    Browse the repository at this point in the history
  2. Merge cockroachdb#55248 cockroachdb#55655 cockroachdb#55721 cockroach…

    …db#55722
    
    55248: sql: add issue link to ALTER TABLE DROP COLUMN with sql_safe_updates r=lucy-zhang a=ajwerner
    
    Explicit transactions with drop column are very dangerous. Inform the user.
    
    Touches cockroachdb#51863.
    
    Release note (sql change): Added a note to inform users with an issue link
    when attempting potentially hazardous DROP COLUMN operations when
    sql_safe_updates is enabled.
    
    55655: xform: organize custom functions into general_funcs.go and scan_funcs.go r=RaduBerinde a=mgartner
    
    #### xform: rename custom_funcs.go to general_funcs.go
    
    This is in preparation for breaking up the custom functions into
    multiple files, similar to the organization of normalization custom
    functions.
    
    Release note: None
    
    #### xform: move scan-related custom functions to scan_funcs.go
    
    This is one step in breaking up the exploration custom functions into
    files based on the rules they facilitate, similar to the normalization
    custom functions.
    
    Release note: None
    
    
    55721: roachtest: bump estimated max warehouses of tpccbench/nodes=3/cpu=16 r=nvanbenschoten a=nvanbenschoten
    
    Now that we're importing instead of restoring and picking up a number
    of optimizations along the way, this estimated max warehouse count is
    too low. This is why we have been flatlining on:
    https://roachperf.crdb.dev/?filter=&view=tpccbench%2Fnodes%3D3%2Fcpu%3D16&tab=gce
    
    55722: sql: ban renaming table to a new database unless both schemas are public r=lucy-zhang a=lucy-zhang
    
    Previously we would seemingly allow renaming tables to a new database
    with arbitrary source and target schemas without ever actually
    reassigning the schema ID. This could lead to a corrupted descriptor
    with an invalid schema ID for the database. This PR fixes the
    implementation to return an error when renaming a table to a different
    database unless both the source and target schemas are `public`.
    
    Fixes cockroachdb#55710.
    
    Release note (bug fix): Previously, changing the parent database and
    schema of a table using `RENAME` was seemingly permitted but would lead
    to corruption of the table metadata. Now an error is returned when
    attempting to rename a table to a different database except in the case
    where both the source and target schemas are the `public` schema in each
    database, which continues to be supported.
    
    Co-authored-by: Andrew Werner <ajwerner@cockroachlabs.com>
    Co-authored-by: Marcus Gartner <marcus@cockroachlabs.com>
    Co-authored-by: Nathan VanBenschoten <nvanbenschoten@gmail.com>
    Co-authored-by: Lucy Zhang <lucy@cockroachlabs.com>
    5 people committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    65bf9e6 View commit details
    Browse the repository at this point in the history
  3. sql: make SPLIT AT output be consistent with SHOW_RANGES

    The output of the SPLIT AT command returns keys in the form
    `/Table/52/1/1` whereas the output of SHOW RANGES omits the
    prefix, of table id and index id, and displays keys as `/1`.
    This is a little confusing and making them consistent would
    make it easier to visually compare.
    
    This patch strips the prefix from the keys in the output of
    SPLIT AT.
    
    Release note (sql change): pretty column of SPLIT AT output was changed
    by stripping prefix. This makes it consistent with output from SHOW
    RANGES.
    neeral committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    3ea77b0 View commit details
    Browse the repository at this point in the history
  4. server: skip unit'ed engines in tombstone storage

    Empty (i.e. uninitialized engines) could receive tombstones before
    being initialized. Initialization checks that the engine is empty
    (save for the cluster version) and thus failed. Simply don't write
    tombstones to uninitialized engines, which is fine since by the
    time the callbacks fire, at least one is initialized anyway, and
    besides, this mechanism is best effort.
    
    The alternatives would have been to either allow tombstones to
    be present on an engine that is being bootstrapped, or to give
    the storage the option to defer writing to the engine once it's
    bootstrapped. Neither seemed worth the extra work.
    
    Fixes cockroachdb#55576.
    
    Release note: None
    tbg committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    6523c22 View commit details
    Browse the repository at this point in the history
  5. Merge cockroachdb#55164

    55164: ui: extend diagnostics column to allow activate and download reports r=koorosh a=koorosh
    
    Resolves cockroachdb#50824
    ~~Depends on cockroachdb/admin-ui-components#31
    ~~Depends on cockroachdb/yarn-vendored#42
    
    Previously, Statements table had a Diagnostics column which allowed
    users to request diagnostics reports for the first time and then
    displayed status for requested report only. As result it wasn't
    possible to download already generated report or request new one
    report from the statements table.
    
    With current changes, Diagnostics column allows requesting new
    reports every time when previous reports are generated.
    Also, it provides a list with links to download previous reports.
    
    The main change is to provide a list of available (or requested)
    reports for every statement (instead of a single, most recent
    report as it was before). Then extracted `StatementsPage` component
    (from `admin-ui-components` package) handles all rendering logic
    for this list of reports.
    
    Minor changes:
    - `WAITING FOR QUERY` status is renamed to `WAITING` for new design
    - `getDiagnosticsStatus` utility function is reused to reduce code
    duplication
    
    Release note (admin ui change): Diagnostics column (on statements table)
    has been changed and includes `Activate` button and dropdown list to
    download completed reports. Also, diagnostics badge status is changed from
    `WAITING FOR QUERY` to `WAITING`
    
    ![Screen Shot 2020-10-01 at 4 55 32 PM](https://user-images.githubusercontent.com/3106437/94915373-77c62c80-04b5-11eb-8fef-4b33db15613b.png)
    
    
    Co-authored-by: Andrii Vorobiov <and.vorobiov@gmail.com>
    craig[bot] and koorosh committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    cf4eb8b View commit details
    Browse the repository at this point in the history
  6. sql: fix crdb_internal.{leases,node_runtime_info} when accessed by a …

    …tenant
    
    Previously, accessing either of theses tables would lead to an internal error.
    This was caused by defaulting to using a null node ID if the node ID was
    unavailable, causing a null violation during validation.
    
    The rest of internal tables simply use the zero node ID, so this commit fixes
    crdb_internal.{leases,node_runtime_info} to use this behavior as well.
    
    Release note: None
    asubiotto committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    a8fff8e View commit details
    Browse the repository at this point in the history
  7. opt: fix normalization of st_distance when use_spheroid parameter used

    This commit fixes the normalization rule that converts st_distance to
    st_dwithin or st_dwithinexclusive, which was broken in the case when
    the use_spheroid parameter was used. Prior to this commit, the rule was
    assigning the use_spheroid parameter as the 3rd parameter to st_dwithin
    or st_dwithinexclusive and the distance parameter as the 4th, but that
    order does not match the function signatures. This commit fixes the issue
    by assigning distance as the 3rd parameter and use_spheroid as the 4th
    if it exists.
    
    Fixes cockroachdb#55675
    
    Release note (bug fix): Fixed an internal error that could occur during
    query planning when the use_spheroid parameter was used in the ST_Distance
    function as part of a filter predicate. For example, `SELECT ... WHERE
    ST_Distance(geog1, geog2, false) < 10` previously caused an error. This
    has now been fixed.
    rytaft committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    50f8485 View commit details
    Browse the repository at this point in the history
  8. Merge cockroachdb#55738

    55738: sql: fix crdb_internal.{leases,node_runtime_info} when accessed by a tenant r=tbg a=asubiotto
    
    Previously, accessing either of theses tables would lead to an internal error.
    This was caused by defaulting to using a null node ID if the node ID was
    unavailable, causing a null violation during validation.
    
    The rest of internal tables simply use the zero node ID, so this commit fixes
    crdb_internal.{leases,node_runtime_info} to use this behavior as well.
    
    Release note: None
    
    Fixes cockroachdb#55701 
    
    Co-authored-by: Alfonso Subiotto Marques <alfonso@cockroachlabs.com>
    craig[bot] and asubiotto committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    c0f7137 View commit details
    Browse the repository at this point in the history
  9. schemachange: refactor GC job code

    To implement cockroachdb#48775 I will be modifying the schema GC code to
    add support for destroying tenants data. I notice3d that the
    current code has redundant repetitions which makes it hard to
    understand and modify.
    
    The logic for computing new deadline and refreshing tables is
    being repeated in 3 code blocks - I have merged them together.
    
    Release note: none.
    Spas Bojanov committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    d85a63d View commit details
    Browse the repository at this point in the history
  10. storage: Use batches for direct RocksDB mutations

    Currently, doing direct mutations on a RocksDB instance bypasses
    custom batching / syncing logic that we've built on top of it.
    This, or something internal to RocksDB, started leading to some bugs
    when all direct mutations started passing in WriteOptions.sync = true
    (see cockroachdb#55240 for when this change went in).
    
    In this change, direct mutations still commit the batch with sync=true
    to guarantee WAL syncing, but they go through the batch commit pipeline
    too, just like the vast majority of operations already do.
    
    Fixes cockroachdb#55362.
    
    Release note: None.
    itsbilal committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    8978797 View commit details
    Browse the repository at this point in the history
  11. Merge cockroachdb#55543

    55543: sql: make SPLIT AT output be consistent with SHOW_RANGES r=ajwerner a=neeral
    
    This fixes cockroachdb#24740
    
    The output of the SPLIT AT command returns keys in the form
    `/Table/52/1/1` whereas the output of SHOW RANGES omits the
    prefix, of table id and index id, and displays keys as `/1`.
    This is a little confusing and making them consistent would
    make it easier to visually compare.
    
    This patch strips the prefix from the keys in the output of
    SPLIT AT.
    
    Release note (sql change): pretty column of SPLIT AT output was changed
    by stripping prefix. This makes it consistent with output from SHOW
    RANGES.
    
    Co-authored-by: neeral <neeral.dodhia@gmail.com>
    craig[bot] and neeral committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    7a576e8 View commit details
    Browse the repository at this point in the history
  12. Merge cockroachdb#55567 cockroachdb#55604 cockroachdb#55616 cockroach…

    …db#55737
    
    55567: geo/geomfn: implement ST_MinimumBoundingCircle r=otan a=C0rWin
    
    This commit implements ST_MinimumBoundingCircle builtin function to
    return polygon shape which approximates minimum bounding circle to
    contain provided geometry.
    
    Resolves: cockroachdb#48987
    
    Signed-off-by: Artem Barger <bartem@il.ibm.com>
    
    Release note (sql change): Returns polygon shape which approximates
    minimum bounding circle to contain geometry
    
    55604: kvserver: improve logging tags in multiTestContext r=andreimatei a=andreimatei
    
    Release note: None
    
    55616: colbuilder: disable wrapping of changefeed processors r=yuzefovich a=yuzefovich
    
    The root of the problem is that `Columnarizer` has buffering behavior -
    in 20.1 it will be hanging until `coldata.BatchSize()` (1024 by default)
    rows are emitted by the changefeed. On 20.2 and master due to dynamic
    batch size behavior it will still be hanging but in a slightly
    different manner.
    
    This is less of a problem on 20.2 and the current master because the
    vectorized engine will not be used for the changefeed DistSQL flow since
    the vectorized row count threshold is never met for it (the estimated
    row count for the plan is 0, so unless a user does
    `SET vectorize_row_count_threshold=0;` or
    `SET vectorize=experimental_always;`, we will always use row-by-row
    engine). In 20.1 the meaning of `vectorize=on` was different - we never
    looked at the threshold and used the vectorized engine if it was
    supported.
    
    In order to fix this issue we simply refuse to wrap the changefeed
    processors, so the row-by-row engine will be always used for changefeed
    flows.
    
    Fixes: cockroachdb#55605.
    
    Release note (bug fix): The current implementation of changefeeds is
    incompatible with the vectorized engine, so whenever the latter is being
    used to run the former, it could hang indefinitely. This is now fixed.
    Namely, on 20.2 releases this could happen if the user runs
    `SET vectorize_row_count_threshold=0;`, and on 20.1 releases - if the
    user runs `SET vectorize=on`.
    
    55737: schemachange: refactor GC job code r=spaskob a=spaskob
    
    To implement cockroachdb#48775 I will be modifying the schema GC code to
    add support for destroying tenants data. I notice3d that the
    current code has redundant repetitions which makes it hard to
    understand and modify.
    
    The logic for computing new deadline and refreshing tables is
    being repeated in 3 code blocks - I have merged them together.
    
    Release note: none.
    
    Co-authored-by: Artem Barger <bartem@il.ibm.com>
    Co-authored-by: Andrei Matei <andrei@cockroachlabs.com>
    Co-authored-by: Yahor Yuzefovich <yahor@cockroachlabs.com>
    Co-authored-by: Spas Bojanov <spas@cockroachlabs.com>
    5 people committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    e16811f View commit details
    Browse the repository at this point in the history
  13. Merge cockroachdb#55708 cockroachdb#55734 cockroachdb#55739

    55708: storage: Use batches for direct RocksDB mutations r=itsbilal a=itsbilal
    
    Currently, doing direct mutations on a RocksDB instance bypasses
    custom batching / syncing logic that we've built on top of it.
    This, or something internal to RocksDB, started leading to some bugs
    when all direct mutations started passing in WriteOptions.sync = true
    (see cockroachdb#55240 for when this change went in).
    
    In this change, direct mutations still commit the batch with sync=true
    to guarantee WAL syncing, but they go through the batch commit pipeline
    too, just like the vast majority of operations already do.
    
    Fixes cockroachdb#55362.
    
    Release note: None.
    
    55734: server: skip unit'ed engines in tombstone storage r=irfansharif a=tbg
    
    Empty (i.e. uninitialized engines) could receive tombstones before
    being initialized. Initialization checks that the engine is empty
    (save for the cluster version) and thus failed. Simply don't write
    tombstones to uninitialized engines, which is fine since by the
    time the callbacks fire, at least one is initialized anyway, and
    besides, this mechanism is best effort.
    
    The alternatives would have been to either allow tombstones to
    be present on an engine that is being bootstrapped, or to give
    the storage the option to defer writing to the engine once it's
    bootstrapped. Neither seemed worth the extra work.
    
    Fixes cockroachdb#55576.
    
    Release note: None
    
    
    55739: opt: fix normalization of st_distance when use_spheroid parameter used r=rytaft a=rytaft
    
    This commit fixes the normalization rule that converts `st_distance` to
    `st_dwithin` or `st_dwithinexclusive`, which was broken in the case when
    the `use_spheroid` parameter was used. Prior to this commit, the rule was
    assigning the `use_spheroid` parameter as the 3rd parameter to `st_dwithin`
    or `st_dwithinexclusive` and the `distance` parameter as the 4th, but that
    order does not match the function signatures. This commit fixes the issue
    by assigning `distance` as the 3rd parameter and `use_spheroid` as the 4th
    if it exists.
    
    Fixes cockroachdb#55675
    
    Release note (bug fix): Fixed an internal error that could occur during
    query planning when the use_spheroid parameter was used in the ST_Distance
    function as part of a filter predicate. For example, `SELECT ... WHERE
    ST_Distance(geog1, geog2, false) < 10` previously caused an error. This
    has now been fixed.
    
    Co-authored-by: Bilal Akhtar <bilal@cockroachlabs.com>
    Co-authored-by: Tobias Grieger <tobias.b.grieger@gmail.com>
    Co-authored-by: Rebecca Taft <becca@cockroachlabs.com>
    4 people committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    d58b0dc View commit details
    Browse the repository at this point in the history
  14. vendor: Bump pebble to 3ff24428f10792b9a4e23129fca3d9ba47c15004

    Changes pulled in:
     - 3ff24428f10792b9a4e23129fca3d9ba47c15004 tool: Add `db checkpoint` command
    
    Release note (cli change): Adds `cockroach debug pebble db checkpoint` debug
    command to easily create a checkpoint without using rocksdb.
    itsbilal committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    7311e35 View commit details
    Browse the repository at this point in the history
  15. authors: add Namrata Kodali to authors

    Release note: None
    nkodali committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    c549a36 View commit details
    Browse the repository at this point in the history
  16. Merge cockroachdb#55751

    55751: vendor: Bump pebble to 3ff24428f10792b9a4e23129fca3d9ba47c15004 r=petermattis a=itsbilal
    
    Changes pulled in:
     - 3ff24428f10792b9a4e23129fca3d9ba47c15004 tool: Add `db checkpoint` command
    
    Release note (cli change): Adds `cockroach debug pebble db checkpoint` debug
    command to easily create a checkpoint without using rocksdb.
    
    Co-authored-by: Bilal Akhtar <bilal@cockroachlabs.com>
    craig[bot] and itsbilal committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    fc0bb2e View commit details
    Browse the repository at this point in the history
  17. rfc: add recommendation for RFC commit prefix to docs

    I noticed that there is no standardized prefix for commit
    messages and PRs for RFC changes or additions. I would like to
    add a recommendation to standardize the prefix to `rfc`.
    
    Previous commits have used: `rfc`, `rfcs`, `docs`, `docs/rfcs`,
    `docs/RFCs` and other variants.
    
    Release note: None
    angelapwen committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    1f3474a View commit details
    Browse the repository at this point in the history
  18. roachtest: don't expect node deaths in tpccbench

    Closes cockroachdb#55542.
    
    This was causing node deaths to be initially ignored in test
    failures like cockroachdb#55542. The monitor was not watching when the
    cluster was restarted, so there was no need to inform it of
    the restart. Because of this, the monitor had an accumulated
    "death quota" that allowed it to ignore the first few deaths
    during the actual run of the test.
    
    I tested this 5 times without issue.
    nvanbenschoten committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    ba0f7c1 View commit details
    Browse the repository at this point in the history
  19. kv: increase defaultRaftLogTruncationThreshold to 16MB

    In v20.1, we increased the default max range size from 64MB to 512MB.
    However, we only doubled (258b965) the default raft log truncation
    threshold. This has the potential to exacerbate issues like cockroachdb#37906,
    because each range will now handle on average 8 times more write load,
    and will therefore be forced to truncate its log on average 4 times as
    frequently as it had previously.
    
    This commit bumps the default raft log truncation to 16MB. It doesn't go
    as far as scaling the log truncation threshold by the max range size
    (either automatically or with a fixed 32MB default) because the cost of
    an individual log truncation is proportional to the log size and we
    don't want to make each log truncation significantly more disruptive.
    16MB seems like a good middle ground and we know that we have customers
    already successfully running in production with this value.
    nvanbenschoten committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    8afeb51 View commit details
    Browse the repository at this point in the history
  20. authors: add amruss to authors

    Realease note: None
    amruss committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    8fbad2a View commit details
    Browse the repository at this point in the history
  21. authors: add ianjevans to authors

    Release note: None
    ianjevans committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    0ec0fe1 View commit details
    Browse the repository at this point in the history
  22. sqlsmith: enable partial index mutator

    This commit re-enables the PartialIndexMutator for sqlsmith tests. This
    mutator was disabled in cockroachdb#55724 after bug fixes in cockroachdb#55702 revealed
    invalid schemas being created in sqlsmith. By reordering the mutators,
    randomly generated schemas are no longer invalid.
    
    Informs cockroachdb#55718
    
    Release note: None
    mgartner committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    d1da553 View commit details
    Browse the repository at this point in the history
  23. Merge cockroachdb#55755 cockroachdb#55760 cockroachdb#55763

    55755: rfc: add recommendation for RFC commit prefix to docs r=bdarnell a=angelapwen
    
    I noticed that there is no standardized prefix for commit
    messages and PRs for RFC changes or additions. I would like to
    add a recommendation to standardize the prefix to `rfc`.
    
    Previous commits have used: `rfc`, `rfcs`, `docs`, `docs/rfcs`,
    `docs/RFCs` and other variants.
    
    Release note: None
    
    55760: authors: add amruss to authors r=otan a=amruss
    
    Realease note: None
    
    55763: authors: add ianjevans to authors r=otan a=ianjevans
    
    Release note: None
    
    Co-authored-by: angelapwen <angelaw@cockroachlabs.com>
    Co-authored-by: Abigail Russell <abbey@cockroachlabs.com>
    Co-authored-by: ianjevans <ian@cockroachlabs.com>
    4 people committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    404a71d View commit details
    Browse the repository at this point in the history
  24. util/quotapool: add WithMinimumWait option to RateLimiter

    This is handy to ensure that the rate limiter does not become a bottleneck
    in the face of many small acquisitions.
    
    Release note: None
    ajwerner committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    c8331c0 View commit details
    Browse the repository at this point in the history
  25. sql: fix bug dropping shard column which is not the last column

    The bug was due to the fact that we were passing around the column descriptor
    as a pointer to an entry in the `Columns` slice. When we overwrote that slice
    we'd clobber the descriptor and, in the process, muck up the mutation which
    pointed to it. We should look for more bugs like this. Prior to this change
    the added logic test would fail with the below error:
    
    ```
    testdata/logic_test/hash_sharded_index:589:
    expected success, but found
    (XXUUU) family "fam_1_k_j" contains unknown column "4"
    ```
    
    Release note (bug fix): Fixed a bug which would prevent the dropping of hash
    sharded indexes if they were added prior to other columns.
    ajwerner committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    cb548f9 View commit details
    Browse the repository at this point in the history
  26. ui: databases page requires click to load table info

    Currently, the databases page automatically loads stats and info
    on all tables in all database simultaneously. This can cause heavy
    load and contention on clusters with hundreds of tables and/or
    databases.
    
    This change introduces a quick fix to prevent the immediate problem
    with the expectation that we will revisit the databases page for
    a more thorough redesign in the near future.
    
    This change adds a button next to each database in the
    databases page titled "Load stats for all tables" which triggers
    the queries to load table-specific stats for just that one database.
    The tables will be loaded in sequence by converting the loading
    loop to use async/await to ensure one query is executed at a time.
    
    One problem this introduces is that the database stats summary
    box on the right computes its data incrementally and will show
    changing data as more tables load for a specific database. We have
    chosen to not show the updated data until all table info has been
    loaded for the given database.
    
    Release note (admin ui change): Loading table-level stats requires
    a button click per-database in order to prevent contention for
    clusters with many databases and/or tables. In addition, the loading
    of table data is staggered by table instead of triggered simultaneously
    for all tables.
    dhartunian committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    847bc2d View commit details
    Browse the repository at this point in the history
  27. Merge cockroachdb#55767

    55767: authors: add Namrata Kodali to authors r=nkodali a=nkodali
    
    Release note: None
    
    Co-authored-by: Namrata Kodali <namrata@cockroachlabs.com>
    craig[bot] and nkodali committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    66aaab5 View commit details
    Browse the repository at this point in the history
  28. sql: add constraint name to constraint error

    Add constraint name to error for unique constraint, check constraint, and foreign key constraint violations. Those constraint names are then propagated over the PostgreSQL wire protocol and will show up for example in JDBC exceptions (org.postgresql.util.PSQLException#getServerErrorMessage().getConstraint()). This commit improves PostgreSQL compatibility of CockroachDB error messages.
    
    Release note (sql change): Add constraint name to constraint errors, to increase wire level PostgreSQL compatibility.
    alex.berger@nexiot.ch authored and alex-berger committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    5d5389d View commit details
    Browse the repository at this point in the history
  29. Merge cockroachdb#55761

    55761: sqlsmith: enable partial index mutator r=yuzefovich a=mgartner
    
    This commit re-enables the PartialIndexMutator for sqlsmith tests. This
    mutator was disabled in cockroachdb#55724 after bug fixes in cockroachdb#55702 revealed
    invalid schemas being created in sqlsmith. By reordering the mutators,
    randomly generated schemas are no longer invalid.
    
    Informs cockroachdb#55718
    
    Release note: None
    
    Co-authored-by: Marcus Gartner <marcus@cockroachlabs.com>
    craig[bot] and mgartner committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    a15c92d View commit details
    Browse the repository at this point in the history
  30. Merge cockroachdb#55559

    55559: ui: databases page requires click to load table info r=dhartunian a=dhartunian
    
    Currently, the databases page automatically loads stats and info
    on all tables in all database simultaneously. This can cause heavy
    load and contention on clusters with hundreds of tables and/or
    databases.
    
    This change introduces a quick fix to prevent the immediate problem
    with the expectation that we will revisit the databases page for
    a more thorough redesign in the near future.
    
    This change adds a button next to each database in the
    databases page titled "Load stats for all tables" which triggers
    the queries to load table-specific stats for just that one database.
    In addition, table stats are staggered at 500ms intervals to prevent
    an immediate triggering of potentially hundreds of queries
    simultaneously.
    
    One problem this introduces is that the database stats summary
    box on the right computes its data incrementally and will show
    changing data as more tables load for a specific database. We might
    want to consider hiding the box until all the table stats load.
    
    Release note (admin ui change): Loading table-level stats requires
    a button click per-database in order to prevent contention for
    clusters with many databases and/or tables. In addition, the loading
    of table data is staggered by table instead of triggered simultaneously
    for all tables.
    
    Co-authored-by: David Hartunian <davidh@cockroachlabs.com>
    craig[bot] and dhartunian committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    cfd03b3 View commit details
    Browse the repository at this point in the history
  31. sql: disallow moving tables with user-defined types into a different DB

    We disallow columns using user-defined types in a different database
    from the table at creation time. However, we have a loophole where it's
    possible to move the table to a different database using `RENAME` and
    thus create a cross-database reference. This breaks backup/restore and
    is generally unintended. This PR adds a check to disallow this.
    
    Release note (bug fix): Tables can no longer be moved to a different
    database using `RENAME` if they have columns using user-defined types
    (enums).
    thoszhang committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    45c0f86 View commit details
    Browse the repository at this point in the history
  32. row: fix crash during tracing given un-decodable datum

    Previously, if tracing was enabled on a query that read bytes that
    weren't decodable into datum, the database would crash.
    
    Release note (bug fix): fix rare crash during tracing when reading
    un-decodable data.
    jordanlewis committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    c6e1231 View commit details
    Browse the repository at this point in the history
  33. Merge cockroachdb#55459 cockroachdb#55660 cockroachdb#55759 cockroach…

    …db#55779
    
    55459: kv: increase defaultRaftLogTruncationThreshold to 16MB r=nvanbenschoten a=nvanbenschoten
    
    In v20.1, we increased the default max range size from 64MB to 512MB. However, we only doubled (258b965) the default raft log truncation threshold. This has the potential to exacerbate issues like cockroachdb#37906, because each range will now handle on average 8 times more write load, and will therefore be forced to truncate its log on average 4 times as frequently as it had previously.
    
    This commit bumps the default raft log truncation to 16MB. It doesn't go as far as scaling the log truncation threshold by the max range size (either automatically or with a fixed 32MB default) because the cost of an individual log truncation is proportional to the log size and we don't want to make each log truncation significantly more disruptive. 16MB seems like a good middle ground and we know that we have customers already successfully running in production with this value.
    
    55660: sql: add constraint name to constraint error r=yuzefovich a=alex-berger
    
    Add constraint name to error for unique constraint, check constraintand foreign key constraint violations. Those constraint names are then propagated over the PostgreSQL wire protocol and will show up for example in JDBC exceptions (org.postgresql.util.PSQLException#getServerErrorMessage().getConstraint()). This commit improves PostgreSQL compatibility.
    
    Release note: Improve PosgreSQL wire protocol compatibility by adding constraint name to sql errors.
    
    55759: roachtest: don't expect node deaths in tpccbench r=nvanbenschoten a=nvanbenschoten
    
    Closes cockroachdb#55542.
    
    This was causing node deaths to be initially ignored in test
    failures like cockroachdb#55542. The monitor was not watching when the
    cluster was restarted, so there was no need to inform it of
    the restart. Because of this, the monitor had an accumulated
    "death quota" that allowed it to ignore the first few deaths
    during the actual run of the test.
    
    I tested this 5 times without issue.
    
    55779: sql: disallow moving tables with user-defined types into a different DB r=lucy-zhang a=lucy-zhang
    
    We disallow columns using user-defined types in a different database
    from the table at creation time. However, we have a loophole where it's
    possible to move the table to a different database using `RENAME` and
    thus create a cross-database reference. This breaks backup/restore and
    is generally unintended. This PR adds a check to disallow this.
    
    Partially addresses cockroachdb#55709.
    Related to cockroachdb#55772.
    
    Release note (bug fix): Tables can no longer be moved to a different
    database using `RENAME` if they have columns using user-defined types
    (enums).
    
    Co-authored-by: Nathan VanBenschoten <nvanbenschoten@gmail.com>
    Co-authored-by: alex.berger@nexiot.ch <alex.berger@nexiot.ch>
    Co-authored-by: Lucy Zhang <lucy@cockroachlabs.com>
    4 people committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    ae78ca7 View commit details
    Browse the repository at this point in the history
  34. Merge cockroachdb#54984

    54984: cli: add support for BIT type in dump r=pbardea a=pbardea
    
    This commit adds support for the BIT type in dump.
    
    Release note (bug fix): Previously, dumps of tables with a BIT type
    column would result in an error. This column type is now supported.
    
    Co-authored-by: Paul Bardea <pbardea@gmail.com>
    craig[bot] and pbardea committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    b00ddd6 View commit details
    Browse the repository at this point in the history
  35. sql: add syntax to create unique constraints without an index

    This commit adds support for the syntax `... UNIQUE WITHOUT INDEX ...`,
    both when adding UNIQUE constraints and when adding UNIQUE columns. Using
    this syntax will currently return the error "unique constraints without
    an index are not yet supported", but support for the syntax serves as a
    starting point for adding support for these unique constraints.
    
    Informs cockroachdb#41535
    
    Release note (sql change): Added support for using the syntax
    `... UNIQUE WITHOUT INDEX ...` in CREATE TABLE and ALTER TABLE statements,
    both when defining columns and unique constraints. Although this syntax
    can now be parsed successfully, using this syntax currently returns an
    error "unique constraints without an index are not yet supported".
    rytaft committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    8aa5357 View commit details
    Browse the repository at this point in the history
  36. backupccl: fix crash in SHOW BACKUP when types have cross-db references

    Previously, SHOW BACKUP would expect that the database and schema it
    references is in the backup. In the case that we had a cross-db
    reference, the schema or database that it references would not be
    included in the backup, and would crash. It now reports objects that it
    cannot find as NULL.
    
    Release note (bug fix): Fix crash when performing a SHOW BACKUP against
    a backup which contains a table that references a type in another
    database. This state was only reachable in 20.2 release candidates and
    earlier.
    pbardea committed Oct 20, 2020
    Configuration menu
    Copy the full SHA
    0b6544f View commit details
    Browse the repository at this point in the history

Commits on Oct 21, 2020

  1. roachprod: add availability zone and network disk type support to azure

    User facing change:
    - New flag `--azure-availability-zone` lets the user supply which zone
    a VM should be provisioned in.
    - New flag `--azure-network-disk-type` lets the user choose which type
    of network disk to use (ultra-disk, premium-ssd)
    
    Previously, we didn't allow users to decide which availability zone a
    VM was provisioned in. To achieve this, this patch adds support for
    Network Security Groups. This was required as we had to update the
    IP SKU from Basic (which is now deprecated) to Standard. By default,
    this SKU blocks all inbound/outbound communication, which needed to be
    overriden by creating network security rules that allow HTTPS/SSH/HTTP
    connections. Network Security Groups are created under the resource
    groups that manage VNets for a particular location the first time a
    VNet is created.
    
    Release note: None
    arulajmani committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    e73b57e View commit details
    Browse the repository at this point in the history
  2. Merge cockroachdb#55774

    55774: backupccl: fix crash in SHOW BACKUP when types have cross-db references r=lucy-zhang,ajwerner a=pbardea
    
    Previously, SHOW BACKUP would expect that the database and schema it
    references is in the backup. In the case that we had a cross-db
    reference, the schema or database that it references would not be
    included in the backup, and would crash. It now reports objects that it
    cannot find as NULL.
    
    Fixes cockroachdb#55772.
    
    Release note (bug fix): Fix crash when performing a SHOW BACKUP against
    a backup which contains a table that references a type in another
    database. This state was only reachable in 20.2 release candidates and
    earlier.
    
    Co-authored-by: Paul Bardea <pbardea@gmail.com>
    craig[bot] and pbardea committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    738848e View commit details
    Browse the repository at this point in the history
  3. Merge cockroachdb#55700

    55700: sql: add syntax to create unique constraints without an index r=rytaft a=rytaft
    
    This commit adds support for the syntax `... UNIQUE WITHOUT INDEX ...`,
    both when adding `UNIQUE` constraints and when adding `UNIQUE` columns. Using
    this syntax will currently return the error "unique constraints without
    an index are not yet supported", but support for the syntax serves as a
    starting point for adding support for these unique constraints.
    
    Informs cockroachdb#41535
    
    Release note (sql change): Added support for using the syntax
    `... UNIQUE WITHOUT INDEX ...` in CREATE TABLE and ALTER TABLE statements,
    both when defining columns and unique constraints. Although this syntax
    can now be parsed successfully, using this syntax currently returns an
    error "unique constraints without an index are not yet supported".
    
    Co-authored-by: Rebecca Taft <becca@cockroachlabs.com>
    craig[bot] and rytaft committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    1d46df7 View commit details
    Browse the repository at this point in the history
  4. build: add bazel-3.7.0 to builder image

    Release note: None
    otan committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    cf4de10 View commit details
    Browse the repository at this point in the history
  5. Merge cockroachdb#55551

    55551: keys: improve printing of node tombstone key r=irfansharif a=tbg
    
    
    
    Co-authored-by: Tobias Grieger <tobias.b.grieger@gmail.com>
    craig[bot] and tbg committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    d735830 View commit details
    Browse the repository at this point in the history
  6. testcluster: avoid t.Fatal on goroutine

    StartServer was using this odd pattern where it took both a `*testing.T`
    and returned an `error`. This method was then also called on a goroutine
    whenever `ParallelStart` was specified.
    
    I wasted quite a bit on these errors (things just hang, really hard to
    debug) so I cleaned this method up to always return an error.
    
    Release note: None
    tbg committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    d301427 View commit details
    Browse the repository at this point in the history
  7. Merge cockroachdb#55550

    55550: testcluster: avoid t.Fatal on goroutine r=knz a=tbg
    
    StartServer was using this odd pattern where it took both a `*testing.T`
    and returned an `error`. This method was then also called on a goroutine
    whenever `ParallelStart` was specified.
    
    I wasted quite a bit on these errors (things just hang, really hard to
    debug) so I cleaned this method up to always return an error.
    
    Release note: None
    
    
    Co-authored-by: Tobias Grieger <tobias.b.grieger@gmail.com>
    craig[bot] and tbg committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    dccebb5 View commit details
    Browse the repository at this point in the history
  8. ui: fix dropdown styles on sessions page

    Before, Session page has filters menu which used default Antd component
    and it deviated common styles.
    
    Now, existing `Dropdown` component is extended to be used in Sessions
    page with extra properties to get more flexibility for customization.
    And this Dropdown is used instead.
    
    Release note: none
    koorosh committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    0cd4f65 View commit details
    Browse the repository at this point in the history
  9. ui: fix links styles for page views

    Previously, "back links" from details page to main
    pages had regression on styles and didn't satisfy
    current designs.
    
    Now, links by default black and have blue color on
    hover only. Also styles for links inside SortedTable
    component is fixed to inherit font size and font styles
    from parent elements
    
    Release note (admin-ui-change): Fix link colors for "Back" link on
    Details pages (Node Overview, Jobs, Sessions, and statements
    details pages.
    koorosh committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    0b664ec View commit details
    Browse the repository at this point in the history
  10. ui: fix pagination on page views

    Previously, `Pagination` component was used from Antd design system
    and every page component added it's own duplicate of custom styles
    on top of Antd Pagination. This introduced multiple places which
    have to changed in order to unify styles across entire app.
    
    Now, main `Pagination` component is added to `admin-ui-components`
    package which is basically wrapper on top of Antd component with
    custom styles. Also, all existing duplicates for styles are removed
    and it avoids confusion to know which Pagination is correct one.
    
    In addition, styles which were duplicated from StatementsPage into
    SessionsPage were re-imported in it's own styles to keep single
    places for changes.
    
    Release note: none
    koorosh committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    efc5872 View commit details
    Browse the repository at this point in the history
  11. ui: fix styles for Session details page

    Session details page had inconsistent styles where headers for sections
    had wrong sizes, spacings between sections were larger than in designs,
    and positions for action buttons (Cancel query and session buttons)
    had to be placed in header section.
    
    Now, styles are adjusted according to designs and fixed in a way to
    avoid global changes. The only one global change is made to reset
    `line-height` property for H1 element which were inherited from <body>
    element and caused wrong text positioning.
    
    Release note (admin ui change): adjusted styles for Session details page
    koorosh committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    ee97a25 View commit details
    Browse the repository at this point in the history
  12. Merge cockroachdb#55766

    55766: sql: fix bug dropping shard column which is not the last column r=lucy-zhang a=ajwerner
    
    The bug was due to the fact that we were passing around the column descriptor
    as a pointer to an entry in the `Columns` slice. When we overwrote that slice
    we'd clobber the descriptor and, in the process, muck up the mutation which
    pointed to it. We should look for more bugs like this. Prior to this change
    the added logic test would fail with the below error:
    
    ```
    testdata/logic_test/hash_sharded_index:589:
    expected success, but found
    (XXUUU) family "fam_1_k_j" contains unknown column "4"
    ```
    
    Release note (bug fix): Fixed a bug which would prevent the dropping of hash
    sharded indexes if they were added prior to other columns.
    
    Co-authored-by: Andrew Werner <ajwerner@cockroachlabs.com>
    craig[bot] and ajwerner committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    d775b98 View commit details
    Browse the repository at this point in the history
  13. Fix multiregion setup

    The multiregion setup is missing a comma, preventing deployments ran using this file from being accessed through `cockroachdb-public.default`.
    This adds in the extra comma and fixes the issue.
    lvdlee committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    0264009 View commit details
    Browse the repository at this point in the history
  14. Merge cockroachdb#55790

    55790: build: add bazel-3.7.0 to builder image r=irfansharif,jlinder a=otan
    
    Resolves cockroachdb#55693 
    
    Release note: None
    
    Co-authored-by: Oliver Tan <otan@cockroachlabs.com>
    craig[bot] and otan committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    c638b8e View commit details
    Browse the repository at this point in the history
  15. Merge cockroachdb#55812

    55812: Fix multiregion setup r=DuskEagle a=Tayo-00
    
    The multiregion setup is missing a comma, preventing deployments ran using this file from being accessed through `cockroachdb-public.default`.
    This adds in the extra comma and fixes the issue.
    
    Co-authored-by: Tayo <l.lee@tayo.ws>
    craig[bot] and lvdlee committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    4b8a9c7 View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    de3d393 View commit details
    Browse the repository at this point in the history
  17. jobs,sqlliveness,server: start sqlliveness after migrations

    This commit reworks the SQL liveness subsystem to start on the local node
    following the migrations that it relies upon. This is both safe and ensures
    that jobs created on the new binary will have a session ID, thus avoiding
    the issue that startable jobs created on the local node may not have had
    a session ID and thus would not have had a proper claim to run the job
    locally.
    
    Fixes cockroachdb#55497.
    
    Release note (bug fix): Fixes a bug which could cause IMPORT, BACKUP or
    RESTORE to experience an error when they occur concurrently to when the
    cluster sets its version to upgraded.
    ajwerner committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    e7bb9d0 View commit details
    Browse the repository at this point in the history
  18. sql: refactor max batch size to unblock metamorphic tests

    Previously, the max mutation batch size variable was duplicated across
    optimizer and execution and couldn't be modified at program start time
    for metamorphic testing. This is now corrected.
    
    Release note: None
    jordanlewis committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    7185ce7 View commit details
    Browse the repository at this point in the history
  19. Merge cockroachdb#55720 cockroachdb#55815

    55720: builtins: add sha224 and sha384 functions r=rafiss a=timgraham
    
    Fixes cockroachdb#42450
    
    Release note (sql change): Add sha224 and sha384 functions.
    
    55815: sql: refactor max batch size to unblock metamorphic tests r=jordanlewis a=jordanlewis
    
    Previously, the max mutation batch size variable was duplicated across
    optimizer and execution and couldn't be modified at program start time
    for metamorphic testing. This is now corrected.
    
    Co-authored-by: Tim Graham <timograham@gmail.com>
    Co-authored-by: Jordan Lewis <jordanthelewis@gmail.com>
    3 people committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    5eba4d3 View commit details
    Browse the repository at this point in the history
  20. cloud: update orchestrator configs to point to v20.1.8

    Release note: None
    asubiotto committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    5d9d317 View commit details
    Browse the repository at this point in the history
  21. roachtest: rename AppDev team to SQL Experience

    Release note: None
    rafiss committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    3564f5e View commit details
    Browse the repository at this point in the history
  22. Merge cockroachdb#55524 cockroachdb#55775 cockroachdb#55820 cockroach…

    …db#55824
    
    55524: jobs,sqlliveness,server: start sqlliveness and pgserver after migrations r=spaskob a=ajwerner
    
    This commit reworks the SQL liveness subsystem to start on the local node
    following the migrations that it relies upon. This is both safe and ensures
    that jobs created on the new binary will have a session ID, thus avoiding
    the issue that startable jobs created on the local node may not have had
    a session ID and thus would not have had a proper claim to run the job
    locally.
    
    Fixes cockroachdb#55497.
    
    Release note (bug fix): Fixes a bug which could cause IMPORT, BACKUP or
    RESTORE to experience an error when they occur concurrently to when the
    cluster sets its version to upgraded.
    
    55775: roachprod: add availability zone and network disk type support to azure r=miretskiy a=arulajmani
    
    User facing change:
    - New flag `--azure-availability-zone` lets the user supply which zone
    a VM should be provisioned in.
    - New flag `--azure-network-disk-type` lets the user choose which type
    of network disk to use (ultra-disk, premium-ssd)
    
    Previously, we didn't allow users to decide which availability zone a
    VM was provisioned in. To achieve this, this patch adds support for
    Network Security Groups. This was required as we had to update the
    IP SKU from Basic (which is now deprecated) to Standard. By default,
    this SKU blocks all inbound/outbound communication, which needed to be
    overriden by creating network security rules that allow HTTPS/SSH/HTTP
    connections. Network Security Groups are created under the resource
    groups that manage VNets for a particular location the first time a
    VNet is created.
    
    Release note: None
    
    55820: roachtest: update 20.2 predecessor version to 20.1.8 and create fixtures r=jlinder a=asubiotto
    
    Release note: None
    
    55824: cloud: update orchestrator configs to point to v20.1.8 r=jlinder a=asubiotto
    
    Release note: None
    
    Co-authored-by: Andrew Werner <ajwerner@cockroachlabs.com>
    Co-authored-by: arulajmani <arulajmani@gmail.com>
    Co-authored-by: Alfonso Subiotto Marques <alfonso@cockroachlabs.com>
    4 people committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    a180d34 View commit details
    Browse the repository at this point in the history
  23. storage: Use vfs.FS.Lock for temp file locking instead of RocksDB

    Previously, we used RocksDB's file locking mechanism for temp directory
    locking. As RocksDB is being removed from the codebase, move to using
    Pebble's syscall-based mechanism.
    
    Release note: None.
    itsbilal committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    5ddbc35 View commit details
    Browse the repository at this point in the history
  24. sql: allow parsing of DROP OWNED BY

    Add parsing and telemetry support for DROP OWNED BY command.
    Includes small refactors of the related REASSIGN OWNED BY
    command such as appending "_by" to some instances of
    "reassign_owned" for readability.
    
    Plan to follow up with implementation of DROP OWNED BY for
    feature parity with PostgresQL, which will resolve the issue
    linked.
    
    Release note: None
    angelapwen committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    740f73d View commit details
    Browse the repository at this point in the history
  25. logictest: add multiregion configuration

    Add a logictest configuration that has three regions, with three
    nodes in three different AZs.
    
    Release note: None
    otan committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    d531b10 View commit details
    Browse the repository at this point in the history
  26. roachpb: fix comment on Lease.Start

    A comment said that the start time of an epoch-based lease is
    ignored, but that's not true. For example, the tscache is reset to the
    lease's start time.
    
    Release note: None
    andreimatei committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    67eb4fc View commit details
    Browse the repository at this point in the history
  27. Merge cockroachdb#55830

    55830: roachpb: fix comment on Lease.Start r=andreimatei a=andreimatei
    
    A comment said that the start time of an epoch-based lease is
    ignored, but that's not true. For example, the tscache is reset to the
    lease's start time.
    
    Release note: None
    
    Co-authored-by: Andrei Matei <andrei@cockroachlabs.com>
    craig[bot] and andreimatei committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    11bbfb6 View commit details
    Browse the repository at this point in the history
  28. *: Stop using RocksDB in Go code

    This change deletes all RocksDB specific Go code, and updates
    all tests that called RocksDB-specific methods to call their Pebble
    versions instead.
    
    This is a prerequisite for deleting RocksDB from the codebase.
    
    Release note (general change): RocksDB can no longer be used as
    the storage engine. Passing in --storage-engine=rocksdb will
    return an error.
    itsbilal committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    4970b3d View commit details
    Browse the repository at this point in the history
  29. cli,cmd: Update --storage-engine text to reflect RocksDB deletion

    As --storage-engine=rocksdb no longer works as a command line
    argument, update the help text for that flag to reflect its nature.
    
    Also skip engine/switch, and inconsistency roachtests as they use
    RocksDB-only functionality.
    
    Release note (cli change): Update --storage-engine help text to
    reflext RocksDB deletion.
    itsbilal committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    87f34d3 View commit details
    Browse the repository at this point in the history
  30. *: Update makefile to not build rocksdb, snappy

    This change updates the Makefile to not build snappy, and rocksdb.
    Libroach is built without those two libraries as well.
    
    Release note: None.
    itsbilal committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    036d9ff View commit details
    Browse the repository at this point in the history
  31. *: Delete RocksDB, snappy from c-deps

    This change is a simple file deletion of:
    c-deps/{rocksdb,snappy}{,-rebuild}
    
    Release note: None
    itsbilal committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    fe629c0 View commit details
    Browse the repository at this point in the history
  32. libroach: Slim libroach to only have the DBDumpThreadStacks method

    This change deletes all of Libroach except for the methods
    necessary to implement DBDumpThreadStacks. Also moves the Go-side
    code to pkg/storage/stacks.go.
    
    Release note: None.
    itsbilal committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    afe5d48 View commit details
    Browse the repository at this point in the history
  33. Merge cockroachdb#55816

    55816: sql: allow parsing of DROP OWNED BY r=otan a=angelapwen
    
    Part 1 of addressing cockroachdb#55381.
    
    Add parsing and telemetry support for DROP OWNED BY command.
    Includes small refactors of the related REASSIGN OWNED BY
    command such as appending "_by" to some instances of
    "reassign_owned" for readability.
    
    Plan to follow up with implementation of DROP OWNED BY for
    feature parity with PostgresQL, which will resolve the issue
    linked.
    
    Note that this command is also making use of `role_spec_list` 
    which as noted in cockroachdb#54696 does not properly parse 
    `CURRENT_USER` or `SESSION_USER` and uses strings for
    roles/usernames rather than expressions. This issue is out of 
    scope for this PR and will be resolved separately.
    
    Release note: None
    
    Co-authored-by: angelapwen <angelaw@cockroachlabs.com>
    craig[bot] and angelapwen committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    37188b0 View commit details
    Browse the repository at this point in the history
  34. Merge cockroachdb#55784

    55784: logictest: add multiregion configuration r=ajstorm a=otan
    
    Add a logictest configuration that has three regions, with three
    nodes in three different AZs.
    
    Release note: None
    
    
    Co-authored-by: Oliver Tan <otan@cockroachlabs.com>
    craig[bot] and otan committed Oct 21, 2020
    Configuration menu
    Copy the full SHA
    40b7942 View commit details
    Browse the repository at this point in the history

Commits on Oct 22, 2020

  1. roachpb: track a few auto-generated files as binary files

    Makes the `git` invocations a bit more useful.
    
    Release note: None
    irfansharif committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    bc95b48 View commit details
    Browse the repository at this point in the history
  2. keys: update doc.go to include node tombstone key

    Release note: None
    irfansharif committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    0c740e3 View commit details
    Browse the repository at this point in the history
  3. opt: simplify execbuilder.BuildScalar

    In all uses of BuildScalar, we map variables directly to columns in
    the metadata. This change simplifies the interface and makes an
    indexed var container internally.
    
    Release note: None
    RaduBerinde committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    49a5d88 View commit details
    Browse the repository at this point in the history
  4. opt: rework scalar optbuilder tests

    This change reworks the infrastructure for tests involving scalars.
    Instead of passing a list of types and using thing like `@1` to refer
    to variables, we define variables with names. This makes the tests a
    lot cleaner and doesn't rely on an obscure syntax. It will also allow
    extending the variable definitions (e.g. computed column expressions).
    
    The new infrastructure will be used for other scalar tests (most
    importantly, index constraints and partial predicate implication).
    
    Release note: None
    RaduBerinde committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    a54e705 View commit details
    Browse the repository at this point in the history
  5. opt: update memo/expr_test to use ScalarVars

    Release note: None
    RaduBerinde committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    155f023 View commit details
    Browse the repository at this point in the history
  6. opt: update composite_sensitive test to use ScalarVars

    Release note: None
    RaduBerinde committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    d6bdc6e View commit details
    Browse the repository at this point in the history
  7. opt: update implicator tests to use ScalarVars

    Release note: None
    RaduBerinde committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    d31f394 View commit details
    Browse the repository at this point in the history
  8. opt: update idxconstraint tests to use ScalarVars

    Release note: None
    RaduBerinde committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    5faff5d View commit details
    Browse the repository at this point in the history
  9. Merge cockroachdb#55843 cockroachdb#55844

    55843: roachpb: track a few auto-generated files as binary files r=irfansharif a=irfansharif
    
    Makes the `git` invocations a bit more useful.
    
    Release note: None
    
    55844: keys: update doc.go to include node tombstone key r=irfansharif a=irfansharif
    
    Release note: None
    
    Co-authored-by: irfan sharif <irfanmahmoudsharif@gmail.com>
    craig[bot] and irfansharif committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    4019977 View commit details
    Browse the repository at this point in the history
  10. Merge cockroachdb#55509

    55509: *: Remove RocksDB r=itsbilal a=itsbilal
    
    As in title. Removes RocksDB and snappy, from the `c-deps` directory,
    and updates tests and roachtests to reflect a Pebble-only world. Libroach
    is slimmed to just the one method (`DumpThreadStacks`) that is still necessary.
    
    As this is a massive change, I've tried to make it as easy to review as possible by
    splitting changes in different commits. The first commit just updates temp file locking,
    the second commit deletes RocksDB-specific code paths and updates the few remaining
    RocksDB-only tests to use equivalent Pebble code paths, the fourth commit has
    Makefile changes, and the last commit is a plain file deletion in `c-deps`. 
    
    This is ready for review, though the following relatively-minor tasks are still TODO:
    
    - [x] Resolve merge conflicts
    - [x] Pass lint
    - [x] Bring back thread stack dumps as they may be necessary for inspecting other CGo code
    
    Co-authored-by: Bilal Akhtar <bilal@cockroachlabs.com>
    craig[bot] and itsbilal committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    fdeb78b View commit details
    Browse the repository at this point in the history
  11. Merge cockroachdb#55499

    55499: ui: update styles for session details page r=koorosh a=koorosh
    
    resolves cockroachdb#54513 
    depends on cockroachdb/admin-ui-components#31
    depends on cockroachdb/admin-ui-components#34
    depends on cockroachdb/admin-ui-components#35
    
    Current fix is quite complex and touches a lot of places because most of the issues with styles were common for all pages (Statements, Jobs, Node Overview).
    Also many style duplicates required to get rid of duplicates and unify single version of proper components to use across entire app.
    
    It's easier to review this PR per commit. Each commit describes in details what changes were made and their purpose.
     
    ![Screen Shot 2020-10-13 at 3 18 18 PM](https://user-images.githubusercontent.com/3106437/95859522-690a3000-0d67-11eb-94bb-1cccaac1d816.png)
    
    ![Screen Shot 2020-10-13 at 1 43 23 PM](https://user-images.githubusercontent.com/3106437/95856423-a9b37a80-0d62-11eb-8ade-54e8ed5b895c.png)
    
    
    Co-authored-by: Andrii Vorobiov <and.vorobiov@gmail.com>
    craig[bot] and koorosh committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    ee2e28d View commit details
    Browse the repository at this point in the history
  12. build: remove unused ROCKSDB variables

    Release note: None
    jordanlewis committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    2701d10 View commit details
    Browse the repository at this point in the history
  13. Merge cockroachdb#55855

    55855: build: remove unused ROCKSDB variables r=jordanlewis a=jordanlewis
    
    Release note: None
    
    Co-authored-by: Jordan Lewis <jordanthelewis@gmail.com>
    craig[bot] and jordanlewis committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    2385a18 View commit details
    Browse the repository at this point in the history
  14. sql: create event log entry for schema events

    Previously, events were not created when schema objects were
    created, dropped or modified.
    
    Fixes cockroachdb#55744
    
    Release note (admin ui change): changing schema object
    now causes an event to be logged and displayed in the admin ui
    neeral committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    4641c2c View commit details
    Browse the repository at this point in the history
  15. util: treeprinter improvements and new style

    This change cleans up the treeprinter implementation and interface and
    adds a "with bullets" style that looks like this:
    ```
      • foo
      │
      ├── • bar1
      │   │ bar2
      │   │
      │   └── • baz
      │
      └── • qux
    ```
    This is a preliminary design from Anne for the new EXPLAIN output.
    
    Release note: None
    RaduBerinde committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    732253f View commit details
    Browse the repository at this point in the history
  16. opt: rework explain output test

    Changing the explain output test from an Example to a datadriven test
    (which is much easier to update).
    
    Release note: None
    RaduBerinde committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    55f96a6 View commit details
    Browse the repository at this point in the history
  17. sql: use new explain format in explain bundles

    This change switches the plan string in EXPLAIN ANALYZE (DEBUG)
    bundles to use the new style with bullets. See the updated test for
    some examples.
    
    Release note: None
    RaduBerinde committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    09a0123 View commit details
    Browse the repository at this point in the history
  18. Merge cockroachdb#55785

    55785: sql: create event log entry for schema events r=jordanlewis,arulajmani a=neeral
    
    Previously, events were not created when schema objects were
    created, dropped or modified.
    
    Fixes cockroachdb#55744 
    
    Release note (admin ui change): changing schema object
    now causes an event to be logged and displayed in the admin ui
    
    Co-authored-by: neeral <neeral.dodhia@gmail.com>
    craig[bot] and neeral committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    8d5790f View commit details
    Browse the repository at this point in the history
  19. *: Remove cryptopp from c-deps, stop building it

    libcryptopp was only used for RocksDB encryption-at-rest. Now
    that RocksDB is deleted (cockroachdb#55509), we can remove libcryptopp too.
    
    Release note: None.
    itsbilal committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    ccd4d31 View commit details
    Browse the repository at this point in the history
  20. logictest: enhance crdb_internal_tenant logic test

    This commit copies the full crdb_internal test to crdb_internal_tenant, and
    rewrites it to succeed with this configuration in order to increase
    crdb_internal tenant test coverage.
    
    Release note: None (testing change)
    asubiotto committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    62e5a5c View commit details
    Browse the repository at this point in the history
  21. ccl/backupccl: skip TestBackupRestoreAppend under race

    Refs: cockroachdb#50984, cockroachdb#54599
    
    Reason: flaky test
    
    Generated by bin/skip-test.
    
    Release justification: non-production code changes
    
    Release note: None
    rytaft committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    aa486a6 View commit details
    Browse the repository at this point in the history
  22. opt: change rule for anti joins using inverted index

    These are now converted into paired joins consisting of
    a left outer inverted join followed by an left anti
    lookup join. This is more efficient than the previous
    approach that involved two left outer joins and removal
    of the matching rows using a select.
    
    Release note: None
    sumeerbhola committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    6a93b59 View commit details
    Browse the repository at this point in the history
  23. sessiondata: extract all non-local parameters into a protobuf

    This commit divides up all the session parameters into two categories:
    local only (those that don't influence the execution if not propagated
    to the remote nodes) and non-local (those that must be propagated). The
    former are extracted into a separate struct, and the latter are now
    mostly stored directly in a protobuf with a few exceptions having custom
    serialization/deserialization logic. This allows us to clean up the eval
    context proto and centralize the custom logic and the definition.
    
    This commit also fixed an issue of not propagating the default int size
    which - in theory - could influence the execution on the remote nodes
    (e.g. when performing a cast by an internal executor).
    
    Release note: None
    yuzefovich committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    ab19e5c View commit details
    Browse the repository at this point in the history
  24. Merge cockroachdb#55569

    55569: sessiondata: extract all non-local parameters into a protobuf r=yuzefovich a=yuzefovich
    
    This commit divides up all the session parameters into two categories:
    local only (those that don't influence the execution if not propagated
    to the remote nodes) and non-local (those that must be propagated). The
    former are extracted into a separate struct, and the latter are now
    mostly stored directly in a protobuf with a few exceptions having custom
    serialization/deserialization logic. This allows us to clean up the eval
    context proto and centralize the custom logic and the definition.
    
    This commit also fixed an issue of not propagating the default int size
    which - in theory - could influence the execution on the remote nodes
    (e.g. when performing a cast by an internal executor).
    
    Fixes: cockroachdb#51075.
    
    Release note: None
    
    Co-authored-by: Yahor Yuzefovich <yahor@cockroachlabs.com>
    craig[bot] and yuzefovich committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    dd647f5 View commit details
    Browse the repository at this point in the history
  25. util: add skip.UnderMetamorphic; skip a test

    One test cannot be run under the metamorphic build configuration, since
    its output depends on the batch size: the test counts the number of
    spans scanned, which will go up with a small batch size due to the table
    reader resuming the scan until its finished.
    
    Release note: None
    jordanlewis committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    7c92a73 View commit details
    Browse the repository at this point in the history
  26. Merge cockroachdb#55858

    55858: *: Remove cryptopp from c-deps, stop building it r=petermattis a=itsbilal
    
    libcryptopp was only used for RocksDB encryption-at-rest. Now
    that RocksDB is deleted (cockroachdb#55509), we can remove libcryptopp too.
    
    Release note: None.
    
    Co-authored-by: Bilal Akhtar <bilal@cockroachlabs.com>
    craig[bot] and itsbilal committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    840e101 View commit details
    Browse the repository at this point in the history
  27. Merge cockroachdb#55637 cockroachdb#55825

    55637: sql: use new explain format in explain bundles r=RaduBerinde a=RaduBerinde
    
    #### util: treeprinter improvements and new style
    
    This change cleans up the treeprinter implementation and interface and
    adds a "with bullets" style that looks like this:
    ```
      • foo
      │
      ├── • bar1
      │   │ bar2
      │   │
      │   └── • baz
      │
      └── • qux
    ```
    This is a preliminary design from Anne for the new EXPLAIN output.
    
    Release note: None
    
    #### opt: rework explain output test
    
    Changing the explain output test from an Example to a datadriven test
    (which is much easier to update).
    
    Release note: None
    
    #### sql: use new explain format in explain bundles
    
    This change switches the plan string in EXPLAIN ANALYZE (DEBUG)
    bundles to use the new style with bullets. See the updated test for
    some examples.
    
    Release note: None
    
    55825: roachtest: rename AppDev team to SQL Experience r=solongordon a=rafiss
    
    Release note: None
    
    Co-authored-by: Radu Berinde <radu@cockroachlabs.com>
    Co-authored-by: Rafi Shamim <rafi@cockroachlabs.com>
    3 people committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    cb31c8c View commit details
    Browse the repository at this point in the history
  28. Merge cockroachdb#55792

    55792: opt: rework tests involving scalar expressions r=RaduBerinde a=RaduBerinde
    
    #### opt: simplify execbuilder.BuildScalar
    
    In all uses of BuildScalar, we map variables directly to columns in
    the metadata. This change simplifies the interface and makes an
    indexed var container internally.
    
    Release note: None
    
    #### opt: rework scalar optbuilder tests
    
    This change reworks the infrastructure for tests involving scalars.
    Instead of passing a list of types and using thing like `@1` to refer
    to variables, we define variables with names. This makes the tests a
    lot cleaner and doesn't rely on an obscure syntax. It will also allow
    extending the variable definitions (e.g. computed column expressions).
    
    The new infrastructure will be used for other scalar tests (most
    importantly, index constraints and partial predicate implication).
    
    Release note: None
    
    #### opt: update memo/expr_test to use ScalarVars
    
    Release note: None
    
    #### opt: update composite_sensitive test to use ScalarVars
    
    Release note: None
    
    #### opt: update implicator tests to use ScalarVars
    
    Release note: None
    
    #### opt: update idxconstraint tests to use ScalarVars
    
    Release note: None
    
    Co-authored-by: Radu Berinde <radu@cockroachlabs.com>
    craig[bot] and RaduBerinde committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    fa45ab4 View commit details
    Browse the repository at this point in the history
  29. importccl: moved bundle import logic from planning phase to job execu…

    …tion phase.
    
    Previously, the logic for parsing schemas of Bundle forms such as postgresql dumps and mysql
    dumps was located in the planning phase for the import statement.
    
    This was inadequate because for large bundle imports where schema parsing takes
    up to an hour, there was no signal to the user that something was taking place.
    
    To address this, the logic for schema parsing for bundle formats was moved from the
    planning phase to the job execution phase. In the job execution phase, a RunningStatus
    was added to indicate to the user that the schema is being parsed.
    
    Release note: None
    mokaixu committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    28117d0 View commit details
    Browse the repository at this point in the history
  30. server: support adding stores to existing nodes

    We need to bootstrap additional stores asynchronously. Consider the range that
    houses the store ID allocator. When restarting the set of nodes that holds a
    quorum of these replicas, when restarting them with additional stores, those
    additional stores will require store IDs to get fully bootstrapped. But if
    we're gating node start (specifically opening up the RPC floodgates) on having
    all stores fully bootstrapped, we'll simply hang when trying to allocate store
    IDs.  See TestAddNewStoresToExistingNodes and cockroachdb#39415 for more details.
    
    Instead we opt to bootstrap additional stores asynchronously, and rely on the
    blocking function to signal to the caller that all stores have been fully
    bootstrapped.
    
    Release note: None
    
    Co-authored-by: Sam Huang <samh@cockroachlabs.com>
    Co-authored-by: Tobias Grieger <tobias.b.grieger@gmail.com>
    3 people committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    991a01d View commit details
    Browse the repository at this point in the history
  31. Merge cockroachdb#55742

    55742: opt: change rule for anti joins using inverted index r=sumeerbhola a=sumeerbhola
    
    These are now converted into paired joins consisting of
    a left outer inverted join followed by an left anti
    lookup join. This is more efficient than the previous
    approach that involved two left outer joins and removal
    of the matching rows using a select.
    
    Release note: None
    
    Co-authored-by: sumeerbhola <sumeer@cockroachlabs.com>
    craig[bot] and sumeerbhola committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    d82dc5c View commit details
    Browse the repository at this point in the history
  32. colexec: fix tuple index mismatch in ordered distinct aggregation

    We're handling the DISTINCT aggregations by populating new selection
    vector to include only the tuples that are distinct to be aggregated by
    a particular function. Previously, we would convert the arguments to
    default aggregate function in case of ordered aggregation "with
    deselection" step (this is a minor optimization). However, combining
    these two things makes it very hard to know at which position in the
    converted []tree.Datum vectors the arguments of a tuple actually live
    which would result in us using the wrong ones. As a result, when
    actually performing the aggregation we could see that there is
    a selection vector (populated by the distinctness helper), yet there was
    no original selection vector on the batch itself, so we would use
    incorrect indices to look up the arguments in the converted []tree.Datum
    slices.
    
    Now this is fixed by following the pattern of the hash aggregator -
    converting the input argument vectors without the deselection. In order
    for the bug to be triggered we need to have at least two aggregate
    functions with one of them handled by the default aggregate function (i.e.
    it doesn't have an optimized implementation) with DISTINCT clause (if
    the projection contains only that function, then the distinct operation
    is pushed out of the aggregation into a distinct stage).
    
    Release note (bug fix): CockroachDB could previously incorrectly compute
    some aggregate functions with DISTINCT clauses when the query projects
    other columns/functions and the vectorized engine was used. This bug was
    introduced in 20.2.0.alpha.3 release.
    yuzefovich committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    c2b8204 View commit details
    Browse the repository at this point in the history
  33. sql: fix planning of distinct stage with mix of (non-)distinct aggreg…

    …ations
    
    When performing the physical planning of aggregation we have some
    optimizations:
    - we try to distribute the actual aggregation if all functions support
    it, the previous stage is distributed, and no function has DISTINCT
    clause
    - if we can't do a multi-stage aggregation, then we might plan
    a distributed distinct stage if all functions have a DISTINCT clause.
    
    However, previously, we could incorrectly evaluate whether all functions
    have a DISTINCT clause if the function that doesn't support distributed
    computation is preceding non-distinct function because we broke out of
    the loop. As an example, queries like `SELECT corr(DISTINCT y, x),
    count(y) ...` would incorrectly think that they can do local distinct
    operation, but this would lead to incorrect results.
    
    This is now fixed by separating out the optimization of performing
    a local distinct stage (which is always beneficial to do; when all
    functions have DISTINCT clause) and then deciding whether we can do
    multi-stage aggregation.
    
    Release note (bug fix): CockroachDB previously could return incorrect
    results in rare circumstances when computing the aggregation functions
    when some of the functions have DISTINCT clause and some don't (the
    latter might not see all the necessary data), and this is now fixed.
    This bug has been present for several years.
    yuzefovich committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    f7c9cb3 View commit details
    Browse the repository at this point in the history
  34. Merge cockroachdb#55780

    55780: sql,colexec: fix distinct aggregation r=yuzefovich a=yuzefovich
    
    **colexec: fix tuple index mismatch in ordered distinct aggregation**
    
    We're handling the DISTINCT aggregations by populating new selection
    vector to include only the tuples that are distinct to be aggregated by
    a particular function. Previously, we would convert the arguments to
    default aggregate function in case of ordered aggregation "with
    deselection" step (this is a minor optimization). However, combining
    these two things makes it very hard to know at which position in the
    converted []tree.Datum vectors the arguments of a tuple actually live
    which would result in us using the wrong ones. As a result, when
    actually performing the aggregation we could see that there is
    a selection vector (populated by the distinctness helper), yet there was
    no original selection vector on the batch itself, so we would use
    incorrect indices to look up the arguments in the converted []tree.Datum
    slices.
    
    Now this is fixed by following the pattern of the hash aggregator -
    converting the input argument vectors without the deselection. In order
    for the bug to be triggered we need to have at least two aggregate
    functions with one of them handled by the default aggregate function (i.e.
    it doesn't have an optimized implementation) with DISTINCT clause (if
    the projection contains only that function, then the distinct operation
    is pushed out of the aggregation into a distinct stage).
    
    Fixes: cockroachdb#55776.
    
    Release note (bug fix): CockroachDB could previously incorrectly compute
    some aggregate functions with DISTINCT clauses when the query projects
    other columns/functions and the vectorized engine was used. This bug was
    introduced in 20.2.0.alpha.3 release.
    
    **sql: fix planning of distinct stage with mix of (non-)distinct aggregations**
    
    When performing the physical planning of aggregation we have some
    optimizations:
    - we try to distribute the actual aggregation if all functions support
    it, the previous stage is distributed, and no function has DISTINCT
    clause
    - if we can't do a multi-stage aggregation, then we might plan
    a distributed distinct stage if all functions have a DISTINCT clause.
    
    However, previously, we could incorrectly evaluate whether all functions
    have a DISTINCT clause if the function that doesn't support distributed
    computation is preceding non-distinct function because we broke out of
    the loop. As an example, queries like `SELECT corr(DISTINCT y, x),
    count(y) ...` would incorrectly think that they can do local distinct
    operation, but this would lead to incorrect results.
    
    This is now fixed by separating out the optimization of performing
    a local distinct stage (which is always beneficial to do; when all
    functions have DISTINCT clause) and then deciding whether we can do
    multi-stage aggregation.
    
    Fixes: cockroachdb#55837.
    
    Release note (bug fix): CockroachDB previously could return incorrect
    results in rare circumstances when computing the aggregation functions
    when some of the functions have DISTINCT clause and some don't (the
    latter might not see all the necessary data), and this is now fixed.
    This bug has been present for several years.
    
    Co-authored-by: Yahor Yuzefovich <yahor@cockroachlabs.com>
    craig[bot] and yuzefovich committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    b824913 View commit details
    Browse the repository at this point in the history
  35. Merge cockroachdb#55350

    55350: server: support adding stores to existing nodes r=irfansharif a=TheSamHuang
    
    We need to bootstrap additional stores asynchronously. Consider the range that
    houses the store ID allocator. When restarting the set of nodes that holds a
    quorum of these replicas, when restarting them with additional stores, those
    additional stores will require store IDs to get fully bootstrapped. But if
    we're gating node start (specifically opening up the RPC floodgates) on having
    all stores fully bootstrapped, we'll simply hang when trying to allocate store
    IDs.  See TestAddNewStoresToExistingNodes and cockroachdb#39415 for more details.
    
    Instead we opt to bootstrap additional stores asynchronously, and rely on the
    blocking function to signal to the caller that all stores have been fully
    bootstrapped.
    
    Co-authored-by: irfan sharif <irfanmahmoudsharif@gmail.com>
    craig[bot] and irfansharif committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    4e88183 View commit details
    Browse the repository at this point in the history
  36. xform: move select.opt functions to select_funcs.go

    This is part of a refactoring to split up xform custom functions,
    similar to normalization custom functions.
    
    Release note: None
    mgartner committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    b35db68 View commit details
    Browse the repository at this point in the history
  37. xform: move limit.opt functions to limit_funcs.go

    Release note: None
    mgartner committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    92573d7 View commit details
    Browse the repository at this point in the history
  38. xform: move groupby.opt functions to groupby_funcs.go

    Release note: None
    mgartner committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    9649d4b View commit details
    Browse the repository at this point in the history
  39. xform: move join.opt functions to join_funcs.go

    Release note: None
    mgartner committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    457c974 View commit details
    Browse the repository at this point in the history
  40. cmd,skip: add flag to skip test under race

    This commit updates the skip-test command to support a flag -under_race,
    which only skips the test under race builds. This commit also adds a new
    function to the skip package, UnderRaceWithIssue, which makes it easier to
    skip a test under race and log the associated issue.
    
    Release note: None
    rytaft committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    1c9d551 View commit details
    Browse the repository at this point in the history
  41. colexecagg: move the aggregate functions into a separate package

    This commit does the following:
    - moves all aggregate functions into the newly created `colexecagg`
    package
    - moves previously private struct `colexec.overloadHelper` into
    `execgen` package and exports the struct and all of its fields
    - moves `colexec.Closer` into `colexecbase`
    - moves `colexec.GetDatumToPhysical` to `colconv` package and renames
    the file where that function lives from `utils` to `datum_to_vec`.
    
    This is done as the first step at reducing the size of `colexec`
    package.
    
    Release note: None
    yuzefovich committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    d61a426 View commit details
    Browse the repository at this point in the history
  42. Merge cockroachdb#55796

    55796: colexecagg: move the aggregate functions into a separate package r=yuzefovich a=yuzefovich
    
    This commit does the following:
    - moves all aggregate functions into the newly created `colexecagg`
    package
    - moves previously private struct `colexec.overloadHelper` into
    `execgen` package and exports the struct and all of its fields
    - moves `colexec.Closer` into `colexecbase`
    - moves `colexec.GetDatumToPhysical` to `colconv` package and renames
    the file where that function lives from `utils` to `datum_to_vec`.
    
    This is done as the first step at reducing the size of `colexec`
    package.
    
    Release note: None
    
    Co-authored-by: Yahor Yuzefovich <yahor@cockroachlabs.com>
    craig[bot] and yuzefovich committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    3b3d273 View commit details
    Browse the repository at this point in the history
  43. roachtest: disable range merge queue in tpchvec/tpcdsvec

    This commit disables the range merge queue on tpchvec and tpcdsvec
    roachtests in order to - hopefully - reduce some noise about the
    performance slowness. I'm guessing that some of the variation that we've
    been observing with tpchvec/perf tests might come due to range merge
    activity, so let's remove that variable. However, I don't have concrete
    data to back this guess up.
    
    Release note: None
    yuzefovich committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    a78e336 View commit details
    Browse the repository at this point in the history
  44. {kv,}server: prune out a few cluster version helpers

    These helpers don't really add anything, they're just different ways to
    read/write to the store local cluster version key. This is an area we're
    looking to coalesce/repurpose in future PRs, so sending out this
    drive-by clean up + documentation early.
    
    Release note: None
    irfansharif committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    2d4ed9c View commit details
    Browse the repository at this point in the history
  45. Merge cockroachdb#55828 cockroachdb#55853 cockroachdb#55857 cockroach…

    …db#55863
    
    55828: roachtest: disable range merge queue in tpchvec/tpcdsvec r=yuzefovich a=yuzefovich
    
    This commit disables the range merge queue on tpchvec and tpcdsvec
    roachtests in order to - hopefully - reduce some noise about the
    performance slowness. I'm guessing that some of the variation that we've
    been observing with tpchvec/perf tests might come due to range merge
    activity, so let's remove that variable. However, I don't have concrete
    data to back this guess up.
    
    Release note: None
    
    55853: ccl/backupccl: skip TestBackupRestoreAppend under race r=rytaft a=rytaft
    
    Refs: cockroachdb#50984, cockroachdb#54599
    
    Reason: flaky test
    
    Generated by bin/skip-test.
    
    Release justification: non-production code changes
    
    Release note: None
    
    55857: cmd,skip: add flag to skip test under race r=rytaft a=rytaft
    
    This commit updates the `skip-test` command to support a flag `-under_race`,
    which only skips the test under race builds. This commit also adds a new
    function to the skip package, `UnderRaceWithIssue`, which makes it easier to
    skip a test under race and log the associated issue.
    
    Release note: None
    
    55863: util: add skip.UnderMetamorphic; skip a test r=jordanlewis a=jordanlewis
    
    One test cannot be run under the metamorphic build configuration, since
    its output depends on the batch size: the test counts the number of
    spans scanned, which will go up with a small batch size due to the table
    reader resuming the scan until its finished.
    
    Release note: None
    
    Co-authored-by: Yahor Yuzefovich <yahor@cockroachlabs.com>
    Co-authored-by: Rebecca Taft <becca@cockroachlabs.com>
    Co-authored-by: Jordan Lewis <jordanthelewis@gmail.com>
    4 people committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    badbaad View commit details
    Browse the repository at this point in the history
  46. sql - Implement SHOW REGIONS

    Previously, SHOW REGIONS was an unimplemented stub.  This
    PR implements the SHOW REGIONS such that when issued, it
    shows all of the regions available to the cluster.
    
    Release note (sql change): Implement SHOW REGIONS so that
    customers can easily see all of the regions available in their cluster.
    
    example:
    
    SHOW REGIONS
    
        region    | availability_zones
    --------------+---------------------
      asia-east   | {b}
      europe-east | {a}
      us-east     | {a,b}
      us-west     | {a}
    (4 rows)
    ajstorm committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    99d6ed7 View commit details
    Browse the repository at this point in the history
  47. logictest: fix comparison logic

    `9d2c054fd3e9e8c6a7d73f4e464ebd32ee82b8a2` introduced a bug in the
    commit logic where it would only check logic test errors for the first
    line, since it only compares the first column of results. This is now
    fixed to compare every row.
    
    Release note: None
    otan committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    bc1b3e5 View commit details
    Browse the repository at this point in the history
  48. Merge cockroachdb#55783

    55783: row: fix crash during tracing given un-decodable datum r=jordanlewis a=jordanlewis
    
    Previously, if tracing was enabled on a query that read bytes that
    weren't decodable into datum, the database would crash.
    
    Release note (bug fix): fix rare crash during tracing when reading
    un-decodable data.
    
    Co-authored-by: Jordan Lewis <jordanthelewis@gmail.com>
    craig[bot] and jordanlewis committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    3853555 View commit details
    Browse the repository at this point in the history
  49. Merge cockroachdb#55838

    55838: xform: split custom functions into multiple files r=RaduBerinde a=mgartner
    
    #### xform: move select.opt functions to select_funcs.go
    
    This is part of a refactoring to split up xform custom functions,
    similar to normalization custom functions.
    
    Release note: None
    
    #### xform: move limit.opt functions to limit_funcs.go
    
    Release note: None
    
    #### xform: move groupby.opt functions to groupby_funcs.go
    
    Release note: None
    
    #### xform: move join.opt functions to join_funcs.go
    
    Release note: None
    
    
    Co-authored-by: Marcus Gartner <marcus@cockroachlabs.com>
    craig[bot] and mgartner committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    e5470a0 View commit details
    Browse the repository at this point in the history
  50. Merge cockroachdb#55876

    55876: logictest: fix comparison logic r=yuzefovich a=otan
    
    `9d2c054fd3e9e8c6a7d73f4e464ebd32ee82b8a2` introduced a bug in the
    commit logic where it would only check logic test errors for the first
    line, since it only compares the first column of results. This is now
    fixed to compare every row.
    
    Release note: None
    
    Co-authored-by: Oliver Tan <otan@cockroachlabs.com>
    craig[bot] and otan committed Oct 22, 2020
    Configuration menu
    Copy the full SHA
    4702643 View commit details
    Browse the repository at this point in the history

Commits on Oct 23, 2020

  1. sql,opt: export pg_catalog table schemas for use by optimizer

    This commit moves the schema definitions of all tables in pg_catalog to
    a new file in sql/vtable called pg_catalog.go and exports them so they
    can be used by the optimizer and elsewhere. This is similar to what was
    already done for the information_schema tables.
    
    Release note: None
    rytaft committed Oct 23, 2020
    Configuration menu
    Copy the full SHA
    3ea917c View commit details
    Browse the repository at this point in the history
  2. tracing: make span a union type

    Clarify that a `span` is anywhere between zero to three subspans:
    
    - net/trace,
    - external opentracing Tracer, and
    - crdb-internal trace span,
    
    where zero subspans corresponds to what is today noopSpan (not
    implemented yet, but TODO added).
    
    Lots of threads to pull, but this is a good checkpoint since
    everything compiles and the diff is mechanical and small enough
    to actually review.
    
    Release note: None
    tbg committed Oct 23, 2020
    Configuration menu
    Copy the full SHA
    8598646 View commit details
    Browse the repository at this point in the history
  3. tracing: remove noopSpan

    Remove the noopSpan and noopSpanContext types. Instead, we use a `*span`
    (and `*spanContext`) with a zero trace ID (and in fact, all zero except
    for the tracer).
    
    This allows a sleuth of further cleanups which are deferred to follow-up
    commits.
    
    Release note: None
    tbg committed Oct 23, 2020
    Configuration menu
    Copy the full SHA
    3e7d258 View commit details
    Browse the repository at this point in the history
  4. tracing: move tracer from crdbSpan to span

    That's where it belongs.
    
    Release note: None
    tbg committed Oct 23, 2020
    Configuration menu
    Copy the full SHA
    75dc94a View commit details
    Browse the repository at this point in the history
  5. tracing: improve comment on (*span).isNoop()

    Release note: None
    tbg committed Oct 23, 2020
    Configuration menu
    Copy the full SHA
    b9ae26d View commit details
    Browse the repository at this point in the history
  6. tracing: harmonize subspan field names

    Release note: None
    tbg committed Oct 23, 2020
    Configuration menu
    Copy the full SHA
    e676d03 View commit details
    Browse the repository at this point in the history
  7. tracing: un-embed crdbSpan

    Lots of top-level logic reaches into the `crdbSpan`, which is not ideal.
    We want top-level tracing methods to delegate to a method on each of the
    subspans of our main `span` type.
    
    This commit doesn't do anything about that, but it gets us one step
    closer by mechanically unembedding the crdbSpan field. The diff
    highlights a lot of code that needs to be moved into methods that sit on
    `*crdbSpan`.
    
    Release note: None
    tbg committed Oct 23, 2020
    Configuration menu
    Copy the full SHA
    9c02d12 View commit details
    Browse the repository at this point in the history
  8. sql: create event log entry for alter database events

    The ALTER DATABASE actions for changing a database's owner and
    converting a database to a schema are new in v20.2. Events were
    not created for these when these new actions were added.
    
    Relates to cockroachdb#55744
    
    Release note (admin ui change): alter database owner and
    convert to schema now causes an event to be logged and
    displayed in the admin ui
    neeral committed Oct 23, 2020
    Configuration menu
    Copy the full SHA
    679e927 View commit details
    Browse the repository at this point in the history
  9. tracingpb: establish package

    Release note: None
    tbg committed Oct 23, 2020
    Configuration menu
    Copy the full SHA
    5f47e41 View commit details
    Browse the repository at this point in the history
  10. tracing: move parts of recording, baggage, tag functionality to crdbSpan

    This starts towards a picture in which operations on a `*span`
    essentially turn into an opaque invocation of something on a `crdbSpan`
    plus possibly additional logic for the net/trace and external span.
    
    The hope is that by pulling further on this thread `crdbSpan` can move
    into its own package and thus have a clean interaction with the tracer
    and top-level methods.
    
    Release note: None
    tbg committed Oct 23, 2020
    Configuration menu
    Copy the full SHA
    b251640 View commit details
    Browse the repository at this point in the history
  11. tracing: delegate to crdbSpan in ImportRemoteSpans

    Release note: None
    tbg committed Oct 23, 2020
    Configuration menu
    Copy the full SHA
    cf0a026 View commit details
    Browse the repository at this point in the history
  12. tracing: delegate to crdbSpan in LogFields

    Release note: None
    tbg committed Oct 23, 2020
    Configuration menu
    Copy the full SHA
    4f4c513 View commit details
    Browse the repository at this point in the history
  13. tracing: delegate to crdbSpan in BaggageItem

    Release note: None
    tbg committed Oct 23, 2020
    Configuration menu
    Copy the full SHA
    4e5b594 View commit details
    Browse the repository at this point in the history
  14. tracing: improve comments on recording modes

    I had to understand the semantics by reading the code, and now that
    I think I understand them, want to save the next person from having
    to do the same.
    
    Release note: None
    tbg committed Oct 23, 2020
    Configuration menu
    Copy the full SHA
    d5c6cf7 View commit details
    Browse the repository at this point in the history
  15. tracing: create *span in only one method

    We were previously maintaining very similar code in three places:
    
    1. `(*Tracer).StartSpan`
    2. `StartRootSpan`
    3. `StartChildSpan`
    
    This commit creates a method `(*Tracer).startSpanGeneric` and makes
    the above a thin wrapper around it.
    
    This allows us to simplify just one version of the code.  Merging the
    three also showed minor differences: tags didn't seem to propagate the
    same in all cases, and a bug (that I just introduced) about what
    constitutes a `noopSpanContext` was highlighted and fixed.
    
    I still have plenty of questions about this code and far from good
    confidence that I didn't introduce any bugs. I did pay some attention
    to performance regressions, but no benchmarks are introduced at this
    point. My interest is to simplify the package first, then make it
    cheap (again). We can live with a temporary performance regression,
    as long as it is limited to the case in which tracing is actually
    enabled.
    
    Release note: None
    tbg committed Oct 23, 2020
    Configuration menu
    Copy the full SHA
    d433733 View commit details
    Browse the repository at this point in the history
  16. tracing: assert that we never have >1 span reference

    Release note: None
    tbg committed Oct 23, 2020
    Configuration menu
    Copy the full SHA
    d1646dd View commit details
    Browse the repository at this point in the history
  17. tracing: explain blackhole spans

    Release note: None
    tbg committed Oct 23, 2020
    Configuration menu
    Copy the full SHA
    f55f719 View commit details
    Browse the repository at this point in the history
  18. tracing: propagate shadow tracers to children only when identical

    Release note: None
    tbg committed Oct 23, 2020
    Configuration menu
    Copy the full SHA
    cf48395 View commit details
    Browse the repository at this point in the history
  19. tracing: remove a few references to shadowTracer

    Release note: None
    tbg committed Oct 23, 2020
    Configuration menu
    Copy the full SHA
    374e745 View commit details
    Browse the repository at this point in the history
  20. tracing: properly export Span and SpanContext

    They will be used instead of `opentracing.Span{,Context}` in future
    commits.
    
    Release note: None
    tbg committed Oct 23, 2020
    Configuration menu
    Copy the full SHA
    1921231 View commit details
    Browse the repository at this point in the history
  21. tracing: don't ignore recordability in StartChildSpan

    Improve commentary about recordability while I'm there.
    
    Release note: None
    tbg committed Oct 23, 2020
    Configuration menu
    Copy the full SHA
    9f5a99e View commit details
    Browse the repository at this point in the history
  22. tracing: respect sso.Tags in StartSpan

    This got lost during the refactors and caused some test failures.
    
    Release note: None
    tbg committed Oct 23, 2020
    Configuration menu
    Copy the full SHA
    2ace2ab View commit details
    Browse the repository at this point in the history
  23. Merge cockroachdb#55831

    55831: sql - Implement SHOW REGIONS r=otan a=ajstorm
    
    Previously, SHOW REGIONS was an unimplemented stub.  This
    PR implements the SHOW REGIONS such that when issued, it
    shows all of the regions available to the cluster.
    
    Release note (sql change): Implement SHOW REGIONS so that
    customers can easily see all of the regions available in their cluster.
    
    example:
    
    SHOW REGIONS
    
        region
    ---------------
      asia-east
      europe-east
      us-central
      us-east
      us-west
    (5 rows)
    
    Co-authored-by: Adam Storm <storm@cockroachlabs.com>
    craig[bot] and ajstorm committed Oct 23, 2020
    Configuration menu
    Copy the full SHA
    fe574bf View commit details
    Browse the repository at this point in the history
  24. sql: stub ALTER TABLE ... SET LOCALITY/AFFINITY related commands

    Following the doc on proposed ideas and fleshed them all out. They
    default to displaying as REGIONAL AFFINITY for now.
    
    SHOW LOCALITY now has to be special cased, as the unreserved keyword now
    conflicts with the tree.ShowVar{} primitive.
    
    Release note (sql change): Implemented ALTER TABLE ... SET
    LOCALITY/REGIONAL AFFINITY commands that allow users to configure
    multiregion properties of given tables. These may change later.
    otan committed Oct 23, 2020
    Configuration menu
    Copy the full SHA
    432aa1a View commit details
    Browse the repository at this point in the history
  25. Merge cockroachdb#55891

    55891: sql: create event log entry for alter database events r=ajwerner a=neeral
    
    The ALTER DATABASE actions for changing a database's owner and
    converting a database to a schema are new in v20.2. Events were
    not created for these when these new actions were added.
    
    Relates to cockroachdb#55744
    
    Release note (admin ui change): alter database owner and
    convert to schema now causes an event to be logged and
    displayed in the admin ui
    
    
    
    @arulajmani and @jordanlewis could you please review this?
    
    Co-authored-by: neeral <neeral.dodhia@gmail.com>
    craig[bot] and neeral committed Oct 23, 2020
    Configuration menu
    Copy the full SHA
    62c9aa5 View commit details
    Browse the repository at this point in the history
  26. opt: add cost for table descriptor fetch during virtual scan

    This commit adds a cost equal to 10*randIOCostFactor for each virtual
    scan in order to represent the cost of fetching table descriptors.
    This cost is especially important when perfoming lookup joins, because
    the descriptors may need to be fetched on each lookup. As a result of
    this change, the optimizer is much less likely to plan a lookup join
    into a virtual table.
    
    This commit also includes some fixes to the test catalog to provide
    better support for testing virtual tables with indexes.
    
    Fixes cockroachdb#55140
    
    Release note (performance improvement): Adjusted the cost model in
    the optimizer so that the optimizer is less likely to plan a lookup
    join into a virtual table. Performing a lookup join into a virtual
    table is expensive, so this change will generally result in better
    performance for queries involving joins with virtual tables.
    rytaft committed Oct 23, 2020
    Configuration menu
    Copy the full SHA
    dcec6ee View commit details
    Browse the repository at this point in the history
  27. Merge cockroachdb#55875

    55875: {kv,}server: prune out a few cluster version helpers r=irfansharif a=irfansharif
    
    These helpers don't really add anything, they're just different ways to
    read/write to the store local cluster version key. This is an area we're
    looking to coalesce/repurpose in future PRs, so sending out this
    drive-by clean up + documentation early.
    
    Release note: None
    
    Co-authored-by: irfan sharif <irfanmahmoudsharif@gmail.com>
    craig[bot] and irfansharif committed Oct 23, 2020
    Configuration menu
    Copy the full SHA
    1ce6c19 View commit details
    Browse the repository at this point in the history
  28. vendor: Bump pebble to f1224da2297656635bddfd3a2c5dab328db2b5fc

    Changes pulled in:
    
    ```
    c592aa69e4fda33e0949b6d929746cbdfc1b44e6 tool: Add `db get` and `db set` commands
    176637822e3b326f1ebc75b6cb88dfea9a16309f internal/manifest: add B-Tree Annotator
    df33a42107001f45200076fea2cefd7468bbc4ab internal/manifest: use B-Tree for organizing level file metadata
    69eec0399f7ad53416ec6a018e18890ea9e1d74e Fixing linting issues
    d1b2f64e9ea0a3e3989e41a9501971e958920d40 sstable: optimize seeks to use next
    5912bd2e23101621798b04dfaec68fbc933bcc0a add option for SSTables to include table properties
    b53d580b4b2907b8c6d87139db7b1aced04576a8 sstable: remove NeedCompacter
    e577443beb8ff6efaa26ae0fdb537b2f5e0062a0 add get table properties
    ```
    
    Release note: None
    itsbilal committed Oct 23, 2020
    Configuration menu
    Copy the full SHA
    22fdcc3 View commit details
    Browse the repository at this point in the history
  29. roachtest: Unskip inconsistency roachtest

    As the `cockroach debug pebble db set` command now exists, unskip
    the inconsistency roachtest and update it to use that command
    instead of the now-defunct rocksdb one.
    
    Fixes cockroachdb#55840.
    
    Release note: None.
    itsbilal committed Oct 23, 2020
    Configuration menu
    Copy the full SHA
    8732d42 View commit details
    Browse the repository at this point in the history
  30. Merge cockroachdb#30624

    30624: workload/tpcc: use multiple column families to avoid contention r=nvanbenschoten a=nvanbenschoten
    
    This commit adds multiple column families to the `warehouse`,
    `district`, and `customer` tables. These column families split
    static columns up from columns that are modified by transactions.
    
    This effectively removes all contention points between the `NewOrder`
    and `Payment` transactions. The transactions will still contend with
    other instances of their same txn type, but that's less of an issue
    because they should end up being serialized early on, meaning than
    intra-txn contention should rarely lead to transaction retries (for
    instance, NewOrder serializes on district.d_next_o_id immediately).
    These transactions are run about 90% of the time, so this should be a
    performance win, especially without wait times.
    
    Release justification: testing only
    
    Co-authored-by: Nathan VanBenschoten <nvanbenschoten@gmail.com>
    craig[bot] and nvanbenschoten committed Oct 23, 2020
    Configuration menu
    Copy the full SHA
    5681f5d View commit details
    Browse the repository at this point in the history
  31. c-deps: remove googletest

    We don't need it anymore. We originally introduced it to support tests
    in libroach (cockroachdb#20594), which has since been pared down to something much
    simpler (cockroachdb#55509, just DBDumpThreadStacks).
    
    Release note: None
    irfansharif committed Oct 23, 2020
    Configuration menu
    Copy the full SHA
    4c15174 View commit details
    Browse the repository at this point in the history
  32. Merge cockroachdb#55895

    55895: vendor, roachtest: Bump Pebble to f1224da22976, unskip inconsistency roachtest r=itsbilal a=itsbilal
    
    First commit is your standard vendor bump, second commit unskips the `inconsistency` roachtest
    as Pebble now has a `db set` command.
    
    Fixes cockroachdb#55840 
    
    Pebble changes pulled in:
    
    ```
    c592aa69e4fda33e0949b6d929746cbdfc1b44e6 tool: Add `db get` and `db set` commands
    176637822e3b326f1ebc75b6cb88dfea9a16309f internal/manifest: add B-Tree Annotator
    df33a42107001f45200076fea2cefd7468bbc4ab internal/manifest: use B-Tree for organizing level file metadata
    69eec0399f7ad53416ec6a018e18890ea9e1d74e Fixing linting issues
    d1b2f64e9ea0a3e3989e41a9501971e958920d40 sstable: optimize seeks to use next
    5912bd2e23101621798b04dfaec68fbc933bcc0a add option for SSTables to include table properties
    b53d580b4b2907b8c6d87139db7b1aced04576a8 sstable: remove NeedCompacter
    e577443beb8ff6efaa26ae0fdb537b2f5e0062a0 add get table properties
    ```
    
    
    
    Co-authored-by: Bilal Akhtar <bilal@cockroachlabs.com>
    craig[bot] and itsbilal committed Oct 23, 2020
    Configuration menu
    Copy the full SHA
    f0607f6 View commit details
    Browse the repository at this point in the history
  33. Merge cockroachdb#55769

    55769: util/quotapool: add WithMinimumWait option to RateLimiter r=lunevalex a=ajwerner
    
    This is handy to ensure that the rate limiter does not become a bottleneck
    in the face of many small acquisitions.
    
    Release note: None
    
    Co-authored-by: Andrew Werner <ajwerner@cockroachlabs.com>
    craig[bot] and ajwerner committed Oct 23, 2020
    Configuration menu
    Copy the full SHA
    b27e844 View commit details
    Browse the repository at this point in the history
  34. Merge cockroachdb#53390

    53390: roachtest/indexes: support multi-region aws and tune for latency r=nvanbenschoten a=nvanbenschoten
    
    This PR updates the `indexes` suite of roachtests to support a multi-region AWS deployment alongside its multi-region GCE deployment.
    
    The commit then tunes the workload to optimize for a stable p50 and p99 latency all the way up to 50 secondary indexes. The concurrency is fairly low with low numbers of indexes, but that's not what the test is trying to stress.
    
    This roachtest with these changes is being used in a POC to demonstrate single-round trip, multi-range transactions.
    
    Co-authored-by: Nathan VanBenschoten <nvanbenschoten@gmail.com>
    craig[bot] and nvanbenschoten committed Oct 23, 2020
    Configuration menu
    Copy the full SHA
    b618906 View commit details
    Browse the repository at this point in the history
  35. Merge cockroachdb#55900

    55900: c-deps: remove googletest r=irfansharif a=irfansharif
    
    We don't need it anymore. We originally introduced it to support tests
    in libroach (cockroachdb#20594), which has since been pared down to something much
    simpler (cockroachdb#55509, just DBDumpThreadStacks).
    
    Release note: None
    
    Co-authored-by: irfan sharif <irfanmahmoudsharif@gmail.com>
    craig[bot] and irfansharif committed Oct 23, 2020
    Configuration menu
    Copy the full SHA
    da45387 View commit details
    Browse the repository at this point in the history
  36. Merge cockroachdb#54737

    54737: tracing: make `span` a union type r=knz,andreimatei a=tbg
    
    Clarify that a `span` is anywhere between zero to three subspans:
    
    - net/trace,
    - external opentracing Tracer, and
    - crdb-internal trace span,
    
    where zero subspans corresponds to what is today noopSpan (not
    implemented yet, but TODO added).
    
    Lots of threads to pull, but this is a good checkpoint since
    everything compiles and the diff is mechanical and small enough
    to actually review.
    
    Release note: None
    
    
    Co-authored-by: Tobias Grieger <tobias.b.grieger@gmail.com>
    Co-authored-by: Tobias Schottdorf <tobias.schottdorf@gmail.com>
    3 people committed Oct 23, 2020
    Configuration menu
    Copy the full SHA
    33e3abc View commit details
    Browse the repository at this point in the history
  37. keys,storage: add lock table key space, EngineKey, and LockTableKey

    This includes an EngineIterator interface that currently has no
    implementation.
    
    The next PR will rename Iterator to MVCCIterator.
    
    Release note: None
    sumeerbhola committed Oct 23, 2020
    Configuration menu
    Copy the full SHA
    0664f46 View commit details
    Browse the repository at this point in the history

Commits on Oct 24, 2020

  1. Merge cockroachdb#55878

    55878: keys,storage: add lock table key space, EngineKey, and LockTableKey r=sumeerbhola a=sumeerbhola
    
    This includes an EngineIterator interface that currently has no
    implementation.
    
    The next PR will rename Iterator to MVCCIterator.
    
    Release note: None
    
    Co-authored-by: sumeerbhola <sumeer@cockroachlabs.com>
    craig[bot] and sumeerbhola committed Oct 24, 2020
    Configuration menu
    Copy the full SHA
    7523429 View commit details
    Browse the repository at this point in the history
  2. build: update builder image to name bazel binary appropriately

    Looks like it was named `bazel-3.7.0` before.
    
    Release note: None
    irfansharif committed Oct 24, 2020
    Configuration menu
    Copy the full SHA
    3f4d8e0 View commit details
    Browse the repository at this point in the history
  3. tracing: avoid data races w.r.t noopSpan

    We were not properly turning all operations on noopSpan into noops.
    There is still a lot left to clean up here. Ultimately I want noop spans
    to be nil pointers, but that means moving the tracer off first, and this
    in turn means moving off the opentracing interfaces.
    
    Fixes cockroachdb#50032.
    
    Release note: None
    tbg committed Oct 24, 2020
    Configuration menu
    Copy the full SHA
    33f1643 View commit details
    Browse the repository at this point in the history
  4. kvfollowerreadsccl: temporarily skip TestFollowerReadsWithStaleDescri…

    …ptor
    
    Skipping this temporarily so I can unscrew tracing.
    
    Release note: None
    tbg committed Oct 24, 2020
    Configuration menu
    Copy the full SHA
    767ed50 View commit details
    Browse the repository at this point in the history
  5. Merge cockroachdb#55937

    55937: tracing: avoid data races w.r.t noopSpan r=tbg a=tbg
    
    We were not properly turning all operations on noopSpan into noops.
    There is still a lot left to clean up here. Ultimately I want noop spans
    to be nil pointers, but that means moving the tracer off first, and this
    in turn means moving off the opentracing interfaces.
    
    Touches cockroachdb#50032 
    
    Closes cockroachdb#55911,
    Closes cockroachdb#55912,
    Closes cockroachdb#55913,
    Closes cockroachdb#55914, 
    Closes cockroachdb#55917, 
    Closes cockroachdb#55918, 
    Closes cockroachdb#55919, and
    Closes cockroachdb#55936.
    
    
    
    
    
    Release note: None
    
    
    Co-authored-by: Tobias Schottdorf <tobias.schottdorf@gmail.com>
    craig[bot] and tbg committed Oct 24, 2020
    Configuration menu
    Copy the full SHA
    7fa301f View commit details
    Browse the repository at this point in the history
  6. Merge cockroachdb#55833

    55833: opt: add cost for table descriptor fetch during virtual scan r=rytaft a=rytaft
    
    This commit adds a cost equal to `10*randIOCostFactor` for each virtual
    scan in order to represent the cost of fetching table descriptors.
    This cost is especially important when perfoming lookup joins, because
    the descriptors may need to be fetched on each lookup. As a result of
    this change, the optimizer is much less likely to plan a lookup join
    into a virtual table.
    
    Fixes cockroachdb#55140
    
    Release note (performance improvement): Adjusted the cost model in
    the optimizer so that the optimizer is less likely to plan a lookup
    join into a virtual table. Performing a lookup join into a virtual
    table is expensive, so this change will generally result in better
    performance for queries involving joins with virtual tables.
    
    Co-authored-by: Rebecca Taft <becca@cockroachlabs.com>
    craig[bot] and rytaft committed Oct 24, 2020
    Configuration menu
    Copy the full SHA
    8aceac3 View commit details
    Browse the repository at this point in the history

Commits on Oct 25, 2020

  1. cli: support \connect DATABASE and \c DATABASE

    Add \connect DATABASE and \c DATABASE for aliasing `USE DATABASE`
    
    Fixes cockroachdb#55613.
    
    Release note (cli change): support \connect DATABASE and \c DATABASE.
    adzimzf committed Oct 25, 2020
    Configuration menu
    Copy the full SHA
    ebffc62 View commit details
    Browse the repository at this point in the history
  2. Merge cockroachdb#55511

    55511: importccl: moved bundle import logic from planning to execution phase r=adityamaru,miretskiy a=mokaixu
    
    Previously, the logic for parsing schemas of Bundle forms such as postgresql dumps and mysql
    dumps was located in the planning phase for the import statement.
    
    This was inadequate because for large bundle imports where schema parsing takes
    up to an hour, there was no signal to the user that something was taking place.
    
    To address this, the logic for schema parsing for bundle formats was moved from the
    planning phase to the job execution phase. In the job execution phase, a RunningStatus
    was added to indicate to the user that the schema is being parsed.
    
    Release note: None
    
    Resolves: cockroachdb#48598 
    
    Co-authored-by: Monica Xu <monicax@cockroachlabs.com>
    craig[bot] and mokaixu committed Oct 25, 2020
    Configuration menu
    Copy the full SHA
    9fd5351 View commit details
    Browse the repository at this point in the history
  3. Merge cockroachdb#55934

    55934: cli: support \connect DATABASE and \c DATABASE r=knz a=adzimzf
    
    Add \connect DATABASE and \c DATABASE for aliasing `USE DATABASE`
    
    Fixes cockroachdb#55613.
    
    Release note (cli change): support \connect DATABASE and \c DATABASE.
    
    Co-authored-by: Azdim Zul Fahmi <adzimzulfahmy@gmail.com>
    craig[bot] and adzimzf committed Oct 25, 2020
    Configuration menu
    Copy the full SHA
    6184870 View commit details
    Browse the repository at this point in the history

Commits on Oct 26, 2020

  1. importccl: fix INSERT with missing columns with IMPORT PGDUMP

    We've introduced the functionality in v20.2 to INSERT PGDUMP with
    less columns than there are total. As a result, we've introduced a bug
    where missing a column in the INSERT would result in a panic.
    
    Release note (bug fix): Fixed a bug where a IMPORTING a PGDUMP with
    INSERTs not targeting all columns in the database would panic.
    otan committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    d304a02 View commit details
    Browse the repository at this point in the history
  2. Merge cockroachdb#55860

    55860: logictest: enhance crdb_internal_tenant logic test r=tbg a=asubiotto
    
    This commit copies the full crdb_internal test to crdb_internal_tenant, and
    rewrites it to succeed with this configuration in order to increase
    crdb_internal tenant test coverage.
    
    Release note: None (testing change)
    
    Co-authored-by: Alfonso Subiotto Marques <alfonso@cockroachlabs.com>
    craig[bot] and asubiotto committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    ac5825b View commit details
    Browse the repository at this point in the history
  3. builtins: Implement ST_UnaryUnion

    Implement the geometry based builtin `ST_UnaryUnion`,
    works similar to `ST_Union` for a geometry collection.
    Release note (sql change): Implement the geo builtin `ST_UnaryUnion`
    mknycha committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    c0b15d5 View commit details
    Browse the repository at this point in the history
  4. ANALYZE/ANALYSE diagram

    Release justification: Non-production code changes
    
    Release note: None
    ericharmeling committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    fb2f589 View commit details
    Browse the repository at this point in the history
  5. UPDATE FROM syntax added

    Release justification: Non-production code changes
    
    Release note: None
    ericharmeling committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    44aa7fd View commit details
    Browse the repository at this point in the history
  6. Added CREATE DATABASE ... CONNECTION LIMIT to diagram

    Release justification: Non-production code changes
    
    Release note: None
    ericharmeling committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    404f235 View commit details
    Browse the repository at this point in the history
  7. NOT DEFERRABLE/DEFERRABLE syntax

    Release justification: Non-production code changes
    
    Release note: None
    ericharmeling committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    0d8f772 View commit details
    Browse the repository at this point in the history
  8. Updated col_qualification diagram with GENERATED ALWAYS no-op

    Added new for_locking diagram
    
    Release justification: Non-production code changes
    
    Release note: None
    ericharmeling committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    1dc85ee View commit details
    Browse the repository at this point in the history
  9. Added WITH storage parameters to table and index diagrams

    Added ON COMMIT PRESERVE ROWS to table diagrams
    
    Removed "no doc" comments from sql.y on no-ops
    
    Release justification: Non-production code changes
    
    Release note: None
    ericharmeling committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    a2d35a5 View commit details
    Browse the repository at this point in the history
  10. authors: add Alan Acosta to AUTHORS

    Release note: None
    alan-mas committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    5ae5689 View commit details
    Browse the repository at this point in the history
  11. Merge cockroachdb#55832

    55832: Misc SQL diagram updates r=ericharmeling a=ericharmeling
    
    Release justification: Non-production code changes
    
    Release note: None
    
    See commits for list of changes.
    
    Co-authored-by: Eric Harmeling <eric.harmeling@cockroachlabs.com>
    craig[bot] and ericharmeling committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    6cdc3b3 View commit details
    Browse the repository at this point in the history
  12. cli: add import pgdump/mysqldump CLI command

    This change introduces a new CLI command to import
    locally saved PGDUMP or MYSQLDUMP files into a running
    cockroach cluster.
    
    The underlying logic relies on user scoped userfile
    storage to upload the local dump file to, and subsequently
    import data from. Most of the heavy lifting was already
    completed during the development of the userfile storage.
    
    We can only support bundle formats which have the table
    schemas to be imported, baked into the dump files. The newly
    added CLI commands support the same options as IMPORT PGDUMP
    and IMPORT MYSQLDUMP from the SQL shell do. These options
    are to be passed in as CLI flags.
    
    Following are the CLI examples:
    `./cockroach import db <format> <source>`
    `./cockroach import table <tablename> <format> <source>`
    
    Release note (cli change): Adds an import CLI command which
    allows users to upload and import local dump files into a
    running cockroach cluster. We currently support PGDUMP and
    MYSQLDUMP formats.
    adityamaru committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    1a2a301 View commit details
    Browse the repository at this point in the history
  13. Merge cockroachdb#55910

    55910: build: update builder image to name bazel binary appropriately r=irfansharif a=irfansharif
    
    Looks like it was named `bazel-3.7.0` before.
    
    Release note: None
    
    Co-authored-by: irfan sharif <irfanmahmoudsharif@gmail.com>
    craig[bot] and irfansharif committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    55b4e20 View commit details
    Browse the repository at this point in the history
  14. backupccl: do not re-create schema change jobs in cluster restore

    This commit fixes a bug where schema change jobs that were in progress
    during a cluster backup would be re-created twice during a cluster
    restore.
    
    Release note (bug fix): Previously if a cluster backup that was taken
    during a schema change, a cluster restore of that backup would create
    duplicates of the ongoing schema changes.
    pbardea committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    3c06321 View commit details
    Browse the repository at this point in the history
  15. Merge cockroachdb#55894

    55894: builtins: Implement ST_UnaryUnion r=otan a=mknycha
    
    `ST_UnaryUnion` works similar to `ST_Union` but is able to dissolve and then union Multipolygon or Geometry collection components.
    Release note (sql change): Implemented the geometry based builtin `ST_UnaryUnion`
    
    Resolves: cockroachdb#49062
    
    Co-authored-by: Marcin Knychała <knychala.marcin@gmail.com>
    craig[bot] and mknycha committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    dd92e33 View commit details
    Browse the repository at this point in the history
  16. sqlliveness/sqlstorage: fix flakey test

    This commit fixes a flakey test introduced in cockroachdb#55524. The flake is that
    we unconditionally start the slstorage subsystem before we sometimes
    override some of its settings. This change makes each subtest start
    the storage individually.
    
    Fixes cockroachdb#55964.
    
    Release note: None
    ajwerner committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    3926cf1 View commit details
    Browse the repository at this point in the history
  17. Merge cockroachdb#54896 cockroachdb#55827

    54896: cli: add import pgdump/mysqldump CLI command r=miretskiy,knz a=adityamaru
    
    This change introduces a new CLI command to import
    locally saved PGDUMP or MYSQLDUMP files into a running
    cockroach cluster.
    
    The underlying logic relies on user scoped userfile
    storage to upload the local dump file to, and subsequently
    import data from. Most of the heavy lifting was already
    completed during the development of the userfile storage.
    
    We can only support bundle formats that have the table
    schemas to be imported, baked into the dump files. The newly
    added CLI commands support the same options as IMPORT PGDUMP
    and IMPORT MYSQLDUMP from the SQL shell do. These options
    are to be passed in as CLI flags.
    
    Following are the CLI examples:
    `./cockroach import db <format> <source>`
    `./cockroach import table <tablename> <format> <source>`
    
    Release note (cli change): Adds an import CLI command which
    allows users to upload and import local dump files into a
    running cockroach cluster. We currently support PGDUMP and
    MYSQLDUMP formats.
    
    55827: sql: stub ALTER TABLE ... SET LOCALITY/AFFINITY related commands r=ajstorm a=otan
    
    Following the doc on proposed ideas and fleshed them all out. They
    default to displaying REGIONAL AFFINITY for now.
    
    Release note (sql change): Implemented ALTER TABLE ... SET
    LOCALITY/REGIONAL AFFINITY commands that allow users to configure
    multiregion properties of given tables. These may change later.
    
    Co-authored-by: Aditya Maru <adityamaru@gmail.com>
    Co-authored-by: Oliver Tan <otan@cockroachlabs.com>
    3 people committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    b0b53c7 View commit details
    Browse the repository at this point in the history
  18. roachprod: Configure Azure disks.

    Add ability to specify the size of the attached disks for Azure.
    Use read only caching for Azure premium disks.
    
    Release Notes: None
    Yevgeniy Miretskiy committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    34421c8 View commit details
    Browse the repository at this point in the history
  19. opt: consolidate index formatting in expression trees

    The table name is now always printed when describing an expression that
    operates on an index. It is fully qualified if
    `ExprFmtHideQualifications` is not set. If the query aliases the table,
    `[as=alias]` is printed.
    
    Release note (sql change): All expressions in EXPLAIN output that
    operate on indexes now show the table name the index is declared on,
    rather than just an alias. If the query aliases the table, the alias is
    also shown. For example, a scan on table `foo` that is aliased as `f`
    was previously displayed as `scan f`. It is now displayed as
    `scan foo [as=f]`.
    mgartner committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    ae73a36 View commit details
    Browse the repository at this point in the history
  20. server: remove extra inline comment

    Previously, there was an extra comment left over from an earlier iteration of
    55350. This comment was no longer accurate and was removed.
    
    Release note: None.
    TheSamHuang committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    f0e58dd View commit details
    Browse the repository at this point in the history
  21. roachtest: use IMPORT for all TPC-C tests

    Fixes cockroachdb#55541.
    Fixes cockroachdb#55580.
    
    In cockroachdb#54880 and cockroachdb#55050, we switched to using IMPORT for most TPC-C tests,
    in favor of BACKUP, which requires fixtures to be regenerated whenever
    we changed the workload. In this PR, we switch over the remaining uses
    of `fixtures load tpcc` to `fixtures import tpcc` to avoid compatibility
    issues on older release branches.
    nvanbenschoten committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    71ea818 View commit details
    Browse the repository at this point in the history
  22. storage: rename Iterator to MVCCIterator

    Additionally,
    - remove MVCCIterator, implemented by RocksDB
    - rename SimpleIterator to SimpleMVCCIterator
    - rename spanset.Iterator to MVCCIterator
    
    Release note: None
    sumeerbhola committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    4fd71e4 View commit details
    Browse the repository at this point in the history
  23. Merge cockroachdb#55977

    55977: sqlliveness/sqlstorage: fix flakey test r=spaskob a=ajwerner
    
    This commit fixes a flakey test introduced in cockroachdb#55524. The flake is that
    we unconditionally start the slstorage subsystem before we sometimes
    override some of its settings. This change makes each subtest start
    the storage individually.
    
    Fixes cockroachdb#55964.
    
    Release note: None
    
    Co-authored-by: Andrew Werner <ajwerner@cockroachlabs.com>
    craig[bot] and ajwerner committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    adee6bc View commit details
    Browse the repository at this point in the history
  24. Revert "tpcc: use multiple column families to avoid contention"

    This reverts commit 6b11918.
    
    Fixes cockroachdb#55954.
    Fixes cockroachdb#55953.
    Fixes cockroachdb#55952.
    Fixes cockroachdb#55951.
    Fixes cockroachdb#55949.
    
    In cockroachdb#30624, we split various column families up in the TPC-C workload. This
    had the unintended consequence of breaking CDC roachtests, because CDC
    does not support multiple column families per row:
    ```
    CHANGEFEEDs are currently supported on tables with exactly 1 column family: warehouse has 2
    ```
    
    This PR reverts that commit. I intend to come back to this and introduce
    a `--families` flag to TPC-C (like we have to YCSB) that can be used to
    selectively toggle column families on or off. However, I'll do this
    after cockroachdb#51897 lands, because it's going to be more effort than it's worth
    to conditionally set this flag based on whether the version of workload
    used in the test supports it or not.
    nvanbenschoten committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    04cca34 View commit details
    Browse the repository at this point in the history
  25. builtins: fix incorrect sqrdiff evaluation due to reuse of the result…

    …s from previous iterations when used as a window function
    
    fixes cockroachdb#55944
    
    Release note (bug fix): CockroachDB previously could incorrectly evaluate sqrdiff function when used as a window function in some cases, and now it is fixed.
    mneverov committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    4bf1804 View commit details
    Browse the repository at this point in the history
  26. Merge cockroachdb#55957 cockroachdb#55975 cockroachdb#55979

    55957: builtins: fix incorrect sqrdiff evaluation due to reuse of the results from previous iterations when used as a window function r=yuzefovich a=mneverov
    
    builtins: fix incorrect sqrdiff evaluation due to reuse of the results from previous iterations when used as a window function
    
    fixes cockroachdb#55944
    
    Release note (bug fix): CockroachDB previously could incorrectly evaluate sqrdiff function when used as a window function in some cases, and now it is fixed.
    
    55975: roachprod: Configure Azure disks. r=miretskiy a=miretskiy
    
    Add ability to specify the size of the attached disks for Azure.
    Use read only caching for Azure premium disks.
    
    Release Notes: None
    
    55979: server: remove extra inline comment r=knz a=TheSamHuang
    
    Previously, there was an extra comment left over from an earlier iteration of
    cockroachdb#55350. This comment was no longer accurate and was removed.
    
    Release note: None.
    
    Co-authored-by: Max Neverov <neverov.max@gmail.com>
    Co-authored-by: Yevgeniy Miretskiy <yevgeniy@cockroachlabs.com>
    Co-authored-by: Sam Huang <samh@cockroachlabs.com>
    4 people committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    4a58b36 View commit details
    Browse the repository at this point in the history
  27. kvserver: remove the replica.mu.draining field

    It was only used in one rando place. Generally everybody looks at the
    store's draing status.
    
    Release note: None
    andreimatei committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    af594d8 View commit details
    Browse the repository at this point in the history
  28. Merge cockroachdb#55871 cockroachdb#55972

    55871: kvserver: remove the replica.mu.draining field r=andreimatei a=andreimatei
    
    It was only used in one rando place. Generally everybody looks at the
    store's draing status.
    
    Release note: None
    
    55972: storage: rename Iterator to MVCCIterator r=sumeerbhola a=sumeerbhola
    
    
    Also remove MVCCIterator, which was implemented for RocksDB.
    
    Release note: None
    
    Co-authored-by: Andrei Matei <andrei@cockroachlabs.com>
    Co-authored-by: sumeerbhola <sumeer@cockroachlabs.com>
    3 people committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    753ab8b View commit details
    Browse the repository at this point in the history
  29. backupccl: expand mid schema change test to include cluster restore

    This commit expands the mid schema change restore tests to test both
    table and cluster restore of backups that had ongoing schema changes.
    
    This commit also adds test cases for when a schema change has not
    performed the backfill. This is in addition to the existing cases where
    the backfill has already been performed.
    
    Release note: None
    pbardea committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    900cebb View commit details
    Browse the repository at this point in the history
  30. Merge cockroachdb#55921

    55921: importccl: fix INSERT with missing columns with IMPORT PGDUMP r=dt a=otan
    
    We've introduced the functionality in v20.2 to INSERT PGDUMP with
    less columns than there are total. As a result, we've introduced a bug
    where missing a column in the INSERT would result in a panic.
    
    Release note (bug fix): Fixed a bug where a IMPORTING a PGDUMP with
    INSERTs not targeting all columns in the database would panic.
    
    
    
    Co-authored-by: Oliver Tan <otan@cockroachlabs.com>
    craig[bot] and otan committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    889deed View commit details
    Browse the repository at this point in the history
  31. backupccl: avoid div-by-zero crash on failed node count

    We've seen a report of a node that crashed due to a divide-by-zero
    hit during metrics collection, specifically when computing the
    throughput-per-node by dividing the backup size by node count.
    
    Since this is only now used for that metric, make a failure to count
    nodes a warning only for release builds (and fallback to 1), and make
    any error while counting, or not counting to more than 0, a returned
    error in non-release builds.
    
    Release note (bug fix): avoid crashing when BACKUP is unable to count the total nodes in the cluster.
    dt committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    63e79f3 View commit details
    Browse the repository at this point in the history
  32. kvsever: introduce some testing knobs for node liveness

    Release note: None
    andreimatei committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    be25a97 View commit details
    Browse the repository at this point in the history
  33. kvserver: delete TestRefreshPendingCommands

    This test either has completely rotted, or has always been confused. It
    tries to verify that different mechanisms trigger raft reproposals, but
    it doesn't seem to actually depend on reproposals. The test says that an
    increment depend on the reproposal of a previous lease request, but
    there's no such lease request. Also, technically reproposals of lease
    requests stopped being a thing a while ago. It also talks about Raft
    leadership changing, but that's not explicit in the test.
    
    The test fails with the next commit that changes how draining replicas
    handle lease requests. It's unclear to me what's salvageable from the
    test.
    
    Release note: None
    andreimatei committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    480c9f0 View commit details
    Browse the repository at this point in the history
  34. kvserver: don't always refuse to take leases when draining

    Before this patch, a draining node would not take any new leases once
    it's draining. This is a problem in case all replicas of a range are
    draining at the same time (e.g. when draining a single-node cluster, or
    when draining multiple nodes at the same time perhaps by mistake) -
    nobody wants the lease. Particularly because the liveness range is
    expiration-based (and thus permanently in need of new leases to be
    granted), this quickly results in nodes failing their liveness.
    It also becomes more of a problem with cockroachdb#55148, where we start refusing
    to take the lease on replicas that are not the leader - so if the leader
    is draining, we deadlock.
    
    This patch makes an exception for leaders, which now no longer refuse
    the lease even when they're draining. The reasonsing being that it's too
    easy to deadlock otherwise.
    
    Release note: None
    andreimatei committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    acc1ad1 View commit details
    Browse the repository at this point in the history
  35. Merge cockroachdb#55983

    55983: Revert "tpcc: use multiple column families to avoid contention" r=nvanbenschoten a=nvanbenschoten
    
    This reverts commit 6b11918.
    
    Fixes cockroachdb#55954.
    Fixes cockroachdb#55953.
    Fixes cockroachdb#55952.
    Fixes cockroachdb#55951.
    Fixes cockroachdb#55949.
    
    In cockroachdb#30624, we split various column families up in the TPC-C workload. This
    had the unintended consequence of breaking CDC roachtests, because CDC
    does not support multiple column families per row:
    ```
    CHANGEFEEDs are currently supported on tables with exactly 1 column family: warehouse has 2
    ```
    
    This PR reverts that commit. I intend to come back to this and introduce
    a `--families` flag to TPC-C (like we have to YCSB) that can be used to
    selectively toggle column families on or off. However, I'll do this
    after cockroachdb#51897 lands, because it's going to be more effort than it's worth
    to conditionally set this flag based on whether the version of workload
    used in the test supports it or not.
    
    Co-authored-by: Nathan VanBenschoten <nvanbenschoten@gmail.com>
    craig[bot] and nvanbenschoten committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    a2db135 View commit details
    Browse the repository at this point in the history
  36. opt: split disjunctions with unconstrained partial index scans

    Previously, the optimizer would not explore the SplitDisjunction rule
    when one side of the disjunction could be "constrained" with an
    unconstrained partial index scan. A fast check prevented
    SplitDisjunction from matching when columns on each side of a
    disjunction were not key columns of an index.
    
    This commit updates the fast check so that the SplitDisjunction rule
    matches if columns on each side of a disjunction are key columns of an
    index or if they are referenced in partial index predicates.
    
    Release note (performance improvement): The optimizer now attempts to
    split a query with a disjunctive filter (OR expression) into a UNION of
    index scans, where one or both of the scans is an unconstrained partial
    index scan. As a result, more efficient query plans may be generated for
    queries with disjunctive filters that operate on tables with partial
    indexes.
    mgartner committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    1c18572 View commit details
    Browse the repository at this point in the history
  37. Merge cockroachdb#55973

    55973: backupccl: do not re-create schema change jobs in cluster restore r=pbardea a=pbardea
    
    This commit fixes a bug where schema change jobs that were in progress
    during a cluster backup would be re-created twice during a cluster
    restore.
    
    Release note (bug fix): Previously if a cluster backup that was taken
    during a schema change, a cluster restore of that backup would create
    duplicates of the ongoing schema changes.
    
    Co-authored-by: Paul Bardea <pbardea@gmail.com>
    craig[bot] and pbardea committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    f79ebfc View commit details
    Browse the repository at this point in the history
  38. importccl: lift computed column check to input converter

    The current implementation of checking for validating the number of rows
    for computed columns for in non-IMPORT INTO backups is inefficient. This
    commit moves the check from being performed on every row to only being
    performed once per import.
    
    Release note: None
    pbardea committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    124209e View commit details
    Browse the repository at this point in the history
  39. Merge cockroachdb#55980

    55980: authors: add Alan Acosta to AUTHORS r=jlinder a=alan-mas
    
    Release note: None
    
    Co-authored-by: Alanmas <acostas.alan@gmail.com>
    craig[bot] and alan-mas committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    e787bce View commit details
    Browse the repository at this point in the history
  40. sql: fix object lookup for ALTER TABLE ... RENAME TO ...

    Previously, ALTER TABLE schema.table RENAME TO schema.existing_table
    would fail because the statement would look up the destination table in
    the public schema only. This commit fixes this behavior by using
    the correct destination schema.
    
    Fixes cockroachdb#55985
    
    Release note: None
    jayshrivastava committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    261f3a6 View commit details
    Browse the repository at this point in the history
  41. importccl: compute expected number of data columns only once

    This commit moves the computation of finding the expected number of data
    columns to the creation of the input converter, rather than
    re-calculating it on every row. The memory footprint of loading all of
    the visible columns for every row was noticeable.
    
    Release note (performance improvement): CSV imports should now be
    slightly faster.
    pbardea committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    6a9eaf3 View commit details
    Browse the repository at this point in the history
  42. c-deps: pick up jemalloc changes needed for bazel

    We'll need these changes in future commits.
    
      jemalloc: fix JEMALLOC_MUTEX_INIT_CB to only be set if OSS_PINLOCK is false
    
    Release note: None
    irfansharif committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    e5438d9 View commit details
    Browse the repository at this point in the history
  43. vendor: refer to bazel-ified go-libedit

    Specifically pick up Oliver's changes in
    otan-cockroach/go-libedit@gazelle_it_2:
    
        go mod edit -replace=github.com/knz/go-libedit=github.com/otan-cockroach/go-libedit@gazelle_it_2
        make vendor_rebuild
    
    Release note: None
    irfansharif committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    b91f199 View commit details
    Browse the repository at this point in the history
  44. colexec: specify the superset of all go dependencies in templates

    The changes to the _tmpl.go files are needed for bazel to compile
    auto-generated code in its sandbox. We currently rely on goimports to
    fill in the dependencies in the eg.go files, as needed, but that does
    not do the right thing in bazel.
    
    This diff may ultimately turn out to be unnecessary, but was quicker to
    do it this way than to figure out why goimports in the bazel sandbox
    doesn't fill in dependencies appropriately. Hopefully the diff is
    uncontroversial.
    
    Release note: None
    irfansharif committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    52c5f51 View commit details
    Browse the repository at this point in the history
  45. parser: include errors dep in grammar file

    We need this diff to get bazel to compile auto-generated sql.go in its
    sandbox. We currently rely on goimports to fill in the dependency as
    needed, but bazel is unable to resolve it as expected.
    
    This is in the same spirit as the last commit, this diff may ultimately
    turn out to be unnecessary, but was quicker to do it this way than to
    figure out why goimports in the bazel sandbox doesn't fill in
    dependencies appropriately.
    
    Release note: None
    irfansharif committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    a67b815 View commit details
    Browse the repository at this point in the history
  46. *: bazel-ify cockroachdb

    This commit introduces a new build system to cockroachdb: Bazel.
    The hope here is to eventually replace our current Makefile. It sets the
    foundation for introducing Bazel in our CI systems for parallelized
    builds/test runs, artifact caching, remote builds, and many other such
    profits (literally, it could reduce infra spend).
    
    We originally prototyped a pseudo bazel-ified cockroachdb in cockroachdb#52824,
    which resulted in a week long effort (with otan@, jamesl@, and myself) to
    wrap it up in earnest in cockroachdb#55258. This is the polished version of the
    resulting work, the write up for which can be found at
    go.crdb.dev/bazel-hackweek.
    
    ---
    
    Most of the BUILD files here were auto-generated through Gazelle (see
    doc). Some of these auto-generated files required further manual
    tweaking to get just right (see doc). These were mostly around the packages that
    link into c-dependencies, but also the few packages that rely on
    auto-generated code (again, see doc). These specific files are the ones
    intended for review (they're also the ones responsible for
    auto-generation), among a few others. I've listed them out here:
    
    ```
      modified:   .gitattributes
      modified:   Makefile
      new file:   BUILD.bazel
      new file:   DEPS.bzl
      new file:   WORKSPACE
      new file:   pkg/ccl/gssapiccl/BUILD.bazel
      new file:   pkg/cli/BUILD.bazel
      new file:   pkg/cmd/cockroach-oss/BUILD.bazel
      new file:   pkg/cmd/cockroach-short/BUILD.bazel
      new file:   pkg/cmd/cockroach/BUILD.bazel
      new file:   pkg/col/coldata/BUILD.bazel
      new file:   pkg/geo/geoproj/BUILD.bazel
      new file:   pkg/geo/geos/BUILD.bazel
      new file:   pkg/sql/colconv/BUILD.bazel
      new file:   pkg/sql/colexec/BUILD.bazel
      new file:   pkg/sql/colexec/COLEXEC.bzl
      new file:   pkg/sql/colexec/colbuilder/BUILD.bazel
      new file:   pkg/sql/colexec/colexec.go
      new file:   pkg/sql/colexec/colexecagg/BUILD.bazel
      new file:   pkg/sql/colflow/BUILD.bazel
      new file:   pkg/sql/opt/BUILD.bazel
      new file:   pkg/sql/opt/exec/BUILD.bazel
      new file:   pkg/sql/opt/exec/execbuilder/BUILD.bazel
      new file:   pkg/sql/opt/exec/explain/BUILD.bazel
      new file:   pkg/sql/opt/memo/BUILD.bazel
      new file:   pkg/sql/opt/norm/BUILD.bazel
      new file:   pkg/sql/opt/optgen/lang/BUILD.bazel
      new file:   pkg/sql/opt/xform/BUILD.bazel
      new file:   pkg/sql/parser/BUILD.bazel
      new file:   pkg/sql/parser/sql-gen.sh
      new file:   pkg/storage/BUILD.bazel
      modified:   vendor
    ```
    
    The changes to all the _tmpl.go files were needed to include necessary
    import analysis/compilation for bazel when generating the .eg.go files
    (also summarized in doc up above), and should be uncontroversial.
    
    I think it's easiest to pull the branch down locally and to click around
    to see what works, and what doesn't. I would start at the top-level
    BUILD.bazel and WORSPACE file. I've added comments to explain what most
    of added machinery does.
    
    Release note: None
    irfansharif committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    1cd90b0 View commit details
    Browse the repository at this point in the history
  47. Merge cockroachdb#55687

    55687: *: bazel-ify cockroachdb r=irfansharif a=irfansharif
    
    This commit introduces a new build system to cockroachdb: Bazel.
    The hope here is to eventually replace our current Makefile. It sets the
    foundation for introducing Bazel in our CI systems for parallelized
    builds/test runs, artifact caching, remote builds, and many other such
    profits (literally, it could reduce infra spend).
    
    We originally prototyped a pseudo bazel-ified cockroachdb in cockroachdb#52824,
    which resulted in a week long effort (with otan@, jamesl@, and myself) to
    wrap it up in earnest in cockroachdb#55258. This is the polished version of the
    resulting work, the write up for which can be found at
    http://go.crdb.dev/bazel-hackweek.
    
    ---
    
    Most of the BUILD files here were auto-generated through Gazelle (see
    doc). Some of these auto-generated files required further manual
    tweaking to get just right (see doc). These were mostly around the packages that
    link into c-dependencies, but also the few packages that rely on
    auto-generated code (again, see doc). These specific files are the ones
    intended for review (they're also the ones responsible for
    auto-generation), among a few others. I've listed them out here:
    
    ```
    	new file:   .bazelrc
    	modified:   .gitattributes
    	modified:   .gitignore
    	new file:   BUILD.bazel
    	new file:   DEPS.bzl
    	modified:   Makefile
    	new file:   WORKSPACE
    	new file:   pkg/ccl/gssapiccl/BUILD.bazel
    	new file:   pkg/ccl/storageccl/engineccl/BUILD.bazel
    	new file:   pkg/cli/BUILD.bazel
    	new file:   pkg/cmd/cockroach-oss/BUILD.bazel
    	new file:   pkg/cmd/cockroach-short/BUILD.bazel
    	new file:   pkg/cmd/cockroach/BUILD.bazel
    	new file:   pkg/col/coldata/BUILD.bazel
    	new file:   pkg/geo/geoproj/BUILD.bazel
    	modified:   pkg/geo/geoproj/geoproj.go
    	modified:   pkg/geo/geoproj/proj.cc
    	new file:   pkg/geo/geos/BUILD.bazel
    	new file:   pkg/sql/colconv/BUILD.bazel
    	new file:   pkg/sql/colexec/BUILD.bazel
    	new file:   pkg/sql/colexec/COLEXEC.bzl
    	modified:   pkg/sql/colexec/and_or_projection_tmpl.go
    	modified:   pkg/sql/colexec/any_not_null_agg_tmpl.go
    	modified:   pkg/sql/colexec/avg_agg_tmpl.go
    	modified:   pkg/sql/colexec/bool_and_or_agg_tmpl.go
    	modified:   pkg/sql/colexec/cast_tmpl.go
    	new file:   pkg/sql/colexec/colbuilder/BUILD.bazel
    	new file:   pkg/sql/colexec/colexec.go
    	modified:   pkg/sql/colexec/concat_agg_tmpl.go
    	modified:   pkg/sql/colexec/const_tmpl.go
    	modified:   pkg/sql/colexec/count_agg_tmpl.go
    	modified:   pkg/sql/colexec/default_agg_tmpl.go
    	modified:   pkg/sql/colexec/default_cmp_expr_tmpl.go
    	modified:   pkg/sql/colexec/default_cmp_proj_ops_tmpl.go
    	modified:   pkg/sql/colexec/default_cmp_sel_ops_tmpl.go
    	modified:   pkg/sql/colexec/distinct_tmpl.go
    	modified:   pkg/sql/colexec/hash_aggregator_tmpl.go
    	modified:   pkg/sql/colexec/hash_utils_tmpl.go
    	modified:   pkg/sql/colexec/hashjoiner_tmpl.go
    	modified:   pkg/sql/colexec/hashtable_tmpl.go
    	modified:   pkg/sql/colexec/is_null_ops_tmpl.go
    	modified:   pkg/sql/colexec/mergejoinbase_tmpl.go
    	modified:   pkg/sql/colexec/mergejoiner_tmpl.go
    	modified:   pkg/sql/colexec/min_max_agg_tmpl.go
    	modified:   pkg/sql/colexec/ordered_synchronizer_tmpl.go
    	modified:   pkg/sql/colexec/proj_const_ops_tmpl.go
    	modified:   pkg/sql/colexec/proj_non_const_ops_tmpl.go
    	modified:   pkg/sql/colexec/quicksort_tmpl.go
    	modified:   pkg/sql/colexec/rank_tmpl.go
    	modified:   pkg/sql/colexec/relative_rank_tmpl.go
    	modified:   pkg/sql/colexec/row_number_tmpl.go
    	modified:   pkg/sql/colexec/rowstovec_tmpl.go
    	modified:   pkg/sql/colexec/select_in_tmpl.go
    	modified:   pkg/sql/colexec/selection_ops_tmpl.go
    	modified:   pkg/sql/colexec/sort_tmpl.go
    	modified:   pkg/sql/colexec/substring_tmpl.go
    	modified:   pkg/sql/colexec/sum_agg_tmpl.go
    	modified:   pkg/sql/colexec/utils_tmpl.go
    	modified:   pkg/sql/colexec/values_differ_tmpl.go
    	modified:   pkg/sql/colexec/vec_comparators_tmpl.go
    	modified:   pkg/sql/colexec/window_peer_grouper_tmpl.go
    	new file:   pkg/sql/colflow/BUILD.bazel
    	new file:   pkg/sql/opt/BUILD.bazel
    	new file:   pkg/sql/opt/exec/BUILD.bazel
    	new file:   pkg/sql/opt/exec/execbuilder/BUILD.bazel
    	new file:   pkg/sql/opt/exec/explain/BUILD.bazel
    	new file:   pkg/sql/opt/memo/BUILD.bazel
    	new file:   pkg/sql/opt/norm/BUILD.bazel
    	new file:   pkg/sql/opt/optgen/lang/BUILD.bazel
    	new file:   pkg/sql/opt/xform/BUILD.bazel
    	new file:   pkg/sql/parser/BUILD.bazel
    	new file:   pkg/sql/parser/sql-gen.sh
    	modified:   pkg/sql/parser/sql.y
    	new file:   pkg/storage/BUILD.bazel
    	modified:   vendor
    ```
    
    The changes to all the _tmpl.go files were needed to include necessary
    import analysis/compilation for bazel when generating the .eg.go files
    (also summarized in doc up above), and should be uncontroversial.
    
    I think it's easiest to pull the branch down locally and to click around
    to see what works, and what doesn't. I would start at the top-level
    BUILD.bazel and WORSPACE file. I've added comments to explain what most
    of added machinery does.
    
    Release note: None
    
    
    Co-authored-by: irfan sharif <irfanmahmoudsharif@gmail.com>
    craig[bot] and irfansharif committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    e1709ec View commit details
    Browse the repository at this point in the history
  48. Merge cockroachdb#55915

    55915: opt: split disjunctions with unconstrained partial index scans r=rytaft a=mgartner
    
    Previously, the optimizer would not explore the SplitDisjunction rule
    when one side of the disjunction could be "constrained" with an
    unconstrained partial index scan. A fast check prevented
    SplitDisjunction from matching when columns on each side of a
    disjunction were not key columns of an index.
    
    This commit updates the fast check so that the SplitDisjunction rule
    matches if columns on each side of a disjunction are key columns of an
    index or if they are referenced in partial index predicates.
    
    Release note (performance improvement): The optimizer now attempts to
    split a query with a disjunctive filter (OR expression) into a UNION of
    index scans, where one or both of the scans is an unconstrained partial
    index scan. As a result, more efficient query plans may be generated for
    queries with disjunctive filters that operate on tables with partial
    indexes.
    
    Co-authored-by: Marcus Gartner <marcus@cockroachlabs.com>
    craig[bot] and mgartner committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    fbaa145 View commit details
    Browse the repository at this point in the history

Commits on Oct 27, 2020

  1. logictest: deflake a test

    We've recently merged a test that in very rare circumstances could
    produce a float result that differs from the expected one by 1 in the
    15th significant digit (after rounding). I believe that could occur,
    e.g. when the 15th and 16th significant digits were `35`, and we matched
    the spec of supporting 15 significant digits for floats, yet the
    rounding makes us return an unexpected result. This commit rounds to the
    precision of 1 digit less which should make the test non-flaky.
    
    Release note: None
    yuzefovich committed Oct 27, 2020
    Configuration menu
    Copy the full SHA
    013da02 View commit details
    Browse the repository at this point in the history
  2. storage: rename functions in the Reader interface

    - Get to MVCCGet
    - GetProto to MVCCGetProto
    - Iterate to MVCCIterate
    - ExportToSst to ExportMVCCToSst
    
    Also added MVCCIterKind.
    
    Release note: None
    sumeerbhola committed Oct 27, 2020
    Configuration menu
    Copy the full SHA
    2167922 View commit details
    Browse the repository at this point in the history
  3. Merge cockroachdb#55641

    55641: opt: consolidate index formatting in expression trees r=mgartner a=mgartner
    
    A number of test outputs changed because all indexes are now formatted
    with a table's name, not its alias. Previously, table aliases were
    printed for Scans. This change made it easier to consolidate the index
    formatting into a single function.
    
    Release note: None
    
    
    Co-authored-by: Marcus Gartner <marcus@cockroachlabs.com>
    craig[bot] and mgartner committed Oct 27, 2020
    Configuration menu
    Copy the full SHA
    9390144 View commit details
    Browse the repository at this point in the history
  4. Merge cockroachdb#55998

    55998: storage: renaming functions in the Reader interface r=sumeerbhola a=sumeerbhola
    
    - Get to MVCCGet
    - GetProto to MVCCGetProto
    - Iterate to MVCCIterate
    - ExportToSst to ExportMVCCToSst
    
    Also added MVCCIterKind.
    
    Release note: None
    
    
    Co-authored-by: sumeerbhola <sumeer@cockroachlabs.com>
    craig[bot] and sumeerbhola committed Oct 27, 2020
    Configuration menu
    Copy the full SHA
    5e3c201 View commit details
    Browse the repository at this point in the history
  5. rowflow: account for more memory usage of the row buffer

    Previously, we accounted for the memory usage of the row buffer from
    which the rows are pushed from in the routers only when copying the rows
    from the row container, but we also have another in-memory row buffer
    that we can move the rows from which was missing the memory accounting.
    This is now fixed which also deflakes the router disk spill test.
    
    Release note: None
    yuzefovich committed Oct 27, 2020
    Configuration menu
    Copy the full SHA
    3557b32 View commit details
    Browse the repository at this point in the history
  6. tracing: rename a file

    `span.go` is where you'd go look for `type Span`.
    
    Release note: None
    tbg committed Oct 27, 2020
    Configuration menu
    Copy the full SHA
    c7c2798 View commit details
    Browse the repository at this point in the history
  7. roachtest: fix decommission/randomize

    The test could end up using fully decommissioned nodes for cli commands,
    which does not work as of cockroachdb#55286.
    Additionally, decommissioned nodes now become non-live after a short
    while, so various cli output checks had to be adjusted.
    
    Fixes cockroachdb#55581.
    
    Release note: None
    tbg committed Oct 27, 2020
    Configuration menu
    Copy the full SHA
    a00ffe5 View commit details
    Browse the repository at this point in the history
  8. build: increase logictest stress timeout to 2h

    The default 40 minutes timeout is not enough.
    
    Release note: None (testing change)
    asubiotto committed Oct 27, 2020
    Configuration menu
    Copy the full SHA
    cdb37cc View commit details
    Browse the repository at this point in the history
  9. opt: use paired joins for left semi inverted joins

    Semi joins using the inverted index used to be converted
    to an inner inverted join followed by an inner lookup join
    and a distinct for de-duplication. They are now converted
    to paired-joins consisting of an inner inverted join
    followed by a left semi lookup join, which is more
    efficient.
    
    Release note: None
    sumeerbhola committed Oct 27, 2020
    Configuration menu
    Copy the full SHA
    dd16fc3 View commit details
    Browse the repository at this point in the history
  10. Merge cockroachdb#55971

    55971: build: increase logictest stress timeout to 2h r=tbg a=asubiotto
    
    The default 40 minutes timeout is not enough.
    
    Release note: None (testing change)
    
    Closes cockroachdb#53729
    
    cc @yuzefovich 
    
    Co-authored-by: Alfonso Subiotto Marques <alfonso@cockroachlabs.com>
    craig[bot] and asubiotto committed Oct 27, 2020
    Configuration menu
    Copy the full SHA
    25a628f View commit details
    Browse the repository at this point in the history
  11. *: make conversions between string and usernames more explicit

    tldr: the conversions between "external" strings and internal
    usernames was unprincipled, and it turns out, incorrect in some
    cases. This patch cleans this up by introducing a strict conversion
    API.
    
    **Background**
    
    CockroachDB currently performs case folding and unicode NFC
    normalization upon receiving usernames, specifically usernames received
    from as SQL login principals.
    
    Internally, usernames are often—but not always—considered
    pre-normalized for the purpose of comparisons, privilege checks, role
    membership checks and the like.
    
    Finally, sometimes usernames are reported "back to outside".
    In error messages, log files etc, but also:
    
    - in the SQL syntax produced by SHOW CREATE, SHOW SYNTAX etc.
    - to generate OS-level file names for exported files.
    
    **New API**
    
    This patch introduces a new data type `security.SQLUsername`.
    It is incomparable and non-convertible with the Go `string`.
    
    Engineers must now declare intent about how to do the conversion:
    
    - `security.MakeSQLUsernameFromUserInput` converts an "outside" string
      to a username.
    - `security.MakeSQLUsernameFromPreNormalizedString` promises that
      its argument has already been previously normalized.
    - `security.MakeSQLUsernameFromPreNormalizedStringChecked` also checks
      that its argument has already been previously normalized.
    
    To output usernames, the following APIs are also available.
    
    - `username.Normalized()` produces the username itself, without
      decorations. These corresponds to the raw string (after
      normalization).
    
    - `username.SQLIdentifier()` produces the username in valid
      SQL syntax, so that it can be injected safely in a SQL
      statement.
    
    - `(*tree.FmtCtx).FormatUsername()` takes a username and properly
      handles quoting and anonymization, like `FormatName()` does for
      `tree.Name` already.
    
    Likewise, conversion from/to protobuf is now regulated, via the new
    APIs `username.EncodeProto()` and `usernameproto.Decode()`.
    
    **Problems being solved**
    
    - the usernames "from outside" were normalized sometimes, *but not
      consistently*:
    
      1. they were in the arguments of CREATE/DROP/ALTER ROLE. This was
         not changed.
      2. they were not consistently converted in `cockroach cert`. This was
         corrected.
      3. they were not in the `cockroach userfile` commands. This
         has been adjusted with a reference to issue cockroachdb#55389.
      4. they are *not* in GRANT/REVOKE. This patch does not change
         this behavior, but highlights it by spelling out
         `MakeSQLUsernameFromPreNormalizedString()` in the implementation.
      5. ditto for CREATE SCHEMA ... AUTHORIZATION and ALTER ... OWNER TO
      6. they were in the argument to `LoginRequest`. This was not
         changed.
      7. they were not in the argument of the other API requests that
         allow usernames, for example `ListSessions` or `CancelQuery`.
         This was not changed, but is now documented in the API.
    
    - the usernames "inside" were incorrectly directly injected
      in SQL statements, even though they may contain special
      characters that create SQL syntax errors.
    
      This has been corrected by suitable uses of the new
      `SQLIdentifier()` method.
    
    - There was an outright bug in a call to `CreateGCJobRec` (something
      about GCing jobs), where a `Description` field was passed in lieu
      of a username for a `User` field. The implications of this are unclear.
    
    **Status after this change**
    
    The new API makes it possible to audit exactly where "sensitive"
    username/string conversion occurs. After this patch, we find the
    following uses:
    
    - `MakeSQLUsernameFromUserInput`:
    
      - pgwire user auth
      - CLI URL parsing
      - `cockroach userfile`
      - `cockroach cert`
      - `(*rpc.SecurityContext).PGURL()` (unsure whether that's a good thing)
      - CREATE/DROP/ALTER ROLE
      - when using literal strings as `role_spec` in the SQL grammar
    
    - `MakeSQLUsernameFromPreNormalizedString`:
    
      - role membership checks inside SQL based on data read
        from `system` tables.
      - in GRANT/REVOKE (this is surprising, see above)
    
    - `MakeSQLUsernameFromPreNormalizedStringChecked`:
    
      - when intepreting the username in API query parameters, for
        those API documented as using pre-normalized usernames.
    
    Release note: None
    knz committed Oct 27, 2020
    Configuration menu
    Copy the full SHA
    1d05979 View commit details
    Browse the repository at this point in the history
  12. Merge cockroachdb#55398 cockroachdb#55986 cockroachdb#55997

    55398:  *: make conversions between `string` and usernames more explicit  r=aaron-crl,arulajmani a=knz
    
    Informs (but does not fix) cockroachdb#55396
    
    Informs cockroachdb#54696
    Informs  cockroachdb#55389
    
    tldr: the conversions between "external" strings and internal
    usernames was unprincipled, and it turns out, incorrect in some
    cases. This patch cleans this up by introducing a strict conversion
    API.
    
    **Background**
    
    CockroachDB currently performs case folding and unicode NFC
    normalization upon receiving usernames, specifically usernames received
    from as SQL login principals.
    
    Internally, usernames are often—but not always—considered
    pre-normalized for the purpose of comparisons, privilege checks, role
    membership checks and the like.
    
    Finally, sometimes usernames are reported "back to outside".
    In error messages, log files etc, but also:
    
    - in the SQL syntax produced by SHOW CREATE, SHOW SYNTAX etc.
    - to generate OS-level file names for exported files.
    
    **New API**
    
    This patch introduces a new data type `security.SQLUsername`.
    It is incomparable and non-convertible with the Go `string`.
    
    Engineers must now declare intent about how to do the conversion:
    
    - `security.MakeSQLUsernameFromUserInput` converts an "outside" string
      to a username.
    - `security.MakeSQLUsernameFromPreNormalizedString` promises that
      its argument has already been previously normalized.
    - `security.MakeSQLUsernameFromPreNormalizedStringChecked` also checks
      that its argument has already been previously normalized.
    
    To output usernames, the following APIs are also available.
    
    - `username.Normalized()` produces the username itself, without
      decorations. These corresponds to the raw string (after
      normalization).
    
    - `username.SQLIdentifier()` produces the username in valid
      SQL syntax, so that it can be injected safely in a SQL
      statement.
    
    - `(*tree.FmtCtx).FormatUsername()` takes a username and properly
      handles quoting and anonymization, like `FormatName()` does for
      `tree.Name` already.
    
    Likewise, conversion from/to protobuf is now regulated, via the new
    APIs `username.EncodeProto()` and `usernameproto.Decode()`.
    
    **Problems being solved**
    
    - the usernames "from outside" were normalized sometimes, *but not
      consistently*:
    
      1. they were in the arguments of CREATE/DROP/ALTER ROLE. This was
         not changed.
      2. they were not consistently converted in `cockroach cert`. This was
         corrected.
      3. they were not in the `cockroach userfile` commands. This
         has been adjusted with a reference to issue cockroachdb#55389.
      4. they are *not* in GRANT/REVOKE. This patch does not change
         this behavior, but highlights it by spelling out
         `MakeSQLUsernameFromPreNormalizedString()` in the implementation.
      5. ditto for CREATE SCHEMA ... AUTHORIZATION and ALTER ... OWNER TO
      6. they were in the argument to `LoginRequest`. This was not
         changed.
      7. they were not in the argument of the other API requests that
         allow usernames, for example `ListSessions` or `CancelQuery`.
         This was not changed, but is now documented in the API.
    
    - the usernames "inside" were incorrectly directly injected
      in SQL statements, even though they may contain special
      characters that create SQL syntax errors.
    
      This has been corrected by suitable uses of the new
      `SQLIdentifier()` method.
    
    - There was an outright bug in a call to `CreateGCJobRec` (something
      about GCing jobs), where a `Description` field was passed in lieu
      of a username for a `User` field. The implications of this are unclear.
    
    **Status after this change**
    
    The new API makes it possible to audit exactly where "sensitive"
    username/string conversion occurs. After this patch, we find the
    following uses:
    
    - `MakeSQLUsernameFromUserInput`:
    
      - pgwire user auth
      - CLI URL parsing
      - `cockroach userfile`
      - `cockroach cert`
      - `(*rpc.SecurityContext).PGURL()` (unsure whether that's a good thing)
      - CREATE/DROP/ALTER ROLE
      - when using literal strings as `role_spec` in the SQL grammar
    
    - `MakeSQLUsernameFromPreNormalizedString`:
    
      - role membership checks inside SQL based on data read
        from `system` tables.
      - in GRANT/REVOKE (this is surprising, see above)
    
    - `MakeSQLUsernameFromPreNormalizedStringChecked`:
    
      - when intepreting the username in API query parameters, for
        those API documented as using pre-normalized usernames.
    
    Release note: None
    
    55986: opt: use paired joins for left semi inverted joins r=sumeerbhola a=sumeerbhola
    
    Semi joins using the inverted index used to be converted
    to an inner inverted join followed by an inner lookup join
    and a distinct for de-duplication. They are now converted
    to paired-joins consisting of an inner inverted join
    followed by a left semi lookup join, which is more
    efficient.
    
    Release note: None
    
    55997: sql: fix object lookup for ALTER TABLE ... RENAME TO ... r=ajwerner a=jayshrivastava
    
    Previously, ALTER TABLE schema.table RENAME TO schema.existing_table
    would fail because the statement would look up the destination table in
    the public schema only. This commit fixes this behavior by using
    the correct destination schema.
    
    Fixes cockroachdb#55985
    
    Release note: None
    
    
    Co-authored-by: Raphael 'kena' Poss <knz@thaumogen.net>
    Co-authored-by: sumeerbhola <sumeer@cockroachlabs.com>
    Co-authored-by: Jayant Shrivastava <jayants@cockroachlabs.com>
    4 people committed Oct 27, 2020
    Configuration menu
    Copy the full SHA
    8652b7a View commit details
    Browse the repository at this point in the history
  13. backfill: remove unused bound account from column backfiller

    Previously, we were creating a bound account in the column backfiller
    which was not being used to track anything. This change removes that.
    
    Release note: None
    adityamaru committed Oct 27, 2020
    Configuration menu
    Copy the full SHA
    2c85868 View commit details
    Browse the repository at this point in the history
  14. build: add instructions to rectify code that is not regenerated

    Make it easier for the developer to know how to fix un-generated code by
    specifying the required commands.
    
    Release note: None
    otan committed Oct 27, 2020
    Configuration menu
    Copy the full SHA
    9a94690 View commit details
    Browse the repository at this point in the history
  15. Merge cockroachdb#55624 cockroachdb#56004 cockroachdb#56016

    55624: kvserver: don't always refuse to take leases when draining r=andreimatei a=andreimatei
    
    Before this patch, a draining node would not take any new leases once
    it's draining. This is a problem in case all replicas of a range are
    draining at the same time (e.g. when draining a single-node cluster, or
    when draining multiple nodes at the same time perhaps by mistake) -
    nobody wants the lease. Particularly because the liveness range is
    expiration-based (and thus permanently in need of new leases to be
    granted), this quickly results in nodes failing their liveness.
    It also becomes more of a problem with cockroachdb#55148, where we start refusing
    to take the lease on replicas that are not the leader - so if the leader
    is draining, we deadlock.
    
    This patch makes an exception for leaders, which now no longer refuse
    the lease even when they're draining. The reasonsing being that it's too
    easy to deadlock otherwise.
    
    Release note: None
    
    56004: build: add instructions to rectify code that is not regenerated r=irfansharif a=otan
    
    Make it easier for the developer to know how to fix un-generated code by
    specifying the required commands.
    
    Release note: None
    
    56016: backfill: remove unused bound account from column backfiller r=yuzefovich a=adityamaru
    
    Previously, we were creating a bound account in the column backfiller
    which was not being used to track anything. This change removes that.
    
    Release note: None
    
    Co-authored-by: Andrei Matei <andrei@cockroachlabs.com>
    Co-authored-by: Oliver Tan <otan@cockroachlabs.com>
    Co-authored-by: Aditya Maru <adityamaru@gmail.com>
    4 people committed Oct 27, 2020
    Configuration menu
    Copy the full SHA
    d058e01 View commit details
    Browse the repository at this point in the history
  16. settings: add todo to strip out StateMachineSetting

    Motivates the next commit.
    
    Release note: None
    irfansharif committed Oct 27, 2020
    Configuration menu
    Copy the full SHA
    3c7bb47 View commit details
    Browse the repository at this point in the history
  17. opt: prune unnecessary check columns

    This commit updates the optimizer to prune synthesized `CHECK`
    constraint columns for `UPDATES` when columns referenced in the
    constraints are not updated. This may also allow the optimizer to no
    longer fetch those referenced columns.
    
    This should provide a performance benefit for `UDPATE`s to tables with
    check constraints. Notably, tables that have been given many column
    families (in order to reduce contention) should see a significant
    reduction in contention for `UPDATE`s that mutate a subset of column
    families.
    
    Informs cockroachdb#51526
    
    Release note (performance improvement): Previously, all `CHECK`
    constraints defined on a table would be tested for every `UPDATE` to the
    table. Now, a check constraint will not be tested for validity when the
    values of columns it references are not being updated. The referenced
    columns are no longer fetchecd in cases where they were only fetched to
    test `CHECK` constraints.
    mgartner committed Oct 27, 2020
    Configuration menu
    Copy the full SHA
    d9a906e View commit details
    Browse the repository at this point in the history
  18. sql: remove vectorize=201auto option

    `201auto` option of `vectorize` setting has been removed since it no
    longer makes sense to keep (it was introduced as an escape hatch for
    20.2 release). Note that we don't need to bump the distsql version
    because of this change since it is backwards compatible - if the gateway
    is running the old version that has `vectorize=201auto` set, then we
    will check whether flows for all nodes don't have non-streaming
    operators and possibly use `off` option on the flow setup request, then
    the newer version remote node will check the vectorize setting on the
    request whether it is not `off` and setup the vectorized flow if it is
    not.
    
    Release note (sql change): `201auto` value for `vectorize` session
    variable and the corresponding cluster setting has been removed.
    yuzefovich committed Oct 27, 2020
    Configuration menu
    Copy the full SHA
    67b0c4e View commit details
    Browse the repository at this point in the history
  19. settings: delete StateMachineSetting, introduce VersionSetting

    We introduced the custom StateMachineSetting type in cockroachdb#17216 to power the
    underlying machinery for version upgrades:
    
      SET CLUSTER SETTING version = <major>-<minor>;
    
    At the time we left it generalizable enough to make room for future
    settings with arbitrary internal transitions. For cluster versions this
    meant only allowing transitions from one major version to the immediate
    next, all the while making sure that each binary in the cluster was able
    to activate the targeted version (the proposed version fell within the
    allowable range ["binary min supported version", "binary version"]).
    
    In the three years since we haven't added any state-machine validated
    settings that fit the bill, and the layers of abstractions to get to
    validated cluster version updates are one too many for (my) comfort.
    This PR introduces a new VersionSetting type that is more tightly
    coupled with the ClusterVersion type itself.
    
    VersionSetting uses language that only appropriate for cluster versions,
    hopefully clarifying things as we go. We'll depend on this clarification
    in future PRs when we remove the use of gossip in disseminating cluster
    version bumps.
    
    Release note (sql/cli change): The underlying type for the version
    cluster setting has been changed. Previously it was of an internal type
    representing "state machine", but now it's simply "version". This has no
    operational implications, but it does reflect differently in a few
    spots:
      - The `Type` column in `cockroach gen settings-list` will now show
        "version" instead of "custom validation"
      - The `setting_type` column for `version` in `SHOW CLUSTER SETTINGS`
        will now show a "v" instead of an "m"
      - The `valueType` column for `version` in `system.settings` will now
        show a "v" instead of an "m"
    irfansharif committed Oct 27, 2020
    Configuration menu
    Copy the full SHA
    3edd70b View commit details
    Browse the repository at this point in the history
  20. tracing: avoid opentracing interfaces internally

    We were previously shoehorning our tracing subsystem into the
    opentracing framework. This resulted in lots of bending over
    backwards to no real gain.
    
    Move off the interfaces so that we can more easily refactor
    the code for always-on tracing as well as make it more digestible.
    
    This commit is mostly mechanical. A bunch of code around the
    RPC interceptors was cribbed from the `otgrpc` package.
    
    Cleanups are delegated to additional commits.
    
    TestFollowerReadsWithStaleDescriptor, skipped temporarily in cockroachdb#55937,
    passes again due to the rearrangement in `startSpanGeneric` (we
    were setting the spanID too late, which led to tags being dropped).
    
    Release note: None
    tbg committed Oct 27, 2020
    Configuration menu
    Copy the full SHA
    429ab2d View commit details
    Browse the repository at this point in the history
  21. Merge cockroachdb#55877 cockroachdb#55907 cockroachdb#55982 cockroach…

    …db#55994 cockroachdb#56006
    
    55877: rowflow: account for more memory usage of the row buffer r=yuzefovich a=yuzefovich
    
    Previously, we accounted for the memory usage of the row buffer from
    which the rows are pushed from in the routers only when copying the rows
    from the row container, but we also have another in-memory row buffer
    that we can move the rows from which was missing the memory accounting.
    This is now fixed which also deflakes the router disk spill test.
    
    Fixes: cockroachdb#55848.
    
    Release note: None
    
    55907: sql: remove vectorize=201auto option r=yuzefovich a=yuzefovich
    
    `201auto` option of `vectorize` setting has been removed since it no
    longer makes sense to keep (it was introduced as an escape hatch for
    20.2 release). Note that we don't need to bump the distsql version
    because of this change since it is backwards compatible - if the gateway
    is running the old version that has `vectorize=201auto` set, then we
    will check whether flows for all nodes don't have non-streaming
    operators and possibly use `off` option on the flow setup request, then
    the newer version remote node will check the vectorize setting on the
    request whether it is not `off` and setup the vectorized flow if it is
    not.
    
    Release note (sql change): `201auto` value for `vectorize` session
    variable and the corresponding cluster setting has been removed.
    
    55982: roachtest: use IMPORT for all TPC-C tests r=nvanbenschoten a=nvanbenschoten
    
    Fixes cockroachdb#55541.
    Fixes cockroachdb#55580.
    
    In cockroachdb#54880 and cockroachdb#55050, we switched to using IMPORT for most TPC-C tests,
    in favor of BACKUP, which requires fixtures to be regenerated whenever
    we changed the workload. In this PR, we switch over the remaining uses
    of `fixtures load tpcc` to `fixtures import tpcc` to avoid compatibility
    issues on older release branches.
    
    55994: settings: delete StateMachineSetting, introduce VersionSetting r=irfansharif a=irfansharif
    
    We introduced the custom StateMachineSetting type in cockroachdb#17216 to power the
    underlying machinery for version upgrades:
    
      SET CLUSTER SETTING version = <major>-<minor>;
    
    At the time we left it generalizable enough to make room for future
    settings with arbitrary internal transitions. For cluster versions this
    meant only allowing transitions from one major version to the immediate
    next, all the while making sure that each binary in the cluster was able
    to activate the targeted version (the proposed version fell within the
    allowable range ["binary min supported version", "binary version"]).
    
    In the three years since we haven't added any state-machine validated
    settings that fit the bill, and the layers of abstractions to get to
    validated cluster version updates are one too many for (my) comfort.
    This PR introduces a new VersionSetting type that is more tightly
    coupled with the ClusterVersion type itself.
    
    VersionSetting uses language that only appropriate for cluster versions,
    hopefully clarifying things as we go. We'll depend on this clarification
    in future PRs when we remove the use of gossip in disseminating cluster
    version bumps.
    
    Release note (sql/cli change): The underlying type for the version
    cluster setting has been changed. Previously it was of an internal type
    representing "state machine", but now it's simply "version". This has no
    operational implications, but it does reflect differently in a few
    spots:
      - The `Type` column in `cockroach gen settings-list` will now show
        "version" instead of "custom validation"
      - The `setting_type` column for `version` in `SHOW CLUSTER SETTINGS`
        will now show a "v" instead of an "m"
      - The `valueType` column for `version` in `system.settings` will now
        show a "v" instead of an "m"
    
    
    56006: logictest: deflake a test r=yuzefovich a=yuzefovich
    
    We've recently merged a test that in very rare circumstances could
    produce a float result that differs from the expected one by 1 in the
    15th significant digit (after rounding). I believe that could occur,
    e.g. when the 15th and 16th significant digits were `35`, and we matched
    the spec of supporting 15 significant digits for floats, yet the
    rounding makes us return an unexpected result. This commit rounds to the
    precision of 1 digit less which should make the test non-flaky.
    
    Release note: None
    
    Co-authored-by: Yahor Yuzefovich <yahor@cockroachlabs.com>
    Co-authored-by: Nathan VanBenschoten <nvanbenschoten@gmail.com>
    Co-authored-by: irfan sharif <irfanmahmoudsharif@gmail.com>
    4 people committed Oct 27, 2020
    Configuration menu
    Copy the full SHA
    b319a0b View commit details
    Browse the repository at this point in the history
  22. sql: allow catalog prefix for schema names in CREATE SCHEMA

    The CREATE SCHEMA statement was expanded to allow schema
    names prefixed with database names. For example, the statement
    `CREATE SCHEMA other_db.schema_name` is valid.
    
    Release note (sql change): The CREATE SCHEMA statement was expanded
    to allow schema names prefixed with database names.
    jayshrivastava committed Oct 27, 2020
    Configuration menu
    Copy the full SHA
    c743b23 View commit details
    Browse the repository at this point in the history
  23. sql: allow catalog prefixes for schema names in DROP SCHEMA

    The DROP SCHEMA statement was expanded to allow schema
    names prefixed with database names. For example, the statement
    `DROP SCHEMA schema_name, other_db.schema_name CASCADE` is valid.
    
    Release note (sql change): The DROP SCHEMA statement was
    expanded to allow schema names prefixed with database names.
    jayshrivastava committed Oct 27, 2020
    Configuration menu
    Copy the full SHA
    032428c View commit details
    Browse the repository at this point in the history
  24. sql: allow database prefix for schema names in ALTER SCHEMA

    The ALTER SCHEMA statement was expanded to allow the source
    schema to be prefixed with a database name. For example,
    `ALTER SCHEMA other_db.schema_name RENAME TO schema_name_1` is valid.
    
    Release note (sql change): The ALTER SCHEMA statement was expanded
    to allow the source schema to be prefixed with a database name.
    jayshrivastava committed Oct 27, 2020
    Configuration menu
    Copy the full SHA
    60ce129 View commit details
    Browse the repository at this point in the history
  25. sql: allow database prefix for schemas in GRANT, REVOKE, and SHOW GRANTS

    The statements GRANT ... ON SCHEMA ...,
    REVOKE ... ON SCHEMA ..., and SHOW GRANTS ON SCHEMA ... were all
    updated to allow schema names prefixed with database names.
    
    Release note (sql change): The statements GRANT ... ON SCHEMA ...,
    REVOKE ... ON SCHEMA ..., and SHOW GRANTS ON SCHEMA ... were all
    updated to allow schema names prefixed with database names.
    jayshrivastava committed Oct 27, 2020
    Configuration menu
    Copy the full SHA
    45e3a80 View commit details
    Browse the repository at this point in the history
  26. lexbase: pin reserved_keywords.go within Bazel

    It's an auto-generated file that bazel doesn't yet know how to construct
    within the sandbox. Before this PR `make bazel-generate` would show
    spurious diffs on a clean checkout without this file present. Now it
    no longer will.
    
    Unfortunately it also means that successful bazel builds require
    `reserved_keywords.go` being pre-generated ahead of time (it's not
    checked-in into the repo). Once Bazel is taught to generate this file
    however, this will no longer be the case. It was just something that I
    missed in cockroachdb#55687.
    
    Release note: None
    irfansharif committed Oct 27, 2020
    Configuration menu
    Copy the full SHA
    71550a6 View commit details
    Browse the repository at this point in the history
  27. Merge cockroachdb#55560 cockroachdb#55809 cockroachdb#56019

    55560: backupccl: avoid div-by-zero crash on failed node count r=dt a=dt
    
    We've seen a report of a node that crashed due to a divide-by-zero
    hit during metrics collection, specifically when computing the
    throughput-per-node by dividing the backup size by node count.
    
    Since this is only now used for that metric, make a failure to count
    nodes a warning only for release builds (and fallback to 1), and make
    any error while counting, or not counting to more than 0, a returned
    error in non-release builds.
    
    Release note (bug fix): avoid crashing when BACKUP is unable to count the total nodes in the cluster.
    
    55809: roachtest: fix decommission/randomize r=irfansharif a=tbg
    
    The test could end up using fully decommissioned nodes for cli commands,
    which does not work as of cockroachdb#55286.
    
    Fixes cockroachdb#55581.
    
    Release note: None
    
    
    56019: lexbase: pin `reserved_keywords.go` within Bazel r=irfansharif a=irfansharif
    
    It's an auto-generated file that bazel doesn't yet know how to construct
    within the sandbox. Before this PR `make bazel-generate` would show
    spurious diffs on a clean checkout without this file present. Now it
    no longer will.
    
    Unfortunately it also means that successful bazel builds require
    `reserved_keywords.go` being pre-generated ahead of time (it's not
    checked-in into the repo). Once Bazel is taught to generate this file
    however, this will no longer be the case. It was just something that I
    missed in cockroachdb#55687.
    
    Release note: None
    
    Co-authored-by: David Taylor <tinystatemachine@gmail.com>
    Co-authored-by: Tobias Grieger <tobias.b.grieger@gmail.com>
    Co-authored-by: irfan sharif <irfanmahmoudsharif@gmail.com>
    4 people committed Oct 27, 2020
    Configuration menu
    Copy the full SHA
    bea5339 View commit details
    Browse the repository at this point in the history
  28. Merge cockroachdb#55647

    55647: sql: allow database prefixes for schema names r=ajwerner a=jayshrivastava
    
    This PR adds optional database prefixes to schemas for the following ops:
    - `CREATE SCHEMA ...`
    - `DROP SCHEMA ...`
    - `ALTER SCHEMA` (only the source schema can be prefixed to prevent changing the database of a schema using `ALTER SCHEMA thisdb.foo RENAME TO otherdb.bar`)
    - `GRANT ... ON SCHEMA ...`
    - `REVOKE ... ON SCHEMA ...`
    - `SHOW GRANTS ON SCHEMA ...`
    
    Schema names in statements such as `ALTER TYPE t SET SCHEMA` or `ALTER TABLE t SET SCHEMA` etc currently do not take database prefixes (this remains unchanged in this PR) to discourage the creation of cross database relations. Discussion notes for this are [here](https://cockroachlabs.atlassian.net/l/c/CRUiuKYu).
    
    Resolves cockroachdb#54295
    
    Co-authored-by: Jayant Shrivastava <jayants@cockroachlabs.com>
    craig[bot] and jayshrivastava committed Oct 27, 2020
    Configuration menu
    Copy the full SHA
    e0cfa21 View commit details
    Browse the repository at this point in the history
  29. Merge cockroachdb#55845

    55845: importccl: lift computed column check to input converter r=dt a=pbardea
    
    The current implementation of checking for validating the number of rows
    for computed columns for in non-IMPORT INTO backups is inefficient. This
    commit moves the check from being performed on every row to only being
    performed once per import.
    
    Fixes cockroachdb#55842.
    
    Release note: None
    
    Co-authored-by: Paul Bardea <pbardea@gmail.com>
    craig[bot] and pbardea committed Oct 27, 2020
    Configuration menu
    Copy the full SHA
    30b9f20 View commit details
    Browse the repository at this point in the history
  30. build: add SQLPARSER_TARGETS to BUILD.bazel keep

    Release note: None
    otan committed Oct 27, 2020
    Configuration menu
    Copy the full SHA
    da64067 View commit details
    Browse the repository at this point in the history
  31. Merge cockroachdb#56031

    56031: build: add SQLPARSER_TARGETS to BUILD.bazel keep r=irfansharif a=otan
    
    Release note: None
    
    Co-authored-by: Oliver Tan <otan@cockroachlabs.com>
    craig[bot] and otan committed Oct 27, 2020
    Configuration menu
    Copy the full SHA
    c5b2cfc View commit details
    Browse the repository at this point in the history

Commits on Oct 28, 2020

  1. storage: add MVCCIterKind parameter to Reader functions

    Also changes all callers to appropriately set these parameters.
    Note that MVCCKeyAndIntentsIterKind would always be correct, but
    where possible, we want to set MVCCKeyIterKind.
    
    Release note: None
    sumeerbhola committed Oct 28, 2020
    Configuration menu
    Copy the full SHA
    e3aa3c0 View commit details
    Browse the repository at this point in the history
  2. Merge cockroachdb#56007

    56007: opt: prune unnecessary check columns r=RaduBerinde a=mgartner
    
    This commit updates the optimizer to prune synthesized `CHECK`
    constraint columns for `UPDATES` when columns referenced in the
    constraints are not updated. This may also allow the optimizer to no
    longer fetch those referenced columns.
    
    This should provide a performance benefit for `UDPATE`s to tables with
    check constraints. Notably, tables that have been given many column
    families (in order to reduce contention) should see a significant
    reduction in contention for `UPDATE`s that mutate a subset of column
    families.
    
    Informs cockroachdb#51526
    
    Release note (performance improvement): Previously, all `CHECK`
    constraints defined on a table would be tested for every `UPDATE` to the
    table. Now, a check constraint will not be tested for validity when the
    values of columns it references are not being updated. The referenced
    columns are no longer fetchecd in cases where they were only fetched to
    test `CHECK` constraints.
    
    Co-authored-by: Marcus Gartner <marcus@cockroachlabs.com>
    craig[bot] and mgartner committed Oct 28, 2020
    Configuration menu
    Copy the full SHA
    db07523 View commit details
    Browse the repository at this point in the history
  3. Merge cockroachdb#56022

    56022: storage: add MVCCIterKind parameter to Reader functions r=sumeerbhola a=sumeerbhola
    
    
    Also changes all callers to try to appropriately set these parameters.
    Note that MVCCKeyAndIntentsIterKind would always be correct, but
    where possible, we want to set MVCCKeyIterKind.
    
    Release note: None
    
    Co-authored-by: sumeerbhola <sumeer@cockroachlabs.com>
    craig[bot] and sumeerbhola committed Oct 28, 2020
    Configuration menu
    Copy the full SHA
    70fb9a5 View commit details
    Browse the repository at this point in the history
  4. Merge cockroachdb#56012

    56012: tracing: move off opentracing interfaces r=knz,irfansharif a=tbg
    
    We were previously shoehorning our tracing subsystem into the
    opentracing framework. This resulted in lots of bending over
    backwards to no real gain.
    
    Move off the interfaces so that we can more easily refactor
    the code for always-on tracing as well as make it more digestible.
    
    This commit is mostly mechanical. A bunch of code around the
    RPC interceptors was cribbed from the `otgrpc` package.
    
    Cleanups are delegated to additional commits.
    
    TestFollowerReadsWithStaleDescriptor, skipped temporarily in cockroachdb#55937,
    passes again due to the rearrangement in `startSpanGeneric` (we
    were setting the spanID too late, which led to tags being dropped).
    
    Release note: None
    
    
    Co-authored-by: Tobias Grieger <tobias.b.grieger@gmail.com>
    craig[bot] and tbg committed Oct 28, 2020
    Configuration menu
    Copy the full SHA
    7442f71 View commit details
    Browse the repository at this point in the history
  5. roachpb,gc,mvcc: add UseClearRange option to GCRequest_GCKey

    This commit adds an optimization to massively reduce the overhead of
    garbage collecting large numbers of versions. When running garbage
    collection, we currently iterate through the store to send (Key, Timestamp)
    pairs in a GCRequest to the store to be evaluated and applied. This can
    be rather slow when deleting large numbers of keys, particularly due to the
    need to paginate. The primary motivation for pagination is to ensure that
    we do not create raft commands with deletions that are too large.
    
    In practice, we find that for the tiny values in a sequence, we find that we
    can GC around 1800 versions/s with cockroachdb#51184 and around 900 without it (though
    note that in that PR the more versions exist, the worse the throughput will
    be). This remains abysmally slow. I imagine that using larger batches could
    be one approach to increase the throughput, but, as it stands, 256 KiB is
    not a tiny raft command.
    
    This instead turns to the ClearRange operation which can delete all of versions
    of a key with the replication overhead of just two copies. This approach is
    somewhat controversial because, as @petermattis puts it:
    
    ```
    We need to be careful about this. Historically, adding many range tombstones
    was very bad for performance. I think we resolved most (all?) of those issues,
    but I'm still nervous about embracing using range tombstones below the level
    of a Range.
    ```
    
    Nevertheless, the results are enticing. Rather than pinning a core at full
    utilization for minutes just to clear the versions written to a sequence over
    the course of a bit more than an hour, we can clear that in ~2 seconds.
    
    The decision to use a ClearRange is controlled by whether an entire batch would
    be used to clear versions of a single key. This means that there we'll only send
    a clear range if there are at least `<key size> * <num versions> > 256 KiB`.
    There's any additional sanity check that the `<num versions>` is greater than
    32 in order to prevent issuing lots of `ClearRange` operations when the
    cluster has gigantic keys.
    
    This new functionality is gated behind both a version and an experimental
    cluster setting. I'm skipping the release note because of the experimental
    flag.
    
    Release note: None
    ajwerner committed Oct 28, 2020
    Configuration menu
    Copy the full SHA
    39fabe4 View commit details
    Browse the repository at this point in the history