Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MySQL protocol layer code #97

Merged
merged 5 commits into from
Oct 25, 2021

Conversation

rebelice
Copy link
Collaborator

@rebelice rebelice commented Oct 11, 2021

This closes #88

This PR contains the simple MySQL protocol layer code. These codes refer to the implementation of TiDB, but are simplified and only include the necessary implementation.
It should be noted that the current implementation only supports the "mysql_native_password" auth plugin.

How to use

compile and run

make
./bin/tinysql-server

use MySQL-client

mysql --host 127.0.0.1 --port 4000 -u root

TODO

@CLAassistant
Copy link

CLAassistant commented Oct 11, 2021

CLA assistant check
All committers have signed the CLA.

@rebelice rebelice requested review from winoros and tisonkun October 11, 2021 04:59
Copy link
Contributor

@tisonkun tisonkun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks good. Just remind that we're developing a course instead of yet another TiDB, so please narrow the code shape as much as possible.

.gitignore Outdated
Comment on lines 1 to 15
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any of these lines necessary.

Makefile Outdated

include Makefile.common

.PHONY: all clean test gotest server dev benchkv benchraw check checklist parser tidy ddltest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove unnecessary items at the moment.

Makefile Outdated
Comment on lines 25 to 28
# Ensure GOPATH is set before running build process.
ifeq "$(GOPATH)" ""
$(error Please set the environment variable GOPATH before running `make`)
endif
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GOPATH ?= $(shell go env GOPATH) already ensures this?

Comment on lines +16 to +24
PROJECT=tinysql
GOPATH ?= $(shell go env GOPATH)
P=8

# Ensure GOPATH is set before running build process.
ifeq "$(GOPATH)" ""
$(error Please set the environment variable GOPATH before running `make`)
endif
FAIL_ON_STDOUT := awk '{ print } END { if (NR > 0) { exit 1 } }'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should remove repeats in Makefile?

Makefile.common Outdated
GOTEST := $(GO) test -p $(P)
OVERALLS := GO111MODULE=on overalls
STATICCHECK := GO111MODULE=on staticcheck
TIDB_EDITION ?= Community
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or please tidy Makefile.common to what we exactly want. At least I don't think we should keep this TiDB related stuff especially about edition.

config/config.go Show resolved Hide resolved
@rebelice
Copy link
Collaborator Author

@tisonkun Thanks for your review. I totally agree with you. At present, the MySQL protocol layer code is still too large. There are two main reasons:

  1. There are some modules that have not been simplified, such as config and errno
  2. The design of the server module is the same as TiDB, it should be simplified and refactored
    Of the two, reason 1 accounts for the main part.

The reason for doing this at present is that these two parts are not actually the focus of the TinySQL course. And these two jobs are not related to subsequent courses. So I took them down as issue and hoped to finish it later.

Developing and submitting labs have a higher priority, I hope we can focus on them first.

Copy link
Contributor

@tisonkun tisonkun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost looks good. Please resolve outstanding comments.

Makefile Outdated

default: server buildsucc

PROJECT=tinysql
GOPATH ?= $(shell go env GOPATH)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may still keep this line.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But well. It's OK to merge. If someone wants to tolerate it, file an issue.

@tisonkun tisonkun merged commit a5640dc into talent-plan:lab1 Oct 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants