namespace: ResolveX smarter about errors.
We now only avoid returning an error when the destination error
is for ResolveX method not implemented. We wouldn't even
need theat except for the __debug part of the space on a mounttable.
In that case the EP says the server is a mounttable but the __debug
stuff is intercepted by something that doesn't answer ResolveX.
Given that this extra work only happens for debugging, its no big
deal that we do the extra step.
Change-Id: I416a1a5f81c6f29bf2eaab7421acf7438feebc81
diff --git a/runtimes/google/ipc/client_test.go b/runtimes/google/ipc/client_test.go
index 79c2da9..fe70617 100644
--- a/runtimes/google/ipc/client_test.go
+++ b/runtimes/google/ipc/client_test.go
@@ -466,17 +466,11 @@
_, fn := runMountTable(t, r)
defer fn()
name := "noservers"
- // The local namespace client will return the 'current' name when it encounters
- // a timeout or other networking error, which means we may end up invoking an
- // RPC on that entry - which in our case means we end up invoking:
- // <mount table endpoint>/noservers.Sleep(). This RPC will fail immediately
- // since we've already reached our timeout, but we can't see that error
- // until we call Finish.
ctx, _ := r.NewContext().WithTimeout(300 * time.Millisecond)
call, verr := r.Client().StartCall(ctx, name, "Sleep", nil)
if verr != nil {
- if !verror.Is(verr, verror.Timeout.ID) && !verror.Is(verr, verror.BadProtocol.ID) {
- t.Fatalf("verror should be a timeout or badprotocol, not %s: stack %s",
+ if !verror.Is(verr, verror.Timeout.ID) && !verror.Is(verr, verror.NoExist.ID) {
+ t.Fatalf("verror should be a timeout or does not exist, not %s: stack %s",
verr, verr.(verror.E).Stack())
}
return
diff --git a/runtimes/google/naming/namespace/resolve.go b/runtimes/google/naming/namespace/resolve.go
index 8e785f8..8647590 100644
--- a/runtimes/google/naming/namespace/resolve.go
+++ b/runtimes/google/naming/namespace/resolve.go
@@ -90,24 +90,17 @@
var err error
curr := e
if e, err = ns.resolveAgainstMountTable(ctx, ns.rt.Client(), curr, pattern); err != nil {
- // If the name could not be found in the mount table, return an error.
+ // Lots of reasons why another error can happen. We are trying
+ // to single out "this isn't a mount table".
+ if notAnMT(err) {
+ vlog.VI(1).Infof("ResolveX(%s) -> %v", name, curr)
+ return curr, nil
+ }
if verror.Is(err, naming.ErrNoSuchNameRoot.ID) {
err = verror.Make(naming.ErrNoSuchName, ctx, name)
}
- if verror.Is(err, naming.ErrNoSuchName.ID) {
- vlog.VI(1).Infof("ResolveX(%s) -> (NoSuchName: %v)", name, curr)
- return nil, err
- }
- if verror.Is(err, verror.NotTrusted.ID) {
- vlog.VI(1).Infof("ResolveX(%s) -> (NotTrusted: %v)", name, curr)
- return nil, err
-
- }
- // Any other failure (server not found, no ResolveStep
- // method, etc.) are a sign that iterative resolution can
- // stop.
- vlog.VI(1).Infof("ResolveX(%s) -> %v (%s)", name, curr, err)
- return curr, nil
+ vlog.VI(1).Infof("ResolveX(%s) -> (%s: %v)", err, name, curr)
+ return nil, err
}
pattern = ""
}
@@ -158,9 +151,6 @@
}
// Lots of reasons why another error can happen. We are trying
// to single out "this isn't a mount table".
- // TODO(p); make this less of a hack, make a specific verror code
- // that means "we are up but don't implement what you are
- // asking for".
if notAnMT(err) {
vlog.VI(1).Infof("ResolveToMountTableX(%s) -> %v", name, last)
return last, nil
diff --git a/tools/debug/test.sh b/tools/debug/test.sh
index 17a016b..dc5bdd0 100755
--- a/tools/debug/test.sh
+++ b/tools/debug/test.sh
@@ -48,7 +48,7 @@
GOT=$("${DEBUG_BIN}" "${DEBUG_FLAGS}" glob "${EP}/__debug/logs/*" 2> "${DBGLOG}" | wc -l) \
|| (dumplogs "${DBGLOG}"; shell_test::fail "line ${LINENO}: failed to run debug")
shell_test::assert_gt "${GOT}" "0" "${LINENO}"
-
+
# Test logs size.
echo "This is a log file" > "${TMPDIR}/my-test-log-file"
GOT=$("${DEBUG_BIN}" "${DEBUG_FLAGS}" logs size "${EP}/__debug/logs/my-test-log-file" 2> "${DBGLOG}") \