mirror of
https://github.com/dolthub/dolt.git
synced 2026-04-29 19:39:52 -05:00
Merge main
This commit is contained in:
@@ -87,9 +87,9 @@ jobs:
|
||||
- name: Install Maven
|
||||
working-directory: ./.ci_bin
|
||||
run: |
|
||||
curl -LO https://dlcdn.apache.org/maven/maven-3/3.9.1/binaries/apache-maven-3.9.1-bin.tar.gz
|
||||
tar -xf apache-maven-3.9.1-bin.tar.gz
|
||||
echo "$(pwd)/apache-maven-3.9.1/bin" >> $GITHUB_PATH
|
||||
curl -LO https://dlcdn.apache.org/maven/maven-3/3.9.2/binaries/apache-maven-3.9.2-bin.tar.gz
|
||||
tar -xf apache-maven-3.9.2-bin.tar.gz
|
||||
echo "$(pwd)/apache-maven-3.9.2/bin" >> $GITHUB_PATH
|
||||
- name: Install Hadoop
|
||||
working-directory: ./.ci_bin
|
||||
run: |
|
||||
|
||||
@@ -87,9 +87,9 @@ jobs:
|
||||
- name: Install Maven
|
||||
working-directory: ./.ci_bin
|
||||
run: |
|
||||
curl -LO https://dlcdn.apache.org/maven/maven-3/3.9.1/binaries/apache-maven-3.9.1-bin.tar.gz
|
||||
tar -xf apache-maven-3.9.1-bin.tar.gz
|
||||
echo "$(pwd)/apache-maven-3.9.1/bin" >> $GITHUB_PATH
|
||||
curl -LO https://dlcdn.apache.org/maven/maven-3/3.9.2/binaries/apache-maven-3.9.2-bin.tar.gz
|
||||
tar -xf apache-maven-3.9.2-bin.tar.gz
|
||||
echo "$(pwd)/apache-maven-3.9.2/bin" >> $GITHUB_PATH
|
||||
- name: Install Hadoop
|
||||
working-directory: ./.ci_bin
|
||||
run: |
|
||||
|
||||
@@ -173,6 +173,12 @@ Clone this repository and cd into the `go` directory. Then run:
|
||||
go install ./cmd/dolt
|
||||
```
|
||||
|
||||
The output will be in `$GOPATH/bin`, which defaults to `~/go/bin`. To test your build, try:
|
||||
|
||||
```
|
||||
~/go/bin/dolt version
|
||||
```
|
||||
|
||||
# Configuration
|
||||
|
||||
Verify that your installation has succeeded by running `dolt` in your
|
||||
|
||||
@@ -15,7 +15,7 @@ require (
|
||||
github.com/dolthub/fslock v0.0.3
|
||||
github.com/dolthub/ishell v0.0.0-20221214210346-d7db0b066488
|
||||
github.com/dolthub/sqllogictest/go v0.0.0-20201107003712-816f3ae12d81
|
||||
github.com/dolthub/vitess v0.0.0-20230606164345-6cb0d80700b2
|
||||
github.com/dolthub/vitess v0.0.0-20230608223125-8cd7c28985bf
|
||||
github.com/dustin/go-humanize v1.0.0
|
||||
github.com/fatih/color v1.13.0
|
||||
github.com/flynn-archive/go-shlex v0.0.0-20150515145356-3f9db97f8568
|
||||
@@ -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.20230607160120-febad34dabd4
|
||||
github.com/dolthub/go-mysql-server v0.15.1-0.20230609162957-fc7e3c87e05a
|
||||
github.com/dolthub/swiss v0.1.0
|
||||
github.com/goccy/go-json v0.10.2
|
||||
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
|
||||
|
||||
@@ -168,8 +168,8 @@ 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-icu-regex v0.0.0-20230524105445-af7e7991c97e h1:kPsT4a47cw1+y/N5SSCkma7FhAPw7KeGmD6c9PBZW9Y=
|
||||
github.com/dolthub/go-icu-regex v0.0.0-20230524105445-af7e7991c97e/go.mod h1:KPUcpx070QOfJK1gNe0zx4pA5sicIK1GMikIGLKC168=
|
||||
github.com/dolthub/go-mysql-server v0.15.1-0.20230607160120-febad34dabd4 h1:NT1otNLjn/eIWU4p4VV3jGUSiGrVGwc9qAdcSeQoLPg=
|
||||
github.com/dolthub/go-mysql-server v0.15.1-0.20230607160120-febad34dabd4/go.mod h1:TP8QrAsULBEK7nP0BHRSfZ9l8oiAeaRzIREHVk2wnz0=
|
||||
github.com/dolthub/go-mysql-server v0.15.1-0.20230609162957-fc7e3c87e05a h1:caUBEa4yJZ5R7asrtRZkLCXlEJ5fCK3hXTP61faf1Ow=
|
||||
github.com/dolthub/go-mysql-server v0.15.1-0.20230609162957-fc7e3c87e05a/go.mod h1:XtLmc6ifDvaDySVCxu6Hhj6klAZq4um3oyTGzjaQqLc=
|
||||
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.2-0.20230525180605-8dc13778fd72 h1:NfWmngMi1CYUWU4Ix8wM+USEhjc+mhPlT9JUR/anvbQ=
|
||||
@@ -180,8 +180,8 @@ github.com/dolthub/sqllogictest/go v0.0.0-20201107003712-816f3ae12d81 h1:7/v8q9X
|
||||
github.com/dolthub/sqllogictest/go v0.0.0-20201107003712-816f3ae12d81/go.mod h1:siLfyv2c92W1eN/R4QqG/+RjjX5W2+gCTRjZxBjI3TY=
|
||||
github.com/dolthub/swiss v0.1.0 h1:EaGQct3AqeP/MjASHLiH6i4TAmgbG/c4rA6a1bzCOPc=
|
||||
github.com/dolthub/swiss v0.1.0/go.mod h1:BeucyB08Vb1G9tumVN3Vp/pyY4AMUnr9p7Rz7wJ7kAQ=
|
||||
github.com/dolthub/vitess v0.0.0-20230606164345-6cb0d80700b2 h1:KGlVqYOuu6iG6DJAK06mZQPeXB/ElYlOH5UsuqUNf0A=
|
||||
github.com/dolthub/vitess v0.0.0-20230606164345-6cb0d80700b2/go.mod h1:IyoysiiOzrIs7QsEHC+yVF0yRQ6W70GXyCXqtI2vVTs=
|
||||
github.com/dolthub/vitess v0.0.0-20230608223125-8cd7c28985bf h1:xUGTpOlvHw6TdwXZWXktEnaL5rSOj6NQwgWGeqMYyJY=
|
||||
github.com/dolthub/vitess v0.0.0-20230608223125-8cd7c28985bf/go.mod h1:IyoysiiOzrIs7QsEHC+yVF0yRQ6W70GXyCXqtI2vVTs=
|
||||
github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
|
||||
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
|
||||
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
|
||||
|
||||
@@ -452,24 +452,6 @@ func TestCharsetsAndCollations(t *testing.T) {
|
||||
require.Equal(t, "one", row["c1"])
|
||||
require.Equal(t, "\x00o\x00n\x00e", row["c2"])
|
||||
require.NoError(t, rows.Close())
|
||||
|
||||
// Test that we get an error for unsupported charsets/collations
|
||||
primaryDatabase.MustExec("CREATE TABLE t2 (pk int primary key, c1 varchar(255) COLLATE utf8mb4_bg_0900_as_cs);")
|
||||
waitForReplicaToCatchUp(t)
|
||||
replicaDatabase.MustExec("use db01;")
|
||||
rows, err = replicaDatabase.Queryx("SHOW TABLES WHERE Tables_in_db01 like 't2';")
|
||||
require.NoError(t, err)
|
||||
require.False(t, rows.Next())
|
||||
require.NoError(t, rows.Close())
|
||||
|
||||
rows, err = replicaDatabase.Queryx("SHOW REPLICA STATUS;")
|
||||
require.NoError(t, err)
|
||||
row = convertByteArraysToStrings(readNextRow(t, rows))
|
||||
require.Equal(t, "1105", row["Last_SQL_Errno"])
|
||||
require.NotEmpty(t, row["Last_SQL_Error_Timestamp"])
|
||||
require.Contains(t, row["Last_SQL_Error"], "The collation `utf8mb4_bg_0900_as_cs` has not yet been implemented")
|
||||
require.False(t, rows.Next())
|
||||
require.NoError(t, rows.Close())
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -2,31 +2,33 @@ SERVER_REQS_INSTALLED="FALSE"
|
||||
SERVER_PID=""
|
||||
DEFAULT_DB=""
|
||||
|
||||
set_server_reqs_installed() {
|
||||
SERVER_REQS_INSTALLED=$(python3 -c "
|
||||
requirements_installed = True
|
||||
try:
|
||||
import mysql.connector
|
||||
except:
|
||||
requirements_installed = False
|
||||
|
||||
print(str(requirements_installed).upper())
|
||||
")
|
||||
}
|
||||
|
||||
# wait_for_connection(<PORT>, <TIMEOUT IN MS>) attempts to connect to the sql-server at the specified
|
||||
# port on localhost, using the $SQL_USER (or 'dolt' if unspecified) as the user name, and trying once
|
||||
# per second until the millisecond timeout is reached. If a connection is successfully established,
|
||||
# this function returns 0. If a connection was not able to be established within the timeout period,
|
||||
# this function returns 1.
|
||||
wait_for_connection() {
|
||||
PYTEST_DIR="$BATS_TEST_DIRNAME/helper"
|
||||
python3 -c "
|
||||
import os
|
||||
import sys
|
||||
port=$1
|
||||
timeout=$2
|
||||
user=${SQL_USER:-dolt}
|
||||
end_time=$((SECONDS+($timeout/1000)))
|
||||
|
||||
args = sys.argv[sys.argv.index('--') + 1:]
|
||||
working_dir, database, port_str, timeout_ms, user = args
|
||||
os.chdir(working_dir)
|
||||
# BATS has 'set -e' enabled, which causes the script to fail immediately if any subcommand returns a non-zero
|
||||
# exit code, so we need to temporarily enable 'set +e', but be sure to turn 'set -e' back on before we exit.
|
||||
set +e
|
||||
while [ $SECONDS -lt $end_time ]; do
|
||||
dolt sql-client -u $user --host localhost --port $port --use-db "$DEFAULT_DB" --timeout 1 -q "SELECT 1;"
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Connected successfully!"
|
||||
set -e
|
||||
return 0
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
from pytest import wait_for_connection
|
||||
wait_for_connection(port=int(port_str), timeout_ms=int(timeout_ms), database=database, user=user)
|
||||
" -- "$PYTEST_DIR" "$DEFAULT_DB" "$1" "$2" "${SQL_USER:-dolt}"
|
||||
echo "Failed to connect to database $DEFAULT_DB on port $port within $timeout ms."
|
||||
set -e
|
||||
return 1
|
||||
}
|
||||
|
||||
start_sql_server() {
|
||||
|
||||
@@ -58,7 +58,8 @@ teardown() {
|
||||
PORT=$( definePORT )
|
||||
dolt sql-server --host 0.0.0.0 --port=$PORT &
|
||||
SERVER_PID=$! # will get killed by teardown_common
|
||||
sleep 5 # not using python wait so this works on windows
|
||||
SQL_USER='root'
|
||||
wait_for_connection $PORT 5000
|
||||
|
||||
run dolt sql-client -P $PORT -u root --use-db test_db -q "select user from mysql.user order by user"
|
||||
[ $status -eq 0 ]
|
||||
@@ -77,7 +78,8 @@ teardown() {
|
||||
PORT=$( definePORT )
|
||||
dolt sql-server --host 0.0.0.0 --port=$PORT &
|
||||
SERVER_PID=$! # will get killed by teardown_common
|
||||
sleep 5 # not using python wait so this works on windows
|
||||
SQL_USER='new_user'
|
||||
wait_for_connection $PORT 5000
|
||||
|
||||
run dolt sql-client -P $PORT -u root --use-db test_db -q "select user from mysql.user order by user"
|
||||
[ $status -ne 0 ]
|
||||
@@ -599,6 +601,7 @@ behavior:
|
||||
|
||||
@test "sql-privs: basic lack of privileges tests" {
|
||||
make_test_repo
|
||||
SQL_USER='dolt'
|
||||
start_sql_server
|
||||
|
||||
dolt sql-client -P $PORT -u dolt --use-db test_db -q "create table t1(c1 int)"
|
||||
@@ -681,6 +684,7 @@ behavior:
|
||||
|
||||
@test "sql-privs: deleting user prevents access by that user" {
|
||||
make_test_repo
|
||||
SQL_USER='dolt'
|
||||
start_sql_server
|
||||
|
||||
dolt sql-client -P $PORT -u dolt --use-db test_db -q "create table t1(c1 int)"
|
||||
|
||||
@@ -1675,15 +1675,7 @@ behavior:
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "database locked by another sql-server; either clone the database to run a second server" ]] || false
|
||||
|
||||
echo "import socket
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
s.bind(('', 0))
|
||||
addr = s.getsockname()
|
||||
print(addr[1])
|
||||
s.close()
|
||||
" > port_finder.py
|
||||
|
||||
PORT=$(python3 port_finder.py)
|
||||
PORT=$( definePORT )
|
||||
run dolt sql-server --port=$PORT --socket "dolt.$PORT.sock"
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "database locked by another sql-server; either clone the database to run a second server" ]] || false
|
||||
@@ -1747,7 +1739,7 @@ s.close()
|
||||
PORT=$( definePORT )
|
||||
dolt sql-server --host 0.0.0.0 --port=$PORT --user dolt --socket "dolt.$PORT.sock" &
|
||||
SERVER_PID=$! # will get killed by teardown_common
|
||||
sleep 5 # not using python wait so this works on windows
|
||||
wait_for_connection $PORT 5000
|
||||
|
||||
dolt sql-client --host=0.0.0.0 --port=$PORT --user=dolt <<< "create database mydb1;"
|
||||
dolt sql-client --host=0.0.0.0 --port=$PORT --user=dolt <<< "exit;"
|
||||
|
||||
@@ -57,7 +57,7 @@ teardown() {
|
||||
|
||||
run dolt --user=new_user sql <<< "select user from mysql.user"
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "Access denied for user" ]] || false
|
||||
[[ "$output" =~ "command denied to user " ]] || false
|
||||
|
||||
rm -rf .doltcfg
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ teardown() {
|
||||
|
||||
run dolt --user=new_user sql -q "select user from mysql.user"
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "$output" =~ "Access denied for user" ]]
|
||||
[[ "$output" =~ "command denied to user" ]] || false
|
||||
|
||||
rm -rf .doltcfg
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user