-
Notifications
You must be signed in to change notification settings - Fork 529
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16174 from MinaProtocol/dkijania/port_revive_arch…
…ive_test_stability_fix_port Port revive patch archive test again
- Loading branch information
Showing
19 changed files
with
912 additions
and
686 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
let PipelineMode = ../../Pipeline/Mode.dhall | ||
|
||
let PipelineTag = ../../Pipeline/Tag.dhall | ||
|
||
let Pipeline = ../../Pipeline/Dsl.dhall | ||
|
||
let JobSpec = ../../Pipeline/JobSpec.dhall | ||
|
||
let DebianVersions = ../../Constants/DebianVersions.dhall | ||
|
||
let RunInToolchain = ../../Command/RunInToolchain.dhall | ||
|
||
let Network = ../../Constants/Network.dhall | ||
|
||
let Profiles = ../../Constants/Profiles.dhall | ||
|
||
let Command = ../../Command/Base.dhall | ||
|
||
let Docker = ../../Command/Docker/Type.dhall | ||
|
||
let Size = ../Size.dhall | ||
|
||
let Benchmarks = ../../Constants/Benchmarks.dhall | ||
|
||
let SelectFiles = ../../Lib/SelectFiles.dhall | ||
|
||
let Spec = | ||
{ Type = | ||
{ key : Text | ||
, bench : Text | ||
, label : Text | ||
, size : Size | ||
, name : Text | ||
, path : Text | ||
, mode : PipelineMode.Type | ||
, dependsOn : List Command.TaggedKey.Type | ||
, additionalDirtyWhen : List SelectFiles.Type | ||
, yellowThreshold : Double | ||
, redThreshold : Double | ||
} | ||
, default = | ||
{ mode = PipelineMode.Type.PullRequest | ||
, size = Size.Medium | ||
, dependsOn = | ||
DebianVersions.dependsOn | ||
DebianVersions.DebVersion.Bullseye | ||
Network.Type.Devnet | ||
Profiles.Type.Standard | ||
, additionalDirtyWhen = [] : List SelectFiles.Type | ||
, yellowThreshold = 0.1 | ||
, redThreshold = 0.2 | ||
} | ||
} | ||
|
||
let command | ||
: Spec.Type -> Command.Type | ||
= \(spec : Spec.Type) | ||
-> Command.build | ||
Command.Config::{ | ||
, commands = | ||
RunInToolchain.runInToolchain | ||
(Benchmarks.toEnvList Benchmarks.Type::{=}) | ||
"./buildkite/scripts/benchmarks.sh ${spec.bench} --red-threshold ${Double/show | ||
spec.redThreshold} --yellow-threshold ${Double/show | ||
spec.yellowThreshold}" | ||
, label = "Perf: ${spec.label}" | ||
, key = spec.key | ||
, target = spec.size | ||
, docker = None Docker.Type | ||
, depends_on = spec.dependsOn | ||
} | ||
|
||
let pipeline | ||
: Spec.Type -> Pipeline.Config.Type | ||
= \(spec : Spec.Type) | ||
-> Pipeline.Config::{ | ||
, spec = JobSpec::{ | ||
, dirtyWhen = | ||
[ SelectFiles.strictlyStart (SelectFiles.contains "src") | ||
, SelectFiles.exactly | ||
"buildkite/src/Command/Bench/Base" | ||
"dhall" | ||
, SelectFiles.contains "scripts/benchmark" | ||
, SelectFiles.contains "buildkite/scripts/benchmark" | ||
] | ||
# spec.additionalDirtyWhen | ||
, path = spec.path | ||
, name = spec.name | ||
, mode = spec.mode | ||
, tags = | ||
[ PipelineTag.Type.Long | ||
, PipelineTag.Type.Test | ||
, PipelineTag.Type.Stable | ||
] | ||
} | ||
, steps = [ command spec ] | ||
} | ||
|
||
in { command = command, pipeline = pipeline, Spec = Spec } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
< XLarge | Large | Medium | Small | Integration | QA | Hardfork | Multi > | ||
< XLarge | Large | Medium | Small | Integration | QA | Hardfork | Multi | Perf > |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
let Spec = | ||
{ Type = { tokenEnvName : Text, bucket : Text, org : Text, host : Text } | ||
, default = | ||
{ tokenEnvName = "\\\${INFLUX_TOKEN}" | ||
, bucket = "\\\${INFLUX_BUCKET_NAME}" | ||
, org = "\\\${INFLUX_ORG}" | ||
, host = "\\\${INFLUX_HOST}" | ||
} | ||
} | ||
|
||
let toEnvList = | ||
\(spec : Spec.Type) | ||
-> [ "INFLUX_HOST=${spec.host}" | ||
, "INFLUX_TOKEN=${spec.tokenEnvName}" | ||
, "INFLUX_ORG=${spec.org}" | ||
, "INFLUX_BUCKET_NAME=${spec.bucket}" | ||
] | ||
|
||
let mainlineBranches = "[develop,compatible,master]" | ||
|
||
in { Type = Spec, toEnvList = toEnvList, mainlineBranches = mainlineBranches } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
src/app/libp2p_helper/src/libp2p_helper/bitswap_delete.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
package main | ||
|
||
import ( | ||
"codanet" | ||
"errors" | ||
|
||
"github.com/ipfs/go-cid" | ||
) | ||
|
||
func ClearRootDownloadState(bs BitswapState, root root) { | ||
rootStates := bs.RootDownloadStates() | ||
state, has := rootStates[root] | ||
if !has { | ||
return | ||
} | ||
nodeParams := bs.NodeDownloadParams() | ||
delete(rootStates, root) | ||
state.allDescendants.ForEach(func(c cid.Cid) error { | ||
np, hasNp := nodeParams[c] | ||
if hasNp { | ||
delete(np, root) | ||
if len(np) == 0 { | ||
delete(nodeParams, c) | ||
} | ||
} | ||
return nil | ||
}) | ||
state.cancelF() | ||
} | ||
|
||
// getTag retrieves root's tag, whether the root is still being processed | ||
// or its processing was completed | ||
func getTag(bs BitswapState, root BitswapBlockLink) (tag BitswapDataTag, err error) { | ||
state, has := bs.RootDownloadStates()[root] | ||
if has { | ||
tag = state.getTag() | ||
} else { | ||
err = bs.ViewBlock(root, func(b []byte) error { | ||
_, fullBlockData, err := ReadBitswapBlock(b) | ||
if err != nil { | ||
return err | ||
} | ||
if len(fullBlockData) < 5 { | ||
return errors.New("root block is too short") | ||
} | ||
tag = BitswapDataTag(fullBlockData[4]) | ||
return nil | ||
}) | ||
} | ||
return | ||
} | ||
|
||
func DeleteRoot(bs BitswapState, root BitswapBlockLink) (BitswapDataTag, error) { | ||
if err := bs.SetStatus(root, codanet.Deleting); err != nil { | ||
return 255, err | ||
} | ||
tag, err := getTag(bs, root) | ||
if err != nil { | ||
return tag, err | ||
} | ||
ClearRootDownloadState(bs, root) | ||
|
||
// Performing breadth-first search (BFS) | ||
|
||
// descendantMap is a "visited" set, to ensure we do not | ||
// traverse into nodes we once visited | ||
descendantMap := map[[32]byte]struct{}{root: {}} | ||
|
||
// allDescendants is a list of all discovered nodes, | ||
// serving as both "queue" to be iterated over during BFS, | ||
// and as a list of all nodes visited at the end of | ||
// BFS iteration | ||
allDescendants := []BitswapBlockLink{root} | ||
viewBlockF := func(b []byte) error { | ||
links, _, err := ReadBitswapBlock(b) | ||
if err == nil { | ||
for _, l := range links { | ||
var l2 BitswapBlockLink | ||
copy(l2[:], l[:]) | ||
_, has := descendantMap[l2] | ||
// Checking if the nodes was visited before | ||
if !has { | ||
descendantMap[l2] = struct{}{} | ||
// Add an item to BFS queue | ||
allDescendants = append(allDescendants, l2) | ||
} | ||
} | ||
} | ||
return err | ||
} | ||
// Iteration is done via index-based loop, because underlying | ||
// array gets extended during iteration, and regular iterator | ||
// wouldn't see these changes | ||
for i := 0; i < len(allDescendants); i++ { | ||
block := allDescendants[i] | ||
if err := bs.ViewBlock(block, viewBlockF); err != nil && !isBlockNotFound(block, err) { | ||
return tag, err | ||
} | ||
} | ||
if err := bs.DeleteBlocks(allDescendants); err != nil { | ||
return tag, err | ||
} | ||
return tag, bs.DeleteStatus(root) | ||
} |
Oops, something went wrong.