mirror of
https://github.com/dolthub/dolt.git
synced 2026-04-23 05:13:00 -05:00
Merge remote-tracking branch 'remotes/origin/main' into bh/replication-metrics
This commit is contained in:
@@ -27,6 +27,7 @@ import (
|
||||
|
||||
"github.com/dolthub/go-mysql-server/server"
|
||||
"github.com/dolthub/go-mysql-server/sql"
|
||||
"github.com/dolthub/go-mysql-server/sql/types"
|
||||
"github.com/dolthub/vitess/go/mysql"
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
"github.com/sirupsen/logrus"
|
||||
@@ -40,6 +41,7 @@ import (
|
||||
"github.com/dolthub/dolt/go/libraries/doltcore/sqle/binlogreplication"
|
||||
"github.com/dolthub/dolt/go/libraries/doltcore/sqle/cluster"
|
||||
_ "github.com/dolthub/dolt/go/libraries/doltcore/sqle/dfunctions"
|
||||
"github.com/dolthub/dolt/go/libraries/doltcore/sqle/dsess"
|
||||
"github.com/dolthub/dolt/go/libraries/doltcore/sqlserver"
|
||||
)
|
||||
|
||||
@@ -87,6 +89,32 @@ func Serve(
|
||||
}
|
||||
logrus.SetFormatter(LogFormat{})
|
||||
|
||||
sql.SystemVariables.AddSystemVariables([]sql.SystemVariable{
|
||||
{
|
||||
Name: dsess.DoltLogLevel,
|
||||
Scope: sql.SystemVariableScope_Global,
|
||||
Dynamic: true,
|
||||
SetVarHintApplies: false,
|
||||
Type: types.NewSystemEnumType(dsess.DoltLogLevel,
|
||||
logrus.PanicLevel.String(),
|
||||
logrus.FatalLevel.String(),
|
||||
logrus.ErrorLevel.String(),
|
||||
logrus.WarnLevel.String(),
|
||||
logrus.InfoLevel.String(),
|
||||
logrus.DebugLevel.String(),
|
||||
logrus.TraceLevel.String(),
|
||||
),
|
||||
Default: logrus.GetLevel().String(),
|
||||
NotifyChanged: func(scope sql.SystemVariableScope, v sql.SystemVarValue) {
|
||||
if level, err := logrus.ParseLevel(v.Val.(string)); err == nil {
|
||||
logrus.SetLevel(level)
|
||||
} else {
|
||||
logrus.Warnf("could not parse requested log level %s as a log level. dolt_log_level variable value and logging behavior will diverge.", v.Val.(string))
|
||||
}
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
var mrEnv *env.MultiRepoEnv
|
||||
var err error
|
||||
fs := dEnv.FS
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
Version = "1.0.0"
|
||||
Version = "1.0.1"
|
||||
)
|
||||
|
||||
var dumpDocsCommand = &commands.DumpDocsCmd{}
|
||||
|
||||
@@ -59,7 +59,7 @@ require (
|
||||
github.com/cespare/xxhash v1.1.0
|
||||
github.com/creasty/defaults v1.6.0
|
||||
github.com/dolthub/flatbuffers/v23 v23.3.3-dh.2
|
||||
github.com/dolthub/go-mysql-server v0.15.1-0.20230510045813-ba911392b553
|
||||
github.com/dolthub/go-mysql-server v0.15.1-0.20230511161328-b4ddc44585e9
|
||||
github.com/dolthub/swiss v0.1.0
|
||||
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
|
||||
github.com/jmoiron/sqlx v1.3.4
|
||||
|
||||
@@ -166,8 +166,8 @@ github.com/dolthub/flatbuffers/v23 v23.3.3-dh.2 h1:u3PMzfF8RkKd3lB9pZ2bfn0qEG+1G
|
||||
github.com/dolthub/flatbuffers/v23 v23.3.3-dh.2/go.mod h1:mIEZOHnFx4ZMQeawhw9rhsj+0zwQj7adVsnBX7t+eKY=
|
||||
github.com/dolthub/fslock v0.0.3 h1:iLMpUIvJKMKm92+N1fmHVdxJP5NdyDK5bK7z7Ba2s2U=
|
||||
github.com/dolthub/fslock v0.0.3/go.mod h1:QWql+P17oAAMLnL4HGB5tiovtDuAjdDTPbuqx7bYfa0=
|
||||
github.com/dolthub/go-mysql-server v0.15.1-0.20230510045813-ba911392b553 h1:dLgqnwh32cJPrjV3dja/hWluXwcrG1QrIKd29Vc5tfw=
|
||||
github.com/dolthub/go-mysql-server v0.15.1-0.20230510045813-ba911392b553/go.mod h1:YO4FtMULZ/HuKxlvm7QfvTE8uBKEv+1LtK2A3FrrGe4=
|
||||
github.com/dolthub/go-mysql-server v0.15.1-0.20230511161328-b4ddc44585e9 h1:+0W2FuuaoOtyFkw7vtklJxbibBxRv+tuWKaRo6OyMnU=
|
||||
github.com/dolthub/go-mysql-server v0.15.1-0.20230511161328-b4ddc44585e9/go.mod h1:YO4FtMULZ/HuKxlvm7QfvTE8uBKEv+1LtK2A3FrrGe4=
|
||||
github.com/dolthub/ishell v0.0.0-20221214210346-d7db0b066488 h1:0HHu0GWJH0N6a6keStrHhUAK5/o9LVfkh44pvsV4514=
|
||||
github.com/dolthub/ishell v0.0.0-20221214210346-d7db0b066488/go.mod h1:ehexgi1mPxRTk0Mok/pADALuHbvATulTh6gzr7NzZto=
|
||||
github.com/dolthub/jsonpath v0.0.1 h1:Nd+T3U+XisK3kOuxtABS5IIbZqXVIlOR9VYquyjQ0u0=
|
||||
|
||||
@@ -21,6 +21,8 @@ import (
|
||||
"github.com/dolthub/dolt/go/store/datas"
|
||||
"github.com/dolthub/dolt/go/store/hash"
|
||||
"github.com/dolthub/dolt/go/store/types"
|
||||
|
||||
"sync"
|
||||
)
|
||||
|
||||
type hooksDatabase struct {
|
||||
@@ -58,14 +60,21 @@ func (db hooksDatabase) PostCommitHooks() []CommitHook {
|
||||
|
||||
func (db hooksDatabase) ExecuteCommitHooks(ctx context.Context, ds datas.Dataset, onlyWS bool) {
|
||||
var err error
|
||||
var wg sync.WaitGroup
|
||||
for _, hook := range db.postCommitHooks {
|
||||
if !onlyWS || hook.ExecuteForWorkingSets() {
|
||||
err = hook.Execute(ctx, ds, db)
|
||||
if err != nil {
|
||||
hook.HandleError(ctx, err)
|
||||
}
|
||||
hook := hook
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
err = hook.Execute(ctx, ds, db)
|
||||
if err != nil {
|
||||
hook.HandleError(ctx, err)
|
||||
}
|
||||
}()
|
||||
}
|
||||
}
|
||||
wg.Wait()
|
||||
}
|
||||
|
||||
func (db hooksDatabase) CommitWithWorkingSet(
|
||||
|
||||
@@ -245,7 +245,9 @@ func ColCollsAreEqual(cc1, cc2 *ColCollection) bool {
|
||||
}
|
||||
// Pks Cols need to be in the same order and equivalent.
|
||||
for i := 0; i < cc1.Size(); i++ {
|
||||
if !cc1.cols[i].Equals(cc2.cols[i]) {
|
||||
// Test that the columns are identical, but don't worry about tags matching, since
|
||||
// different tags could be generated depending on how the schemas were created.
|
||||
if !cc1.cols[i].EqualsWithoutTag(cc2.cols[i]) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,6 +145,16 @@ func (c Column) Equals(other Column) bool {
|
||||
ColConstraintsAreEqual(c.Constraints, other.Constraints)
|
||||
}
|
||||
|
||||
// EqualsWithoutTag tests equality between two columns, but does not check the columns' tags.
|
||||
func (c Column) EqualsWithoutTag(other Column) bool {
|
||||
return c.Name == other.Name &&
|
||||
c.Kind == other.Kind &&
|
||||
c.IsPartOfPK == other.IsPartOfPK &&
|
||||
c.TypeInfo.Equals(other.TypeInfo) &&
|
||||
c.Default == other.Default &&
|
||||
ColConstraintsAreEqual(c.Constraints, other.Constraints)
|
||||
}
|
||||
|
||||
// Compatible tests compatibility between two columns. Compatible columns have the same tag and can store the same
|
||||
// kinds of values at the storage layer, but may have different constraints or type parameters.
|
||||
func (c Column) Compatible(other Column) bool {
|
||||
|
||||
@@ -50,6 +50,7 @@ const (
|
||||
AwsCredsProfile = "aws_credentials_profile"
|
||||
AwsCredsRegion = "aws_credentials_region"
|
||||
ShowBranchDatabases = "dolt_show_branch_databases"
|
||||
DoltLogLevel = "dolt_log_level"
|
||||
|
||||
DoltClusterRoleVariable = "dolt_cluster_role"
|
||||
DoltClusterRoleEpochVariable = "dolt_cluster_role_epoch"
|
||||
|
||||
@@ -325,7 +325,7 @@ DELIM
|
||||
[[ $output =~ "col1 | 6" ]] || false
|
||||
}
|
||||
|
||||
@test "column_tags: create table on two separate branches, merge them together by updating tags" {
|
||||
@test "column_tags: create table on two separate branches, merge them together even though they have different tags" {
|
||||
skip_nbf_not_dolt
|
||||
|
||||
dolt branch other
|
||||
@@ -344,23 +344,7 @@ DELIM
|
||||
dolt sql -q "ALTER TABLE target DROP COLUMN badCol;"
|
||||
dolt commit -Am "fixup"
|
||||
|
||||
run dolt schema tags
|
||||
[[ $output =~ "| target | col1 | 14690 |" ]] || false
|
||||
|
||||
dolt checkout main
|
||||
|
||||
run dolt schema tags
|
||||
[ $status -eq 0 ]
|
||||
[[ $output =~ "| target | col1 | 14649 |" ]] || false
|
||||
|
||||
run dolt merge other
|
||||
[ $status -ne 0 ]
|
||||
[[ $output =~ "table with same name 'target' added in 2 commits can't be merged" ]] || false
|
||||
dolt reset --hard
|
||||
|
||||
dolt schema update-tag target col1 14690
|
||||
dolt commit -am "update tag of col1 of target"
|
||||
|
||||
run dolt merge other -m "merge other into main"
|
||||
[ $status -eq 0 ]
|
||||
[[ $output =~ "1 tables changed, 1 rows added(+)" ]] || false
|
||||
|
||||
@@ -275,3 +275,34 @@ tests:
|
||||
result:
|
||||
columns: ["@@GLOBAL.max_connections"]
|
||||
rows: [["555"]]
|
||||
- name: "@@global.dolt_log_level behavior"
|
||||
repos:
|
||||
- name: repo1
|
||||
server:
|
||||
args: ["-l", "warning"]
|
||||
log_matches:
|
||||
- "Starting query"
|
||||
connections:
|
||||
- on: repo1
|
||||
queries:
|
||||
- query: "select @@GLOBAL.dolt_log_level"
|
||||
result:
|
||||
columns: ["@@GLOBAL.dolt_log_level"]
|
||||
rows: [["warning"]]
|
||||
- exec: "set @@GLOBAL.dolt_log_level = 'trace'"
|
||||
- query: "select 2+2 from dual"
|
||||
result:
|
||||
columns: ["2+2"]
|
||||
rows: [["4"]]
|
||||
- query: "select @@GLOBAL.dolt_log_level"
|
||||
result:
|
||||
columns: ["@@GLOBAL.dolt_log_level"]
|
||||
rows: [["trace"]]
|
||||
restart_server:
|
||||
args: ["-l", "info"]
|
||||
- on: repo1
|
||||
queries:
|
||||
- query: "select @@GLOBAL.dolt_log_level"
|
||||
result:
|
||||
columns: ["@@GLOBAL.dolt_log_level"]
|
||||
rows: [["info"]]
|
||||
|
||||
Reference in New Issue
Block a user