fix tests, add tipset expansion to relation criteria
This commit is contained in:
parent
f53422a1f9
commit
7363fa2e8e
@ -191,6 +191,9 @@ func (stb *syncTargetBucket) sameChainAs(ts *types.TipSet) bool {
|
|||||||
if types.CidArrsEqual(ts.Parents(), t.Cids()) {
|
if types.CidArrsEqual(ts.Parents(), t.Cids()) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
if types.CidArrsEqual(ts.Parents(), t.Parents()) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -268,6 +271,7 @@ func (sm *SyncManager) syncScheduler() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (sm *SyncManager) scheduleIncoming(ts *types.TipSet) {
|
func (sm *SyncManager) scheduleIncoming(ts *types.TipSet) {
|
||||||
|
log.Warn("Incoming tipset! ", ts.Cids(), ts.Height())
|
||||||
var relatedToActiveSync bool
|
var relatedToActiveSync bool
|
||||||
for _, acts := range sm.activeSyncs {
|
for _, acts := range sm.activeSyncs {
|
||||||
if ts.Equals(acts) {
|
if ts.Equals(acts) {
|
||||||
@ -276,17 +280,20 @@ func (sm *SyncManager) scheduleIncoming(ts *types.TipSet) {
|
|||||||
|
|
||||||
if types.CidArrsEqual(ts.Parents(), acts.Cids()) || types.CidArrsEqual(ts.Parents(), acts.Parents()) {
|
if types.CidArrsEqual(ts.Parents(), acts.Cids()) || types.CidArrsEqual(ts.Parents(), acts.Parents()) {
|
||||||
// sync this next, after that sync process finishes
|
// sync this next, after that sync process finishes
|
||||||
|
log.Warn("mark 1")
|
||||||
relatedToActiveSync = true
|
relatedToActiveSync = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !relatedToActiveSync && sm.activeSyncTips.RelatedToAny(ts) {
|
if !relatedToActiveSync && sm.activeSyncTips.RelatedToAny(ts) {
|
||||||
|
log.Warn("mark 2")
|
||||||
relatedToActiveSync = true
|
relatedToActiveSync = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// if this is related to an active sync process, immediately bucket it
|
// if this is related to an active sync process, immediately bucket it
|
||||||
// we don't want to start a parallel sync process that duplicates work
|
// we don't want to start a parallel sync process that duplicates work
|
||||||
if relatedToActiveSync {
|
if relatedToActiveSync {
|
||||||
|
log.Warn("related to active sync")
|
||||||
sm.activeSyncTips.Insert(ts)
|
sm.activeSyncTips.Insert(ts)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -304,6 +311,7 @@ func (sm *SyncManager) scheduleIncoming(ts *types.TipSet) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (sm *SyncManager) scheduleProcessResult(res *syncResult) {
|
func (sm *SyncManager) scheduleProcessResult(res *syncResult) {
|
||||||
|
log.Warn("sync result! ", res.ts.Key())
|
||||||
delete(sm.activeSyncs, res.ts.Key())
|
delete(sm.activeSyncs, res.ts.Key())
|
||||||
relbucket := sm.activeSyncTips.PopRelated(res.ts)
|
relbucket := sm.activeSyncTips.PopRelated(res.ts)
|
||||||
if relbucket != nil {
|
if relbucket != nil {
|
||||||
@ -320,6 +328,8 @@ func (sm *SyncManager) scheduleProcessResult(res *syncResult) {
|
|||||||
// have come in since. The question is, should we try to
|
// have come in since. The question is, should we try to
|
||||||
// sync these? or just drop them?
|
// sync these? or just drop them?
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
log.Warn("no related bucket!")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user