vitess.io/vitess@v0.16.2/changelog/14.0/14.0.0/release_notes.md (about)

     1  # Release of Vitess v14.0.0
     2  ## Summary
     3  
     4  - [Gen4 is now the default planner](#gen4-is-now-the-default-planner)
     5  - [New query support](#new-query-support)
     6  - [Command-line syntax deprecations](#command-line-syntax-deprecations)
     7  - [New command line flags and behavior](#new-command-line-flags-and-behavior)
     8  - [Online DDL changes](#online-ddl-changes)
     9  - [Table lifecycle](#table-lifecycle)
    10  - [Tablet throttler](#tablet-throttler)
    11  - [Heartbeat](#heartbeat)
    12  - [VDiff2](#vdiff2)
    13  - [Durability Policy](#durability-policy)
    14  - [Deprecation of Durability Configuration](#deprecation-of-durability-configuration)
    15  - [Advisory locking optimizations](#advisory-locking-optimizations)
    16  - [Pre-Legacy Resharding is now deprecated](#pre-legacy-resharding-is-now-deprecated)
    17  
    18  ## Known Issues
    19  
    20  - [VTOrc doesn't discover the tablets](https://github.com/vitessio/vitess/issues/10650) of a keyspace if the durability policy doesn't exist in the topo server when it comes up. This can be resolved by restarting VTOrc.
    21  - [Corrupted results for non-full-group-by queries with JOINs](https://github.com/vitessio/vitess/issues/11625). This can be resolved by using full-group-by queries.
    22  
    23  ## Major Changes
    24  
    25  ### Gen4 is now the default planner
    26  
    27  The new planner has been in the works since end of 2020, and it's finally grown enough to be able to become the default planner for Vitess.
    28  This means that many more queries are supported on sharded keyspaces, and old queries might get planned better than before.
    29  You can always roll back to the earlier planner, either by providing the flag `--planner-version=V3` to `vtgate`, or by adding a comment to individual queries, like so:
    30  
    31  ```sql
    32  select /*vt+ PLANNER=V3 */ name, count(*) from users
    33  ```
    34  
    35  ### New query support
    36  
    37  #### Support for aggregation across shards
    38  Vitess can now plan and execute most aggregation queries across multiple shards and/or keyspaces.
    39  
    40  #### INSERT from SELECT
    41  Support has been added for inserting new data from SELECT queries.
    42  Now you can insert data from a query into a table using a query like:
    43  
    44  ```sql
    45  insert into tbl (col) select id from users 
    46  ```
    47  
    48  #### UPDATE from SELECT
    49  Similarly, we have added support for UPDATE with scalar sub-queries. This allows for queries where the updated value is fetched using a subquery, such as this example:
    50  
    51  ```sql
    52  update tbl set foo = (select count(*) from otherTbl)
    53  ```
    54  
    55  ### Command-line syntax deprecations
    56  
    57  Vitess has begun a transition to a new library for CLI flag parsing.
    58  In order to facilitate a smooth transition, certain syntaxes that will not be supported in the future now issue deprecation warnings when used.
    59  
    60  The messages you will likely see, along with explanations and migrations, are:
    61  
    62  #### "Use of single-dash long flags is deprecated"
    63  
    64  Single-dash usage will be only possible for short flags (e.g. `-v` is okay, but `-verbose` is not).
    65  
    66  To migrate, update your CLI scripts from:
    67  
    68  ```
    69  $ vttablet -tablet_alias zone1-100 -init_keyspace mykeyspace ... # old way
    70  ```
    71  
    72  To:
    73  
    74  ```
    75  $ vttablet --tablet_alias zone1-100 --init_keyspace mykeyspace ... # new way
    76  ```
    77  
    78  #### "Detected a dashed argument after a position argument."
    79  
    80  As the full deprecation text goes on to (attempt to) explain, mixing flags and positional arguments will change in a future version that will break scripts.
    81  
    82  Currently, when invoking a binary like:
    83  
    84  ```
    85  $ vtctl --topo_implementation etcd2 AddCellInfo --root "/vitess/global"
    86  ```
    87  
    88  Everything after the `AddCellInfo` is treated by `package flag` as a positional argument, and we then use a sub FlagSet to parse flags specific to the subcommand.
    89  So, at the top-level, `flag.Args()` returns `["AddCellInfo", "--root", "/vitess/global"]`.
    90  
    91  The library we are transitioning to is more flexible, allowing flags and positional arguments to be interwoven on the command-line.
    92  For the above example, this means that we would attempt to parse `--root` as a top-level flag for the `VTCtl` binary.
    93  This will cause the program to exit on error, because that flag is only defined on the `AddCellInfo` subcommand.
    94  
    95  In order to transition, a standalone double-dash (literally, `--`) will cause the new flag library to treat everything following that as a positional argument, and also works with the current flag parsing code we use.
    96  
    97  So, to transition the above example without breakage, update the command to:
    98  
    99  ```shell
   100  $ vtctl --topo_implementation etcd2 AddCellInfo -- --root "/vitess/global"
   101  $ # the following will also work
   102  $ vtctl --topo_implementation etcd2 -- AddCellInfo --root "/vitess/global"
   103  $ # the following will NOT work, because --topo_implementation is a top-level flag, not a sub-command flag
   104  $ vtctl -- --topo_implementation etcd2 AddCellInfo --root "/vitess/global"
   105  ```
   106  
   107  ### New command line flags and behavior
   108  
   109  #### vttablet --heartbeat_on_demand_duration
   110  
   111  `--heartbeat_on_demand_duration` joins the already existing heartbeat flags `--heartbeat_enable` and `--heartbeat_interval` and adds new behavior to heartbeat writes.
   112  
   113  `--heartbeat_on_demand_duration` takes a duration value, such as `5s`.
   114  
   115  The default value for `--heartbeat_on_demand_duration` is zero, which means the flag is not set and there is no change in behavior.
   116  
   117  When `--heartbeat_on_demand_duration` has a positive value, then heartbeats are only injected on demand, based on internal requests. For example, when `--heartbeat_on_demand_duration=5s`, the tablet starts without injecting heartbeats.
   118  An internal module, like the lag throttler, may request the heartbeat writer for heartbeats. Starting at that point in time, and for the duration (a lease) of `5s` in our example, the tablet will write heartbeats.
   119  If no other requests come in during that time, the tablet then ceases to write heartbeats. If more requests for heartbeats come in, the tablet extends the lease for the next `5s` following each request.
   120  It stops writing heartbeats `5s` after the last request is received.
   121  
   122  The heartbeats are generated according to `--heartbeat_interval`.
   123  
   124  #### Deprecation of --online_ddl_check_interval
   125  
   126  The flag `--online_ddl_check_interval` is deprecated and will be removed in `v15`. It has been unused in `v13`.
   127  
   128  #### Removal of --gateway_implementation
   129  
   130  In previous releases, the `discoverygateway` was deprecated. In Vitess 14 it is now entirely removed, along with the VTGate flag that allowed us to choose a gateway.
   131  
   132  #### Deprecation of --planner_version
   133  
   134  The flag `--planner_version` is deprecated and will be removed in `v15`.
   135  Some binaries used `--planner_version`, and some used `--planner-version`.
   136  This has been made consistent - all binaries that allow you to configure the planner now take `--planner-version`.
   137  All uses of the underscore form have been deprecated and will be removed in `v15`.
   138  
   139  ### Online DDL changes
   140  
   141  #### Online DDL is generally available
   142  
   143  Online DDL is no longer experimental (with the exception of `pt-osc` strategy). Specifically:
   144  
   145  - Managed schema changes, the scheduler, the backing tables
   146  - Supporting SQL syntax
   147  - `vitess` strategy (online DDL via VReplication)
   148  - `gh-ost` strategy (online DDL via 3rd party `gh-ost`)
   149  - Recoverable migrations
   150  - Revertible migrations
   151  - Declarative migrations
   152  - Postponed migrations
   153  - And all other functionality
   154  
   155  Are all considered production-ready.
   156  
   157  `pt-osc` strategy (online DDL via 3rd party `pt-online-schema-change`) remains experimental.
   158  
   159  #### ddl_strategy: 'vitess'
   160  
   161  `ddl_strategy` now takes the value of `vitess` to indicate VReplication-based migrations. It is a synonym to `online` and uses the exact same functionality. The `online` term will be phased out in the future and `vitess` will remain the term of preference.
   162  
   163  Example:
   164  
   165  ```shell
   166  vtctlclient ApplySchema -skip_preflight -ddl_strategy='vitess' -sql "alter table my_table add column my_val int not null default 0" commerce
   167  ```
   168  
   169  #### --singleton-context and REVERT migrations
   170  
   171  It is now possible to submit a migration with `--singleton-context` strategy flag, while there's a pending (queued or running) `REVERT` migration that does not have a `--singleton-context` flag.
   172  
   173  #### Support for CHECK constraints
   174  
   175  Online DDL operations are more aware of `CHECK` constraints, and properly handle the limitation where a `CHECK`'s name has to be unique in the schema. As opposed to letting MySQL choose arbitrary names for shadow table's `CHECK` constraints, Online DDL now generates unique yet deterministic names, such that all shards converge onto the same names.
   176  
   177  Online DDL attempts to preserve the original check's name as a suffix to the generated name, where possible (names are limited to `64` characters).
   178  
   179  #### Behavior changes
   180  
   181  - `vtctl ApplySchema --uuid_list='...'` now rejects a migration if an existing migration has the same UUID but with different `migration_context`.
   182  
   183  ### Table lifecycle
   184  
   185  #### Views
   186  
   187  Table lifecycle now supports views. It does not purge rows from views, and does not keep views in `EVAC` state (they are immediately transitioned to `DROP` state).
   188  
   189  #### Fast drops
   190  
   191  On Mysql `8.0.23` or later, the states `PURGE` and `EVAC` are automatically skipped, thanks to `8.0.23` improvements to `DROP TABLE` speed of operation.
   192  
   193  ### Tablet throttler
   194  
   195  #### API changes
   196  
   197  Added `/throttler/throttled-apps` endpoint, which reports back all current throttling instructions. Note, this only reports explicit throttling requests (such as ones submitted by `/throtler/throttle-app?app=...`). It does not list incidental rejections based on throttle thresholds.
   198  
   199  API endpoint `/throttler/throttle-app` now accepts a `ratio` query argument, a floating point value in the range `[0..1]`, where:
   200  
   201  - `0` means "do not throttle at all"
   202  - `1` means "always throttle"
   203  - Any number in between is allowed. For example, `0.3` means "throttle with 0.3 probability", i.e. for any given request there's a 30% chance that the request is denied. Overall we can expect about `30%` of requests to be denied. Example: `/throttler/throttle-app?app=vreplication&ratio=0.25`.
   204  
   205  See new SQL syntax for controlling/viewing throttling, under [New Syntax](#new-syntax).
   206  
   207  #### New Syntax
   208  
   209  ##### Control and view Online DDL throttling
   210  
   211  We introduce the following syntax to:
   212  
   213  - Start/stop throttling for all Online DDL migrations, in general
   214  - Start/stop throttling for a particular Online DDL migration
   215  - View throttler state
   216  
   217  
   218  ```sql
   219  ALTER VITESS_MIGRATION '<uuid>' THROTTLE [EXPIRE '<duration>'] [RATIO <ratio>];
   220  ALTER VITESS_MIGRATION THROTTLE ALL [EXPIRE '<duration>'] [RATIO <ratio>];
   221  ALTER VITESS_MIGRATION '<uuid>' UNTHROTTLE;
   222  ALTER VITESS_MIGRATION UNTHROTTLE ALL;
   223  SHOW VITESS_THROTTLED_APPS;
   224  ```
   225  
   226  The default `duration` is "infinite" (set as 100 years):
   227  - Allowed units are (s)ec, (m)in, (h)our
   228  
   229  The ratio is in the range `[0..1]`:
   230  - `1` means throttle everything - the app will not make any progress
   231  - `0` means no throttling at all
   232  - `0.8` means on 8 out of 10 checks the app makes, it gets refused
   233  
   234  The syntax `SHOW VITESS_THROTTLED_APPS` is a generic call to the throttler, and returns information about all throttled apps, not specific to migrations.
   235  
   236  The output of `SHOW VITESS_MIGRATIONS ...` now includes `user_throttle_ratio`.
   237  
   238  This column is updated "once in a while", while a migration is running. Normally this is once a minute, but can be more frequent. The migration reports back the throttling instruction set by the user while it was running.
   239  This column does not indicate any lag-based throttling that might take place based on the throttler configuration. It only reports the explicit throttling value set by the user.
   240  
   241  ### Heartbeat
   242  
   243  The throttler now checks in with the heartbeat writer to request heartbeats, any time it (the throttler) is asked for a check.
   244  
   245  When `--heartbeat_on_demand_duration` is not set, there is no change in behavior.
   246  
   247  When `--heartbeat_on_demand_duration` is set to a positive value, then the throttler ensures that the heartbeat writer generates heartbeats for at least the following duration.
   248  This also means at the first throttler check, it's possible that heartbeats are idle, and so the first check will fail. As heartbeats start running, followup checks will get a more accurate lag evaluation and will respond accordingly.
   249  In a sense, it's a "cold engine" scenario, where the engine takes time to start up, and then runs smoothly.
   250  
   251  ### VDiff2
   252  
   253  We introduced a new version of VDiff -- currently marked as EXPERIMENTAL -- that executes the VDiff on vttablets rather than in vtctld.
   254  While this is experimental we encourage you to try it out and provide feedback! This input will be invaluable as we improve the feature on the march toward [a production-ready version](https://github.com/vitessio/vitess/issues/10494).
   255  You can try it out by adding the `--v2` flag to your VDiff command. Here's an example:
   256  ```
   257  $ vtctlclient --server=localhost:15999 VDiff -- --v2 customer.commerce2customer
   258  VDiff bf9dfc5f-e5e6-11ec-823d-0aa62e50dd24 scheduled on target shards, use show to view progress
   259  
   260  $ vtctlclient --server=localhost:15999 VDiff -- --v2 customer.commerce2customer show last
   261  
   262  VDiff Summary for customer.commerce2customer (4c664dc2-eba9-11ec-9ef7-920702940ee0)
   263  State:        completed
   264  RowsCompared: 196
   265  HasMismatch:  false
   266  StartedAt:    2022-06-26 22:44:29
   267  CompletedAt:  2022-06-26 22:44:31
   268  
   269  Use "--format=json" for more detailed output.
   270  
   271  $ vtctlclient --server=localhost:15999 VDiff -- --v2 --format=json customer.commerce2customer show last
   272  {
   273  	"Workflow": "commerce2customer",
   274  	"Keyspace": "customer",
   275  	"State": "completed",
   276  	"UUID": "4c664dc2-eba9-11ec-9ef7-920702940ee0",
   277  	"RowsCompared": 196,
   278  	"HasMismatch": false,
   279  	"Shards": "0",
   280  	"StartedAt": "2022-06-26 22:44:29",
   281  	"CompletedAt": "2022-06-26 22:44:31"
   282  }
   283  ```
   284  
   285  > Even before it's marked as production-ready (feature complete and tested widely in 1+ releases), it should be safe to use and is likely to provide much better results for very large tables.
   286  
   287  For additional details please see the [RFC](https://github.com/vitessio/vitess/issues/10134), the [README](https://github.com/vitessio/vitess/blob/release-14.0/go/vt/vttablet/tabletmanager/vdiff/README.md), and the VDiff2 [documentation](https://vitess.io/docs/14.0/reference/vreplication/vdiff2/).
   288  
   289  ### Durability Policy
   290  
   291  #### Deprecation of durability_policy Flag
   292  The durability policy for a keyspace is now stored in the keyspace record in the topology server.
   293  The `durability_policy` flag used by VTCtl, VTCtld, and VTWorker binaries has been deprecated and will be removed in a future release.
   294  
   295  #### New and Augmented Commands
   296  The VTCtld command `CreateKeyspace` has been augmented to take in an additional argument `--durability-policy` which will
   297  allow users to set the desired durability policy for a keyspace at creation time.
   298  
   299  For existing keyspaces, a new command `SetKeyspaceDurabilityPolicy` has been added, which allows users to change the
   300  durability policy of an existing keyspace.
   301  
   302  If semi-sync is not being used then durability policy should be set to `none` for the keyspace. This is also the default option.
   303  
   304  If semi-sync is being used then durability policy should be set to `semi_sync` for the keyspace and `--enable_semi_sync` should be set on vttablets.
   305  
   306  ### VTOrc - Deprecation of Durability Configuration
   307  The `Durability` configuration is deprecated and removed from VTOrc. Instead VTOrc will find the durability policy of the keyspace from
   308  the topology server. This allows VTOrc to monitor and repair multiple keyspaces which have different durability policies in use.
   309  
   310  **VTOrc will ignore keyspaces which have no durability policy specified in the keyspace record. This is to avoid clobbering an existing
   311  config from a previous release. So on upgrading to v14, users must run the command `SetKeyspaceDurabilityPolicy` specified above,
   312  to ensure that VTOrc continues to work as desired. The recommended upgrade
   313  path is to upgrade VTCtld, run `SetKeyspaceDurabilityPolicy` and then upgrade VTOrc.**
   314  
   315  ### Advisory locking optimizations
   316  Work has gone into making the advisory locks (`get_lock()`, `release_lock()`, etc.) release reserved connections faster and in more situations than before.
   317  
   318  ### Pre-Legacy Resharding is now deprecated
   319  A long time ago, the sharding column and type were specified at the keyspace level. This syntax is now deprecated and will be removed in v15.
   320  
   321  ------------
   322  The entire changelog for this release can be found [here](https://github.com/vitessio/vitess/blob/main/changelog/14.0/14.0.0/changelog.md).
   323  
   324  The release includes 1101 commits (excluding merges)
   325  
   326  Thanks to all our contributors: @FancyFane, @GuptaManan100, @Juneezee, @K-Kumar-01, @Phanatic, @ajm188, @akenneth, @aquarapid, @arthurschreiber, @brendar, @cuishuang, @dasl-, @dbussink, @deepthi, @dependabot[bot], @derekperkins, @doeg, @fatih, @frouioui, @harshit-gangal, @malpani, @matthiasr, @mattlord, @mattrobenolt, @notfelineit, @pjambet, @rohit-nayak-ps, @rsajwani, @shlomi-noach, @simon-engledew, @systay, @utk9, @vmg, @vmogilev, @y5w, @yields