encode zk child name with base64 encoding including ip, port, labels
guard feature with flag use_path_encoding so default behavior doesn't change
ensure backward compatibility: nerve with path encoding enabled works with old version of synapse safely
use variable length decoding to make schema more flexible:
a. prefix is optional encoded json
b. suffix is optional sequence number
make encoding more producer driven
a. feature is enabled based on child name prefixed with protocol name base64_
b. json content is decided by data parsing, no fields picking
nerve --config nerve.json
I, [2019-07-02T18:33:45.876228 #2405] INFO -- Nerve::Nerve: nerve: setting up!
I, [2019-07-02T18:33:45.878518 #2405] INFO -- Module: nerve: configuring statsd on host 'localhost' port 8125
I, [2019-07-02T18:33:45.878547 #2405] INFO -- Nerve::Nerve: nerve: starting main run loop
I, [2019-07-02T18:33:45.879281 #2405] INFO -- Nerve::Nerve: nerve: loading config
I, [2019-07-02T18:33:45.879754 #2405] INFO -- Module: nerve: configuring statsd on host 'localhost' port 8125
I, [2019-07-02T18:33:45.880121 #2405] INFO -- Nerve::Nerve: nerve: launching new watchers: ["mango-test_26009_secure"]
I, [2019-07-02T18:33:45.928838 #2405] INFO -- Nerve::ServiceWatcher: nerve: starting service watch mango-test_26009_secure
I, [2019-07-02T18:33:45.929018 #2405] INFO -- Nerve::Reporter::Zookeeper: nerve: waiting to connect to zookeeper cluster 127.0.0.1:2181 hosts 127.0.0.1:2181
I, [2019-07-02T18:33:45.929046 #2405] INFO -- Nerve::Reporter::Zookeeper: nerve: creating pooled connection to 127.0.0.1:2181
I, [2019-07-02T18:33:45.933940 #2405] INFO -- Nerve::Reporter::Zookeeper: nerve: successfully created zk connection to 127.0.0.1:2181
I, [2019-07-02T18:33:45.934014 #2405] INFO -- Nerve::Reporter::Zookeeper: nerve: retrieved zk connection to 127.0.0.1:2181
I, [2019-07-02T18:33:45.934834 #2405] INFO -- Nerve::ServiceCheck::TcpServiceCheck: nerve: service check mango-test_26009_secure tcp-127.0.0.1:3000 initial check returned true
I, [2019-07-02T18:33:45.935975 #2405] INFO -- Nerve::ServiceCheck::HttpServiceCheck: nerve: service check http-127.0.0.1:3000/health initial check returned true
I, [2019-07-02T18:33:45.937905 #2405] INFO -- Nerve::ServiceWatcher: nerve: service mango-test_26009_secure is now up
zkCli ls /mango-test/services
Connecting to localhost:2181
WATCHER::
WatchedEvent state:SyncConnected type:None path:null
[eyJob3N0IjoiMTI3LjAuMC4xIiwicG9ydCI6MzAwMCwibGFiZWxzIjp7ImF6IjoidXMtZWFzdC0xYSJ9fQ==_0000000008]
Summary:
use_path_encoding
so default behavior doesn't changebase64_
b. json content is decided by data parsing, no fields pickingThe counterpart synapse change: https://github.com/airbnb/synapse/pull/296
Test Plan:
test nerve config file:
compatibility test: mango-test (synapse 0.16.13)-> mango-production (nerve 0.9.0)
mango-test (synapse 0.17.0) -> mango-production (nerve 0.9.0)
mango-test (synapse 0.17.0) -> mango-canary (nerve 0.8.8)
Reviewers:
@allenlsy @austin-zhu @Jason-Jian @Ramyak