-
Notifications
You must be signed in to change notification settings - Fork 27
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
namespace: create default namespace fallback if not any #65
Conversation
pkg/server/server.go
Outdated
@@ -129,6 +132,20 @@ func NewServer(ctx context.Context, cfg *config.Config, logger *zap.Logger, name | |||
return | |||
} | |||
|
|||
if errors.Is(dirErr, os.ErrNotExist) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's a better idea to check whether there are any namespaces after etcd starts? Is it easy to implement?
work
exists doesn't really mean the etcd database exists.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we can implement it with an extra RPC.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why change it back to check the dir?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because you said, one may don't want the default fallback. IMO, that means the proxy should fail if no namespace matched. But the default fallback works by detecting if there is any namespace. So there is always a default fallback, as long as you started a new TiProxy instance.
I've changed it back to workdir detection it only ran once. Then one should be able to delete the default fallback by weirctl
.
But after a second thought, I think we can solve this problem after supporting PD per namespace later. An empty namespace will prevent client connections, and only a non-empty/effective namespace will serve connections. So I changed it back to detect if there is any namespace again.
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
Signed-off-by: xhe <xw897002528@gmail.com>
pkg/server/server.go
Outdated
@@ -129,6 +132,20 @@ func NewServer(ctx context.Context, cfg *config.Config, logger *zap.Logger, name | |||
return | |||
} | |||
|
|||
if errors.Is(dirErr, os.ErrNotExist) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why change it back to check the dir?
Signed-off-by: xhe xw897002528@gmail.com
What problem does this PR solve?
Issue Number: close #47
Problem Summary: As title.
What is changed and how it works:
default
fallback on the first run by detectingcfg.Workdir
./weirctl namespace import conf/namespace
if yout need to init something different./weirctl namespace del default
if you don't want the fallback""
is renamed to"default"
. And empty namespace name is forbiddenCheck List
Tests
Notable changes
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.