go-zookeeper / zk

Native ZooKeeper client for Go
BSD 3-Clause "New" or "Revised" License
512 stars 130 forks source link

[BC] CreateMode: refactor and fix FlagX Create flags. #136

Closed jeffbean closed 3 months ago

jeffbean commented 5 months ago

BREAKING Client behavior: since this proposes a new parsing of the Create flag integer this will break clients if they rely on CreateContainer as it was creating znodes that may not have been containers.

Changes:

codecov[bot] commented 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 78.50%. Comparing base (6131812) to head (b61590a).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #136 +/- ## ========================================== + Coverage 77.98% 78.50% +0.51% ========================================== Files 7 8 +1 Lines 1322 1349 +27 ========================================== + Hits 1031 1059 +28 Misses 199 199 + Partials 92 91 -1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

jeffbean commented 5 months ago

Based on the PR https://github.com/go-zookeeper/zk/pull/125 that shows the issue at hand. The bug was in the CreateContainer and CreateTTL methods.

jeffbean commented 3 months ago

For others that may face new errors:

    path, err := c.CreateContainer("/container-node", []byte("foo"), zk.FlagTTL, zk.WorldACL(zk.PermAll))
    if err != nil {
        log.Fatal(err)
    }
// old: would not error, and create a Container znode
// new: will return an error that this is not a TTL operation and not create a znode