Compare commits

...

1 Commits

Author SHA1 Message Date
“GheisMohammadi” 4db3638c12
update the hardcoded settings in stream sync 1 year ago
  1. 3
      api/service/stagedstreamsync/const.go
  2. 2
      api/service/stagedstreamsync/stage_heads.go
  3. 2
      api/service/stagedstreamsync/syncing.go
  4. 2
      cmd/harmony/main.go

@ -41,6 +41,9 @@ type (
MinStreams int // Minimum number of streams to do sync
InitStreams int // Number of streams requirement for initial bootstrap
MaxAdvertiseWaitTime int // maximum time duration between protocol advertisements
MaxBlocksPerSyncCycle uint64 // maximum number of blocks per each sync cycle, if set to zero, all blocks will be synced in one full cycle
MaxMemSyncCycleSize uint64 // maximum number of blocks to use in a single transaction for staged sync
// stream manager config
SmSoftLowCap int
SmHardLowCap int

@ -52,7 +52,7 @@ func (heads *StageHeads) Exec(ctx context.Context, firstCycle bool, invalidBlock
}
maxHeight := s.state.status.targetBN
maxBlocksPerSyncCycle := uint64(1024) // TODO: should be in config -> s.state.MaxBlocksPerSyncCycle
maxBlocksPerSyncCycle := s.state.config.MaxBlocksPerSyncCycle
currentHeight := heads.configs.bc.CurrentBlock().NumberU64()
s.state.currentCycle.TargetHeight = maxHeight
targetHeight := uint64(0)

@ -227,7 +227,7 @@ func (s *StagedStreamSync) doSyncCycle(ctx context.Context, initSync bool) (int,
s.inserted = 0
startHead := s.bc.CurrentBlock().NumberU64()
canRunCycleInOneTransaction := false
canRunCycleInOneTransaction := s.config.MaxBlocksPerSyncCycle > 0 && s.config.MaxBlocksPerSyncCycle <= s.config.MaxMemSyncCycleSize
var tx kv.RwTx
if canRunCycleInOneTransaction {

@ -938,6 +938,8 @@ func setupStagedSyncService(node *node.Node, host p2p.Host, hc harmonyconfig.Har
MinStreams: hc.Sync.MinPeers,
InitStreams: hc.Sync.InitStreams,
MaxAdvertiseWaitTime: hc.Sync.MaxAdvertiseWaitTime,
MaxBlocksPerSyncCycle: hc.Sync.StagedSyncCfg.MaxBlocksPerSyncCycle,
MaxMemSyncCycleSize: hc.Sync.StagedSyncCfg.MaxMemSyncCycleSize,
SmSoftLowCap: hc.Sync.DiscSoftLowCap,
SmHardLowCap: hc.Sync.DiscHardLowCap,
SmHiCap: hc.Sync.DiscHighCap,

Loading…
Cancel
Save