Giter Club home page Giter Club logo

gost's Issues

zk ignores the error of node exists

What happened:
in database/kv/zk/client.go, gost ignores the error of node exists, and when I try to create some node (like dubbo/config) I didn't know it exists with CreateWithValue, I got no error and I thought it worked, but in fact, it failed.
image

What you expected to happen:
When I try to create some node that exists, I want to know it, and then I can use SetContent to modify it.

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?:

incompatible dubbo-go v3.0.5#builder.go

../../../go/goworks/pkg/mod/dubbo.apache.org/dubbo-go/[email protected]/remoting/nacos/builder.go:52:60: cannot use sc (variable of type []"github.com/nacos-group/nacos-sdk-go/common/constant".ServerConfig) as []"github.com/nacos-group/nacos-sdk-go/v2/common/constant".ServerConfig value in argument to nacosClient.NewNacosConfigClient
..
What happened:

What you expected to happen:

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?:

the error logic of DefaultHandler#HandleZkEvent

What happened:
DefaultHandler#HandleZkEvent,这段代码有以下问题,看注释:

func (d *DefaultHandler) HandleZkEvent(z *ZookeeperClient) {
	var (
		state int
		event zk.Event
	)
	for {
		select {
		case event = <-z.Session:
                        // 直接用 event.Stata 就可以对比,int 多余
			switch (int)(event.State) {
			case (int)(zk.StateDisconnected):
				atomic.StoreUint32(&z.valid, 0)
                        // 第一个和第三个 case 都是用状态码来匹配,但这一个 case 是用的事件类型来匹配,逻辑有大问题,
                        // 但是 go-zookeeper 并没有定义连接成功的状态码(3),而 EventNodeDataChanged 的值也是 3,因此正好进入这个分支
			case (int)(zk.EventNodeDataChanged), (int)(zk.EventNodeChildrenChanged):
				z.eventRegistryLock.RLock()
				for p, a := range z.eventRegistry {
					if strings.HasPrefix(p, event.Path) {
						for _, e := range a {
							*e <- struct{}{}
						}
					}
				}
				z.eventRegistryLock.RUnlock()
			case (int)(zk.StateConnecting), (int)(zk.StateConnected), (int)(zk.StateHasSession):
				if state == (int)(zk.StateHasSession) {
					continue
				}
				if event.State == zk.StateHasSession {
					atomic.StoreUint32(&z.valid, 1)
					//if this is the first connection, don't trigger reconnect event
					if !atomic.CompareAndSwapUint32(&z.initialized, 0, 1) {
						close(z.reconnectCh)
						z.reconnectCh = make(chan struct{})
					}
				}
				z.eventRegistryLock.RLock()
				if a, ok := z.eventRegistry[event.Path]; ok && 0 < len(a) {
					for _, e := range a {
						*e <- struct{}{}
					}
				}
				z.eventRegistryLock.RUnlock()
			}
			state = (int)(event.State)
		}
	}
}

What you expected to happen:

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?:

modify readme

What would you like to be added:

根据 gost 各个 package 的意义,改进 readme 内容。

Why is this needed:

方便用户使用 gost 库。

Keep AcquireBytes consistent

What would you like to be added:

When the current AcquireBytes function misses a byte slice in the pool, it will return a byte slice with a length of 0 and a cap of size, and when it hits, it will return a slice with both length and cap of size. I think consistency is more user friendly

Why is this needed:

When the current AcquireBytes function misses a byte slice in the pool, it will return a byte slice with a length of 0 and a cap of size, and when it hits, it will return a slice with both length and cap of size. I think consistency is more user friendly

WARNING: DATA RACE in sync/deadlock

What happened:

WARNING: DATA RACE
Write at 0x000000722aa8 by goroutine 6:
  github.com/dubbogo/gost/sync.restore.func1()
      /home/travis/gopath/src/github.com/dubbogo/gost/sync/deadlock_test.go:162 +0x4c
  github.com/dubbogo/gost/sync.TestNoDeadlocks()
      /home/travis/gopath/src/github.com/dubbogo/gost/sync/deadlock_test.go:62 +0x23e
  testing.tRunner()
      /home/travis/.gimme/versions/go1.12.linux.amd64/src/testing/testing.go:865 +0x163
Previous read at 0x000000722aa8 by goroutine 56:
  github.com/dubbogo/gost/sync.lock.func1()
      /home/travis/gopath/src/github.com/dubbogo/gost/sync/deadlock.go:184 +0x76

What you expected to happen:
No race

How to reproduce it (as minimally and precisely as possible):
go test ./... -race

Anything else we need to know?:

log里面的CInfo不能输出传入字符串

CPrintfln方法中fmt.Fprint应为fmt.Fprintf

What happened:

What you expected to happen:

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?:

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.