Add some tracing and the ability to tweak message fetch window size
This commit is contained in:
parent
4c71182c6b
commit
a553db4b82
@ -308,6 +308,12 @@ func (client *BlockSync) GetChainMessages(
|
|||||||
length uint64,
|
length uint64,
|
||||||
) ([]*CompactedMessages, error) {
|
) ([]*CompactedMessages, error) {
|
||||||
ctx, span := trace.StartSpan(ctx, "GetChainMessages")
|
ctx, span := trace.StartSpan(ctx, "GetChainMessages")
|
||||||
|
if span.IsRecordingEvents() {
|
||||||
|
span.AddAttributes(
|
||||||
|
trace.StringAttribute("tipset", fmt.Sprint(head.Cids())),
|
||||||
|
trace.Int64Attribute("count", int64(length)),
|
||||||
|
)
|
||||||
|
}
|
||||||
defer span.End()
|
defer span.End()
|
||||||
|
|
||||||
req := &Request{
|
req := &Request{
|
||||||
|
@ -7,6 +7,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"sort"
|
"sort"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -52,6 +53,19 @@ import (
|
|||||||
//the theoretical max height based on systime are quickly rejected
|
//the theoretical max height based on systime are quickly rejected
|
||||||
const MaxHeightDrift = 5
|
const MaxHeightDrift = 5
|
||||||
|
|
||||||
|
var defaultMessageFetchWindowSize = 200
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
if s := os.Getenv("LOTUS_BSYNC_MSG_WINDOW"); s != "" {
|
||||||
|
val, err := strconv.Atoi(s)
|
||||||
|
if err != nil {
|
||||||
|
log.Errorf("failed to parse LOTUS_BSYNC_MSG_WINDOW: %s", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
defaultMessageFetchWindowSize = val
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var log = logging.Logger("chain")
|
var log = logging.Logger("chain")
|
||||||
|
|
||||||
var LocalIncoming = "incoming"
|
var LocalIncoming = "incoming"
|
||||||
@ -1399,7 +1413,7 @@ func (syncer *Syncer) iterFullTipsets(ctx context.Context, headers []*types.TipS
|
|||||||
|
|
||||||
span.AddAttributes(trace.Int64Attribute("num_headers", int64(len(headers))))
|
span.AddAttributes(trace.Int64Attribute("num_headers", int64(len(headers))))
|
||||||
|
|
||||||
windowSize := 200
|
windowSize := defaultMessageFetchWindowSize
|
||||||
for i := len(headers) - 1; i >= 0; {
|
for i := len(headers) - 1; i >= 0; {
|
||||||
fts, err := syncer.store.TryFillTipSet(headers[i])
|
fts, err := syncer.store.TryFillTipSet(headers[i])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -48,6 +48,11 @@ block heights that are very far from the current chain height, you may want to
|
|||||||
increase this.
|
increase this.
|
||||||
|
|
||||||
|
|
||||||
|
### `LOTUS_BSYNC_MSG_WINDOW`
|
||||||
|
|
||||||
|
Set the initial maximum window size for message fetching blocksync requests. If
|
||||||
|
you have a slower internet connection and are having trouble syncing, you might
|
||||||
|
try lowering this down to 10-20 for a 'poor' internet connection.
|
||||||
|
|
||||||
## Lotus Miner
|
## Lotus Miner
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user