Backwards Incompatible Changes
There has been a change in the way stashes are stored, so you may not be able to see stashes created before this version with dolt stash list. To update your stash references run the following commands on the command line:
dolt sql -q "call dolt_stash('pop', 'stashes')" to put your stashed changes back in the working set. Then run either of the following:
dolt stash or dolt sql -q "call dolt_stash('push', 'dolt-cli')"
Additionally returning was made a reserved word to support insert...returning statements. Any tables, views, or columns named returning will no longer work in certain SQL statements without being quoted, e.g.:
SELECT `returning` from mytable;Per Dolt’s versioning policy, this is a minor version bump because these changes may impact existing applications. Please reach out to us on GitHub or Discord if you have questions or need help with any of these changes.
Merged PRs
dolt
- 9329: go: store/datas/database_common: store/nbs/store.go: Fix some issues when pushing to a dolt sql-server that is itself running GC.
A push to a remote works by uploading the missing content and then adding references to it in the remote datastore. If the remote is running a GC during the push, it is possible for the newly added data to be collected and no longer be available when the references are added.
This should cause a transient failure which is safe is retry. There were a couple bugs which could instead cause a panic. This makes some changes to safeguard against those case. - 9317: go/store/nbs: archive_chunk_source.go: Make sure we skip getRecords marked found when fetching chunks.
This avoids delivering the chunk more than once, which parts of the application layer are not expecting. - 9310: tidy up errors
This PR fixes index coll to use pointer receivers, and consolidates some errors to use the ones defined in GMS
companion pr: dolthub/go-mysql-server#3006 - 9309: go/store/nbs: Fix a bug where GetChunkLocations{,WithPaths} can return the same chunk more than once if it is in newgen and oldgen.
- 9308: dolt_stash stored procedure
This Pr implements issue #7623.
Includes the following changes:dolt_stashessystem table to view current stashes. Currently read-only.dolt_stash()stored procedure to use in the server context. Must be given a specific command (push, pop, clear, or drop) and a stash name.
- 9301: Use 256 stripes in node cache
- 9270: Add
dolt_preview_merge_conflictstable function
This table function shows which rows are conflicting for a table between two branches. Will error if there are schema conflicts - 9233: Add a
dolt_preview_merge_conflicts_summarytable function
This table function shows which tables are conflicting between two branches and how many data and/or schema conflicts there are for each table
go-mysql-server
- 3021: Added test for
insert...select...returning
Fixes #9248 - 3018: fix text storage for
leftandinstrfunction
fixes: #9322 - 3017: Support
*inreturningclauses
part of #9248 - 3016: Minor updates to support
UPDATE ... FROMin Doltgres
Minor changes to supportUPDATE ... FROMin Doltgres (dolthub/doltgresql#1536)
While working on this, I noticed a few issues with theUPDATE ... JOINsupport in GMS:- There was duplicated logic for
UPDATE ... JOINinPlanBuilder.buildUpdate()and in the analyzer rulemodifyUpdateExprsForJoin. Not allUPDATE ... JOINstatements can be handled in PlanBuilder, because some statements, likeIN SUBQUERY, are transformed into a join during analysis, so we need logic in the analyzer to identifyUPDATE ... JOINplans after that transformation. To reduce the duplication, I removed the logic from PlanBuilder and now we rely on on themodifyUpdateExprsForJoinrule to mark allUPDATE ... JOINplans. - Callers use
plan.GetUpdatable()to get a reference to the table being updated, butUPDATE ... JOINcan update multiple tables. TheGetUpdatable()APIs should be refactored to model this, otherwise we cannot accurately track multiple tables being modified and apply all the correct triggers/constraints. - Currently
UPDATE ... JOINnever honors foreign key constraints, due to limitations in the concrete typeUpdateJoin.GetUpdatable()returns. TheupdatableJoinTabletype does not implementsql.ForeignKeyTable, so GMS is unable to load any foreign key constraints from it. This also needs to be handled in a future PR.
- There was duplicated logic for
- 3015: server var tests
- 3014: Simplify implementation of
hasSingleOutput
As part of adding support forIS NULLandIS NOT NULLimplementations that can match Postgres's behavior for records, I've been digging through the references toexpression.IsNullin GMS so that we can have a separate implementation for Doltgres that GMS can still analyze correctly.
One reference toexpression.IsNullis in thehasSingleOutputwhich is used to determine if an expression result has a single row or more than one row. The only expression implementation I was able to find that actually returns multiple rows isplan.Subquery, so I simplified this function to remove the reference toexpression.IsNull. - 3013: handle insert returning for server context
- 3012: Handle
insert...returning...queries
part of #9248
insert...returning *currently doesn't work. Similar to dolthub/doltgresql#1432 - 3010: Add query time to logger
This is a proposed fix for Dolt issue: #8909
I'm not certain if we want to just add this field or replace connect time. I think this implementation is safer. - 3006: implement
if [not] existslogic for DDL aroundviews andindexes
This PR adds support for queries:create view if not exists ...create index if not exists ...alter table ... add index if not exists ...drop index if exists ...
fixes: #9293
companion pr: dolthub/vitess#417
vitess
- 420: Make
returninga reserved keyword
Part of #9248
Makingreturninga reserved keyword allows forreturningclause in all types of insert statements - 419: Add grammar support for
insert...returning...(most cases)
Part of #9248
Insert...returning...statements work withinsert_data_aliasandSET assignment_listcases. The following examples (from the MariaDB documentation) work.INSERT INTO t2 (id) VALUES (2),(3) RETURNING id,t;
I wasn't able to getINSERT INTO t1 SET id1=1, animal1='Bear' RETURNING f(id1), UPPER(animal1);insert...returning...to work withinsert_data_selectcases. TheRETURNINGclause is not supported for the following and would lead to a syntax error.
When I had added aINSERT INTO archive (id, data) SELECT id, data FROM live_data WHERE flag = 'old' RETURNING id;RETURNINGclause, there was a grammar conflict because the parser was not able to distinguish between a column alias and the 'RETURNING' keyword. This could be resolved by makingRETURNINGa reserved keyword, but we decided against that sinceRETURNINGis a non-reserved keyword in MySQL (doc).
I ran into a similar conflict withinsert_data_aliascases because the parser was not able to distinguish between a table alias and theRETURNINGkeyword. This was resolved by addingRETURNINGtonon_reserved_keyword2. This meansRETURNINGcan't be used as a table alias and may cause some customer issues but the likelihood is very low.
Also removed TestSingle from parse_test.go (we already have TestSingleSQL) - 417: add
if not existsoption tocreate view
syntax for: #9293
Introduced in MySQL 9.1: https://dev.mysql.com/doc/refman/9.1/en/create-view.html - 416: New flavor of injected expression
Closed Issues
- 9337: Can't use LIKE together with JSON_TABLE
- 9332: remotesapi through reverse proxy (caddy) error
- 9248: support returning clause in inserts like mariadb ?
- 9322: Using LEFT on TEXT column fails with "invalid type: *val.TextStorage"
- 9090: Add sql function to determine "who is ahead"
- 9076: Unexpected type conversion in IFNULL
- 9293:
IF (NOT) EXISTSdoes not work for someCREATE ...- andDROP-Statements - 9312: csv import failed by "cause: cannot update manifest: database is read only"
Performance
| Read Tests | MySQL | Dolt | Multiple |
|---|---|---|---|
| covering_index_scan | 1.93 | 0.68 | 0.35 |
| groupby_scan | 13.22 | 18.61 | 1.41 |
| index_join | 1.47 | 2.48 | 1.69 |
| index_join_scan | 1.44 | 1.44 | 1.0 |
| index_scan | 34.33 | 30.81 | 0.9 |
| oltp_point_select | 0.2 | 0.28 | 1.4 |
| oltp_read_only | 3.68 | 5.37 | 1.46 |
| select_random_points | 0.35 | 0.61 | 1.74 |
| select_random_ranges | 0.38 | 0.64 | 1.68 |
| table_scan | 34.33 | 33.12 | 0.96 |
| types_table_scan | 75.82 | 130.13 | 1.72 |
| reads_mean_multiplier | 1.3 |
| Write Tests | MySQL | Dolt | Multiple |
|---|---|---|---|
| oltp_delete_insert | 8.43 | 6.67 | 0.79 |
| oltp_insert | 4.18 | 3.25 | 0.78 |
| oltp_read_write | 9.06 | 11.87 | 1.31 |
| oltp_update_index | 4.18 | 3.3 | 0.79 |
| oltp_update_non_index | 4.18 | 3.25 | 0.78 |
| oltp_write_only | 5.28 | 6.55 | 1.24 |
| types_delete_insert | 8.43 | 6.91 | 0.82 |
| writes_mean_multiplier | 0.93 |
| TPC-C TPS Tests | MySQL | Dolt | Multiple |
|---|---|---|---|
| tpcc-scale-factor-1 | 95.18 | 39.05 | 2.44 |
| tpcc_tps_multiplier | 2.44 |
| Overall Mean Multiple | 1.56 |
|---|