mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 14:16:44 +00:00
swarm/cmd: fix directory checksum-ing for correctness tests; add bootstrap-test.sh script
swarm/network: config tweaks and log improved swarm/storage: cloud delivery in own go routine, dpa worker settings
This commit is contained in:
parent
2ef669bcc4
commit
6e75ca9c15
8 changed files with 66 additions and 23 deletions
28
swarm/cmd/bootstrap-testnet.sh
Normal file
28
swarm/cmd/bootstrap-testnet.sh
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
#
|
||||||
|
swarm remote-run nodes.lst 'swarm netstatkill; swarm stop all; rm -rf bin bzz .ethash /tmp/.eth* /tmp/swarm*; sudo reboot'
|
||||||
|
sleep 60
|
||||||
|
# update the control scripts on each host
|
||||||
|
swarm remote-update-scripts nodes.lst
|
||||||
|
# update the binary on each host node
|
||||||
|
swarm remote-update-bin nodes.lst
|
||||||
|
|
||||||
|
# spawn a 2-instance local cluster on each of our 10 host nodes
|
||||||
|
swarm remote-run nodes.lst 'swarm init 2; swarm netstatconf sworm; swarm netstatrun'
|
||||||
|
|
||||||
|
#collect enodes from all instances on all hosts
|
||||||
|
swarm remote-run nodes.lst 'swarm enode all' | tr -d '"' |grep -v running > enodes.lst
|
||||||
|
|
||||||
|
# swarm remote-run nodes.lst swarm addpeers <(enode)'
|
||||||
|
|
||||||
|
# copy enodes file to each host node
|
||||||
|
for node in `cat nodes.lst`; do scp enodes.lst $node:; done
|
||||||
|
|
||||||
|
# inject all enodes as peers to
|
||||||
|
|
||||||
|
swarm remote-run nodes.lst swarm addpeers all enodes.lst
|
||||||
|
|
||||||
|
# to bootstrap with i
|
||||||
|
|
||||||
|
# restart an instance on the first two host nodes to get the blockchain rolling
|
||||||
|
swarm remote-run <(head -2 nodes.lst) swarm restart 00 --mine
|
||||||
|
|
||||||
|
|
@ -287,6 +287,7 @@ function stop {
|
||||||
function shutdown {
|
function shutdown {
|
||||||
echo -n "stopping $1..."
|
echo -n "stopping $1..."
|
||||||
kill -2 $1
|
kill -2 $1
|
||||||
|
((i=0))
|
||||||
while true; do
|
while true; do
|
||||||
ps auxwww|grep geth|grep -v grep|awk '{print $2}'|grep -ql $1 || break
|
ps auxwww|grep geth|grep -v grep|awk '{print $2}'|grep -ql $1 || break
|
||||||
if ((i++>5)); then
|
if ((i++>5)); then
|
||||||
|
|
@ -434,7 +435,7 @@ function up {
|
||||||
id=$1
|
id=$1
|
||||||
path=$2
|
path=$2
|
||||||
file=$3
|
file=$3
|
||||||
if [ $file = "" ]; then
|
if [ "$file" = "" ]; then
|
||||||
file=`basename $path`
|
file=`basename $path`
|
||||||
fi
|
fi
|
||||||
echo "Upload file '$path' to node $id... " 1>&2
|
echo "Upload file '$path' to node $id... " 1>&2
|
||||||
|
|
@ -590,20 +591,26 @@ function update {
|
||||||
}
|
}
|
||||||
|
|
||||||
function checksum {
|
function checksum {
|
||||||
tar -cf - $1 | md5sum|awk '{print $1}'
|
if [ -f $1 ]; then
|
||||||
|
cat $1 | md5sum | awk '{print $1}'
|
||||||
|
else
|
||||||
|
cd $1 && md5deep -r -l . | sort | md5sum| awk '{print $1}'
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkaccess {
|
function checkaccess {
|
||||||
nodes=$1
|
nodes=$1
|
||||||
path=$2
|
path=$2
|
||||||
target=`basename $2`
|
target=`basename $2`
|
||||||
chsum=`md5sum $2|cut -f1 -d' '`
|
chsum=`checksum $2`
|
||||||
shift
|
shift
|
||||||
shift
|
shift
|
||||||
master=`head -1 $nodes`
|
master=`head -1 $nodes`
|
||||||
echo "uploading target on $master (md5sum $chsum, size: `du -b -d0 $2|cut -f1`)"
|
echo "uploading target on $master (md5sum $chsum, size: `du -b -d0 $path|cut -f1`)"
|
||||||
scp $path $master:$target
|
remote-run $master rm -rf $target
|
||||||
|
scp -r $path $master:$target
|
||||||
hash=`swarm remote-run $master "swarm up 00 $target $*"|tr -d '"'`
|
hash=`swarm remote-run $master "swarm up 00 $target $*"|tr -d '"'`
|
||||||
|
echo $hash
|
||||||
remote-run $nodes swarm checkdownload all $hash $chsum
|
remote-run $nodes swarm checkdownload all $hash $chsum
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -618,25 +625,27 @@ function checkdownload {
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
hash=$2
|
hash=$2
|
||||||
target=$3
|
|
||||||
datetag=`date "+%Y-%m-%d-%H:%M:%S"`
|
datetag=`date "+%Y-%m-%d-%H:%M:%S"`
|
||||||
file="swarm-$datetag"
|
file="swarm-$datetag"
|
||||||
rm -rf $tmpdir/$file
|
dest=$tmpdir/$file
|
||||||
/usr/bin/time -o $tmpdir/$file.log -f "%e" swarm download $id $hash $tmpdir/$file > /dev/null
|
target=$3
|
||||||
echo
|
rm -rf $dest
|
||||||
|
mkdir -p $dest
|
||||||
|
/usr/bin/time -o $dest.log -f "%e" swarm download $id $hash $dest > /dev/null
|
||||||
|
echo "instance $id download $hash to $dest"
|
||||||
if [ -f $target ]; then
|
if [ -f $target ]; then
|
||||||
cmp --silent $target $tmpdir/$file/* && echo PASS || echo FAIL
|
cmp --silent $target $dest/* && echo PASS || echo FAIL
|
||||||
elif [ -r $target ]; then
|
elif [ -r $target ]; then
|
||||||
diff -r $target $tmpdir/$file/ >/dev/null && echo PASS || echo FAIL
|
diff -r $target $dest >/dev/null && echo PASS || echo FAIL
|
||||||
else
|
else
|
||||||
exp=`md5sum $tmpdir/$file/*|cut -f1 -d' '`
|
exp=`checksum $dest/*`
|
||||||
if [ "$exp" = "$target" ]; then
|
if [ "$exp" = "$target" ]; then
|
||||||
echo -n PASS
|
echo -n PASS
|
||||||
else
|
else
|
||||||
echo FAIL "$exp = $target"
|
echo FAIL "$exp = $target"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
echo " latency: " `cat $tmpdir/$file.log`
|
echo " latency: " `cat $dest.log`
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -676,6 +685,8 @@ case $cmd in
|
||||||
info $*;;
|
info $*;;
|
||||||
"enode" )
|
"enode" )
|
||||||
enode $*;;
|
enode $*;;
|
||||||
|
"checksum" )
|
||||||
|
checksum $*;;
|
||||||
"status" )
|
"status" )
|
||||||
status $*;;
|
status $*;;
|
||||||
"peers" )
|
"peers" )
|
||||||
|
|
|
||||||
|
|
@ -128,7 +128,7 @@ func (self *Hive) Start(id discover.NodeID, listenAddr func() string, connectPee
|
||||||
node, need, proxLimit := self.kad.Suggest()
|
node, need, proxLimit := self.kad.Suggest()
|
||||||
|
|
||||||
if node != nil && len(node.Url) > 0 {
|
if node != nil && len(node.Url) > 0 {
|
||||||
glog.V(logger.Debug).Infof("[BZZ] KΛÐΞMLIΛ hive: call known bee %v", node.Url)
|
glog.V(logger.Detail).Infof("[BZZ] KΛÐΞMLIΛ hive: call known bee %v", node.Url)
|
||||||
// enode or any lower level connection address is unnecessary in future
|
// enode or any lower level connection address is unnecessary in future
|
||||||
// discovery table is used to look it up.
|
// discovery table is used to look it up.
|
||||||
connectPeer(node.Url)
|
connectPeer(node.Url)
|
||||||
|
|
@ -142,7 +142,7 @@ func (self *Hive) Start(id discover.NodeID, listenAddr func() string, connectPee
|
||||||
req := &retrieveRequestMsgData{
|
req := &retrieveRequestMsgData{
|
||||||
Key: storage.Key(randAddr[:]),
|
Key: storage.Key(randAddr[:]),
|
||||||
}
|
}
|
||||||
glog.V(logger.Debug).Infof("[BZZ] KΛÐΞMLIΛ hive: call any bee near %v (PO%03d) - messenger bee: %v", randAddr, proxLimit, peers[0])
|
glog.V(logger.Detail).Infof("[BZZ] KΛÐΞMLIΛ hive: call any bee near %v (PO%03d) - messenger bee: %v", randAddr, proxLimit, peers[0])
|
||||||
peers[0].(*peer).retrieve(req)
|
peers[0].(*peer).retrieve(req)
|
||||||
} else {
|
} else {
|
||||||
glog.V(logger.Warn).Infof("[BZZ] KΛÐΞMLIΛ hive: no peer")
|
glog.V(logger.Warn).Infof("[BZZ] KΛÐΞMLIΛ hive: no peer")
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,8 @@ const (
|
||||||
var (
|
var (
|
||||||
purgeInterval = 42 * time.Hour
|
purgeInterval = 42 * time.Hour
|
||||||
initialRetryInterval = 42 * time.Millisecond
|
initialRetryInterval = 42 * time.Millisecond
|
||||||
maxIdleInterval = 42 * 100 * time.Millisecond
|
maxIdleInterval = 42 * 1000 * time.Millisecond
|
||||||
|
// maxIdleInterval = 42 * 10 0 * time.Millisecond
|
||||||
)
|
)
|
||||||
|
|
||||||
type KadParams struct {
|
type KadParams struct {
|
||||||
|
|
|
||||||
|
|
@ -272,6 +272,7 @@ func (self *bzz) handle() error {
|
||||||
return self.protoError(ErrDecode, "<- %v: %v", msg, err)
|
return self.protoError(ErrDecode, "<- %v: %v", msg, err)
|
||||||
}
|
}
|
||||||
glog.V(logger.Debug).Infof("[BZZ] <- sync request: %v", req)
|
glog.V(logger.Debug).Infof("[BZZ] <- sync request: %v", req)
|
||||||
|
self.lastActive = time.Now()
|
||||||
self.sync(req.SyncState)
|
self.sync(req.SyncState)
|
||||||
|
|
||||||
case unsyncedKeysMsg:
|
case unsyncedKeysMsg:
|
||||||
|
|
@ -282,6 +283,7 @@ func (self *bzz) handle() error {
|
||||||
}
|
}
|
||||||
glog.V(logger.Debug).Infof("[BZZ] <- unsynced keys : %s", req.String())
|
glog.V(logger.Debug).Infof("[BZZ] <- unsynced keys : %s", req.String())
|
||||||
err := self.storage.HandleUnsyncedKeysMsg(&req, &peer{bzz: self})
|
err := self.storage.HandleUnsyncedKeysMsg(&req, &peer{bzz: self})
|
||||||
|
self.lastActive = time.Now()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return self.protoError(ErrDecode, "<- %v: %v", msg, err)
|
return self.protoError(ErrDecode, "<- %v: %v", msg, err)
|
||||||
}
|
}
|
||||||
|
|
@ -295,6 +297,7 @@ func (self *bzz) handle() error {
|
||||||
}
|
}
|
||||||
glog.V(logger.Debug).Infof("[BZZ] <- delivery request: %s", req.String())
|
glog.V(logger.Debug).Infof("[BZZ] <- delivery request: %s", req.String())
|
||||||
err := self.storage.HandleDeliveryRequestMsg(&req, &peer{bzz: self})
|
err := self.storage.HandleDeliveryRequestMsg(&req, &peer{bzz: self})
|
||||||
|
self.lastActive = time.Now()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return self.protoError(ErrDecode, "<- %v: %v", msg, err)
|
return self.protoError(ErrDecode, "<- %v: %v", msg, err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -426,7 +426,7 @@ LOOP:
|
||||||
keys = self.keys[priority]
|
keys = self.keys[priority]
|
||||||
break PRIORITIES
|
break PRIORITIES
|
||||||
}
|
}
|
||||||
glog.V(logger.Debug).Infof("[BZZ] syncer[%v/%v]: queue: [%v, %v, %v]", self.key.Log(), priority, len(self.keys[High]), len(self.keys[Medium]), len(self.keys[Low]))
|
glog.V(logger.Detail).Infof("[BZZ] syncer[%v/%v]: queue: [%v, %v, %v]", self.key.Log(), priority, len(self.keys[High]), len(self.keys[Medium]), len(self.keys[Low]))
|
||||||
// if the input queue is empty on this level, resort to history if there is any
|
// if the input queue is empty on this level, resort to history if there is any
|
||||||
if uint(priority) == histPrior && history != nil {
|
if uint(priority) == histPrior && history != nil {
|
||||||
glog.V(logger.Detail).Infof("[BZZ] syncer[%v]: reading history for %v", self.key.Log(), self.key)
|
glog.V(logger.Detail).Infof("[BZZ] syncer[%v]: reading history for %v", self.key.Log(), self.key)
|
||||||
|
|
|
||||||
|
|
@ -23,12 +23,12 @@ implementation for storage or retrieval.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const (
|
const (
|
||||||
storeChanCapacity = 1000
|
storeChanCapacity = 100
|
||||||
retrieveChanCapacity = 1000
|
retrieveChanCapacity = 100
|
||||||
singletonSwarmDbCapacity = 50000
|
singletonSwarmDbCapacity = 50000
|
||||||
singletonSwarmCacheCapacity = 500
|
singletonSwarmCacheCapacity = 500
|
||||||
maxStoreProcesses = 100
|
maxStoreProcesses = 8
|
||||||
maxRetrieveProcesses = 100
|
maxRetrieveProcesses = 8
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
||||||
|
|
@ -87,12 +87,12 @@ func (self *NetStore) Put(entry *Chunk) {
|
||||||
// that the chunk is has been retrieved
|
// that the chunk is has been retrieved
|
||||||
close(entry.Req.C)
|
close(entry.Req.C)
|
||||||
// deliver the chunk to requesters upstream
|
// deliver the chunk to requesters upstream
|
||||||
self.cloud.Deliver(entry)
|
go self.cloud.Deliver(entry)
|
||||||
} else {
|
} else {
|
||||||
glog.V(logger.Detail).Infof("[BZZ] NetStore.Put: localStore.Put %v stored locally", entry.Key.Log())
|
glog.V(logger.Detail).Infof("[BZZ] NetStore.Put: localStore.Put %v stored locally", entry.Key.Log())
|
||||||
// handle propagating store requests
|
// handle propagating store requests
|
||||||
// go self.cloud.Store(entry)
|
// go self.cloud.Store(entry)
|
||||||
self.cloud.Store(entry)
|
go self.cloud.Store(entry)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue