dolthub / dolt

Dolt – Git for Data
Apache License 2.0
17.36k stars 488 forks source link

`dolthub/dolt-sql-server` image doesnt work correctly when regular dolt commands are supplied to it as arguments #8079

Closed coffeegoddd closed 1 week ago

coffeegoddd commented 1 week ago

Correct usage of the image would be to only accept arguments that are valid with the dolt sql-server command.

However, if bad commands are supplied, like in the following example where we supply dolt sql-server -l debug as arguments instead of just -l debug, the server does not error or crash, but appears to be started correctly.

docker run -it --rm -p 3307:3306 dolthub/dolt-sql-server:latest dolt sql-server -l debug
2024-06-27 00:17:52+00:00 [Note] [Entrypoint]: Entrypoint script for Dolt Server 1.41.1 starting.
2024-06-27 00:17:52+00:00 [Note] [Entrypoint]: Running init scripts
2024-06-27 00:17:52+00:00 [Warn] [Entrypoint]: /usr/local/bin/docker-entrypoint.sh: ignoring /docker-entrypoint-initdb.d/*

Starting server with Config HP="localhost:3306"|T="28800000"|R="false"|L="debug"|S="/tmp/mysql.sock"
DEBU[0000] Setting binary logging branch to main        
DEBU[0000] Loading events                               
INFO[0000] Server ready. Accepting connections.         
WARN[0000] secure_file_priv is set to "", which is insecure. 
WARN[0000] Any user with GRANT FILE privileges will be able to read any file which the sql-server process can read. 
WARN[0000] Please consider restarting the server with secure_file_priv set to a safe (or non-existent) directory.

This breaks replication though, and may in fact be starting more than Dolt server in the container:

root@a9c4e4178c62:/var/lib/dolt# ps aux | grep "sql-server"
root         1  0.0  0.0 434812  3932 pts/0    Ss   00:19   0:00 /run/rosetta/rosetta /usr/bin/tini tini -- docker-entrypoint.sh dolt sql-server -l debug
root         7  0.9  0.7 2815744 112044 pts/0  Sl+  00:19   0:00 /run/rosetta/rosetta /usr/local/bin/dolt dolt sql-server -l debug
root        75  0.0  0.0 435580  4896 pts/1    S+   00:20   0:00 /run/rosetta/rosetta /usr/bin/grep grep --color=auto sql-server