Topo error messages were obscure because they were not
reporting the node they were failing. The fix is extensive
because many places check for error strings to identify
specific types of error.
To address this, the topo errors have been converted to
also contain a code, and convenience functions are used
to check for error types. This allows the error string
to contain more information.
Signed-off-by: Sugu Sougoumarane <ssougou@gmail.com>
This commit consists only of the changes from running the following:
```
find go -name '*.go' | xargs -n 10 -- sed -i -r -e \
's,"github.com/youtube/vitess/go/,"vitess.io/vitess/go/,'
```
This is the big refactor:
* each implementation used to have a cell map. Now it's in the topo
package, and the implementations only provide a Conn (that connects
to a topo server), and a Factory (that creates Conn objects).
* the Tee implementation now just creates TeeConn objects.
* the MemoryTopo is still a single map, each Conn just uses a sub-part
of the map.
BUG=30274258
Please refer to #2694 and #2670 for motivation and reasoning for
this change.
I've tried to follow best practice in inserting the copyright
headers. In other open source projects, not all files carry
the notice. For example documentation doesn't. I've followed
similar ground rules.
I did not change the php because there is a separate LICENSE
file there by Pixel Federation. We'll first need to notify
them our intent before changing anything there.
As for the presubmit check, it's going to be non-trivial
because of the number of exceptions, like file types,
directories and generated code. So, it will have to be
a separate project.
- Introducing topodata.CellInfo. Stored in the global topology server, it
describes a connection to a topology server for a cell. It has both a
server address and a root directory to use. Also adding vtctl commands
to deal with it. Existing zk and etcd implementations ignore these flags
for now.
- Now passing toplevel server address and root as generic topology
parameters. And using a topo server factory method.
- Changing the topo server registration to use a Factory method. It
creates a topology server implementation with a server address and a
root path. Existing zk and etcd implementations ignore these flags for
now.
- adding a zk2 topology implementation. It doesn't use any of the go/zk
code, and allows the specification of a root directory for both the
global cell, and each individual cell. It also is using a different
directory structure, consistent with what we want all new topo
implementations to use. And it stores the data as protobuf, not json.
- deprecating the legacy 'zookeeper' implementation. Adding instructions
to migrate from old server style to new server style.
- removing old janitor code, been replaced by topo validator workflow.
- Using a more generic vtctld topo explorer, will use it in all servers
soon.
- Fixing the ZK command line to decode protos and use new connection
library.
- topo2topo now also copies VSchema.
In order to do that, I had to:
- Adding File/Dir APIs to topo.Backend.
- Implementing them for all flavors: memorytopo, zk, etcd, tee.
None of the backward compatible code is there yet,
so these can only be used for new objects.
- Adding corresponding unit tests.
- Fixing a few fake etcd-specific bugs.
Also now using CancelFunc for all topo watches.