cmd/swarm/swarm-smoke: better logs when debug mode triggers (#19237)
* cmd/swarm/swarm-smoke: better logs for debug functionality; * cmd/swarm/swarm-smoke: fixup
This commit is contained in:
parent
a6e5c6a2cc
commit
ceeb047e69
|
@ -23,6 +23,7 @@ import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"os"
|
"os"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -75,10 +76,17 @@ func trackChunks(testData []byte) error {
|
||||||
}
|
}
|
||||||
log.Trace("All references retrieved")
|
log.Trace("All references retrieved")
|
||||||
|
|
||||||
|
for i, ref := range addrs {
|
||||||
|
log.Trace(fmt.Sprintf("ref %d", i), "ref", ref)
|
||||||
|
}
|
||||||
|
|
||||||
// has-chunks
|
// has-chunks
|
||||||
for _, host := range hosts {
|
for _, host := range hosts {
|
||||||
httpHost := fmt.Sprintf("ws://%s:%d", host, 8546)
|
httpHost := fmt.Sprintf("ws://%s:%d", host, 8546)
|
||||||
log.Trace("Calling `Has` on host", "httpHost", httpHost)
|
log.Trace("Calling `Has` on host", "httpHost", httpHost)
|
||||||
|
|
||||||
|
hostChunks := []string{}
|
||||||
|
|
||||||
rpcClient, err := rpc.Dial(httpHost)
|
rpcClient, err := rpc.Dial(httpHost)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Trace("Error dialing host", "err", err)
|
log.Trace("Error dialing host", "err", err)
|
||||||
|
@ -93,15 +101,27 @@ func trackChunks(testData []byte) error {
|
||||||
}
|
}
|
||||||
log.Trace("rpc call ok")
|
log.Trace("rpc call ok")
|
||||||
count := 0
|
count := 0
|
||||||
for _, info := range hasInfo {
|
for i, info := range hasInfo {
|
||||||
if !info.Has {
|
if i == 0 {
|
||||||
count++
|
log.Trace("first hasInfo", "addr", info.Addr, "host", host, "i", i)
|
||||||
log.Error("Host does not have chunk", "host", httpHost, "chunk", info.Addr)
|
|
||||||
}
|
}
|
||||||
|
if i == len(hasInfo)-1 {
|
||||||
|
log.Trace("last hasInfo", "addr", info.Addr, "host", host, "i", i)
|
||||||
|
}
|
||||||
|
|
||||||
|
if info.Has {
|
||||||
|
hostChunks = append(hostChunks, "1")
|
||||||
|
} else {
|
||||||
|
hostChunks = append(hostChunks, "0")
|
||||||
|
count++
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if count == 0 {
|
if count == 0 {
|
||||||
log.Info("Host reported to have all chunks", "host", httpHost)
|
log.Info("host reported to have all chunks", "host", host)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Trace("chunks", "chunks", strings.Join(hostChunks, ""), "host", host)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue