GithubHelp home page GithubHelp logo

weir's People

Contributors

aaronkan007 avatar eahitechnology avatar niubell avatar sunxiaoguang avatar teckick avatar yfaming avatar zy3101176 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

weir's Issues

Add user authentication when accessing api server

Feature Request

Current problem

When I access the api server, there is no verification operation. Therefore, unverified api operations may have unexpected effects on namesapce

What i expected

When I access the api server, I need to carry the client token or encrypted username and password.

support SET SESSION variable

Development Task

weir-proxy execute client SQLs in backend connection pool, so it is need to handle session variables in frontend.

I think there are two ways to support session variables.

  • Frontend client connection saves the session variables, and execute a SET statement before client SQL in a backend connection.
  • Frontend client connection holds a backend connection when SET session variables.

Each of the above has its own advantages and disadvantages. Which one should we support, or both?

Set the max_connections in the namespace

Feature Request

  • Problem
    Currently max_connections is the service level. If a namespace occupies too many connections, it will cause resource preemption.Resources are not isolated

  • We would like
    Set the namespcae level max_connections. Form resource isolation

SET NAMES utf8mb4 error

Bug Report

What did you do?

SET NAMES utf8mb4

What did you expect to see?

OK

What did you see instead?

SetNAMES is not a valid sysvar

What version of Weir are you using (weir-proxy -V)?

master

Set pessimistic connection

Hi,
Is it possible to set connection and querying to pessimistic instead of optimistic? I don't find where to set this option.
regards,
YM

set names do not work

Bug Report

weir在首次建立与底层mysql连接的时候,没有设置字符集,只是把字符集设置成了属性,并没有实际调用set names 指令,可以看代码如下

c.charset = constant.DefaultCharset

应该改为
c.charset = constant.DefaultCharset
这段删掉
在 handshake之后调用SetCharset,改完如下:
//c.charset = constant.DefaultCharset

// Apply configuration functions.
for i := range options {
	options[i](c)
}

if err = c.handshake(); err != nil {
	return nil, errors.Trace(err)
}
if err = c.SetCharset(constant.DefaultCharset); err != nil {
	return nil, errors.Trace(err)
}

为什么这么改呢?
SetCharset这个函数中有判断
if c.charset == charset {
return nil
}
所以如果c.charset = constant.DefaultCharset进行了赋值,也就是这个连接没有调用set names utf8mb4指令,当我们主动调用SetCharset(ctx, "utf8mb4")的时候,因为c.charset已经是utf8mb4了,就不会再往下执行,也就是不会发送 set name utf8mb4指令,从而导致字符集一次都没有设置过。

What did you do?

What did you expect to see?

What did you see instead?

What version of Weir are you using (weir-proxy -V)?

NamespaceManager.PrepareReloadNamespace之后原有连接池未销毁,连接泄露

NamespaceManager.PrepareReloadNamespace可以销毁原有连接吗

当我们变更一个namespace的对应的数据库实例列表时,通过管控接口,/reload/prepare/{namespace} 进行重新装载配置信息。通过数据库实例上tcp连接信息,能看到从weir还是会有连接与下掉的实例保持。代码跟踪发现在执行这个prepare管控接口的时候,会去重建连接池。重建之后,直接将原有连接池替换掉。原来的连接池没有销毁。

func (b *BackendImpl) initConnPools() error {
	connPools := make(map[string]*ConnPool)
	for addr := range b.cfg.Addrs {
		poolCfg := &ConnPoolConfig{
			Config:      Config{Addr: addr, UserName: b.cfg.UserName, Password: b.cfg.Password},
			Capacity:    b.cfg.Capacity,
			IdleTimeout: b.cfg.IdleTimeout,
		}
		connPool := NewConnPool(b.ns, poolCfg)
		connPools[addr] = connPool
	}
	successfulInitConnPoolAddrs := make(map[string]struct{})
	var initConnPoolErr error
	for addr, connPool := range connPools {
		if err := connPool.Init(); err != nil {
			initConnPoolErr = err
			break
		}
		successfulInitConnPoolAddrs[addr] = struct{}{}
	}
	if initConnPoolErr != nil {
		for addr := range successfulInitConnPoolAddrs {
			if err := connPools[addr].Close(); err != nil {
				logutil.BgLogger().Sugar().Error("close inited conn pool error, addr: %s, err: %v", addr, err)
			}
		}
		return initConnPoolErr
	}
	**b.connPools = connPools**
	return nil
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.