Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stack overflow while deleting a key from the tree #56

Open
resam72 opened this issue May 24, 2024 · 1 comment
Open

stack overflow while deleting a key from the tree #56

resam72 opened this issue May 24, 2024 · 1 comment

Comments

@resam72
Copy link

resam72 commented May 24, 2024

i'm writing a kind of MFU cache

i'm using the KCounter where the KCounter.value is the frequency of the KCounter.key

the tree holds only N keys with the highest frequency , when there is no more room left the key with the minimal frequency will be dropped

running this code will result in runtime error

const maxCacheSize = 3

type KCounter struct {
	key   string
	value int
}

func (t KCounter) Less(than btree.Item) bool {
	counter := than.(KCounter)
	if t.key < counter.key {
		return true
	}
	return t.value < counter.value
}

func Test_B(t *testing.T) {

	put := func(t *btree.BTree, itemByKey map[string]KCounter, kc KCounter) bool {

		item, ok := itemByKey[kc.key]
		if ok {
			//update the value by re-inserting it
			t.Delete(item)
			t.ReplaceOrInsert(kc)
			itemByKey[kc.key] = kc
			return true
		}
		if t.Len() >= maxCacheSize {
			smallestItem := t.Min().(KCounter)
			if kc.value < smallestItem.value {
				//dont add group that have values that are smaller than the smallest elem in tree
				return false
			}
			t.DeleteMin()
		}
		t.ReplaceOrInsert(kc)
		itemByKey[kc.key] = kc
		return true

	}

	itemByKey := make(map[string]KCounter)
	tree := btree.New(15)

	for i := 0; i < 100000; i++ {
		put(tree, itemByKey, KCounter{strconv.Itoa(i % 20), i % 10})
	}
}

the error

/opt/homebrew/opt/go/libexec/bin/go tool test2json -t /Users/igadassi/Library/Caches/JetBrains/GoLand2023.3/tmp/GoLand/___Test_B_in_xdr_panw_ipl_internal_dml_cronus_throttler.test -test.v -test.paniconexit0 -test.run ^\QTest_B\E$
=== RUN   Test_B
runtime: goroutine stack exceeds 1000000000-byte limit
runtime: sp=0x140202e0350 stack=[0x140202e0000, 0x140402e0000]
fatal error: stack overflow

runtime stack:
runtime.throw({0x10532ec2f?, 0x200000008?})
	/opt/homebrew/opt/go/libexec/src/runtime/panic.go:1077 +0x40 fp=0x16ae62690 sp=0x16ae62660 pc=0x104fd6af0
runtime.newstack()
	/opt/homebrew/opt/go/libexec/src/runtime/stack.go:1107 +0x458 fp=0x16ae62840 sp=0x16ae62690 pc=0x104ff1f38
runtime.morestack()
	/opt/homebrew/opt/go/libexec/src/runtime/asm_arm64.s:316 +0x70 fp=0x16ae62840 sp=0x16ae62840 pc=0x10500b7b0

goroutine 22 [running]:
sort.Search(0x8?, 0x140202e0398)
	/opt/homebrew/opt/go/libexec/src/sort/search.go:58 +0x8c fp=0x140202e0350 sp=0x140202e0350 pc=0x10503af7c
github.com/google/btree.items[...].find(0x0, {0x1054aa628, 0x14000285f98?}, 0x1054a7a78?)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:215 +0x78 fp=0x140202e03e0 sp=0x140202e0350 pc=0x1052e8118
github.com/google/btree.(*node[...]).remove(0x1054b56c0, {0x1054aa628, 0x14000285f98}, 0xe, 0x0)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:384 +0x1cc fp=0x140202e0470 sp=0x140202e03e0 pc=0x1052e697c
github.com/google/btree.(*node[...]).growChildAndRemove(0x1054b56c0, 0x1, {0x1054aa628, 0x14000285f98}, 0xe, 0x1054a7a78)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:471 +0xd3c fp=0x140202e05b0 sp=0x140202e0470 pc=0x1052e663c
github.com/google/btree.(*node[...]).remove(0x1054b56c0, {0x1054aa628, 0x14000285f98}, 0xe, 0x0)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:396 +0x45c fp=0x140202e0640 sp=0x140202e05b0 pc=0x1052e6c0c
github.com/google/btree.(*node[...]).growChildAndRemove(0x1054b56c0, 0x0, {0x1054aa628, 0x14000285f98}, 0xe, 0x1054a7a78)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:471 +0xd3c fp=0x140202e0780 sp=0x140202e0640 pc=0x1052e663c
github.com/google/btree.(*node[...]).remove(0x1054b56c0, {0x1054aa628, 0x14000285f98}, 0xe, 0x0)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:396 +0x45c fp=0x140202e0810 sp=0x140202e0780 pc=0x1052e6c0c
github.com/google/btree.(*node[...]).growChildAndRemove(0x1054b56c0, 0x1, {0x1054aa628, 0x14000285f98}, 0xe, 0x1054a7a78)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:471 +0xd3c fp=0x140202e0950 sp=0x140202e0810 pc=0x1052e663c
github.com/google/btree.(*node[...]).remove(0x1054b56c0, {0x1054aa628, 0x14000285f98}, 0xe, 0x0)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:396 +0x45c fp=0x140202e09e0 sp=0x140202e0950 pc=0x1052e6c0c
github.com/google/btree.(*node[...]).growChildAndRemove(0x1054b56c0, 0x0, {0x1054aa628, 0x14000285f98}, 0xe, 0x1054a7a78)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:471 +0xd3c fp=0x140202e0b20 sp=0x140202e09e0 pc=0x1052e663c
github.com/google/btree.(*node[...]).remove(0x1054b56c0, {0x1054aa628, 0x14000285f98}, 0xe, 0x0)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:396 +0x45c fp=0x140202e0bb0 sp=0x140202e0b20 pc=0x1052e6c0c
github.com/google/btree.(*node[...]).growChildAndRemove(0x1054b56c0, 0x1, {0x1054aa628, 0x14000285f98}, 0xe, 0x1054a7a78)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:471 +0xd3c fp=0x140202e0cf0 sp=0x140202e0bb0 pc=0x1052e663c
github.com/google/btree.(*node[...]).remove(0x1054b56c0, {0x1054aa628, 0x14000285f98}, 0xe, 0x0)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:396 +0x45c fp=0x140202e0d80 sp=0x140202e0cf0 pc=0x1052e6c0c
github.com/google/btree.(*node[...]).growChildAndRemove(0x1054b56c0, 0x0, {0x1054aa628, 0x14000285f98}, 0xe, 0x1054a7a78)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:471 +0xd3c fp=0x140202e0ec0 sp=0x140202e0d80 pc=0x1052e663c
github.com/google/btree.(*node[...]).remove(0x1054b56c0, {0x1054aa628, 0x14000285f98}, 0xe, 0x0)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:396 +0x45c fp=0x140202e0f50 sp=0x140202e0ec0 pc=0x1052e6c0c
github.com/google/btree.(*node[...]).growChildAndRemove(0x1054b56c0, 0x1, {0x1054aa628, 0x14000285f98}, 0xe, 0x1054a7a78)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:471 +0xd3c fp=0x140202e1090 sp=0x140202e0f50 pc=0x1052e663c
github.com/google/btree.(*node[...]).remove(0x1054b56c0, {0x1054aa628, 0x14000285f98}, 0xe, 0x0)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:396 +0x45c fp=0x140202e1120 sp=0x140202e1090 pc=0x1052e6c0c
github.com/google/btree.(*node[...]).growChildAndRemove(0x1054b56c0, 0x0, {0x1054aa628, 0x14000285f98}, 0xe, 0x1054a7a78)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:471 +0xd3c fp=0x140202e1260 sp=0x140202e1120 pc=0x1052e663c
github.com/google/btree.(*node[...]).remove(0x1054b56c0, {0x1054aa628, 0x14000285f98}, 0xe, 0x0)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:396 +0x45c fp=0x140202e12f0 sp=0x140202e1260 pc=0x1052e6c0c
github.com/google/btree.(*node[...]).growChildAndRemove(0x1054b56c0, 0x1, {0x1054aa628, 0x14000285f98}, 0xe, 0x1054a7a78)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:471 +0xd3c fp=0x140202e1430 sp=0x140202e12f0 pc=0x1052e663c
github.com/google/btree.(*node[...]).remove(0x1054b56c0, {0x1054aa628, 0x14000285f98}, 0xe, 0x0)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:396 +0x45c fp=0x140202e14c0 sp=0x140202e1430 pc=0x1052e6c0c
github.com/google/btree.(*node[...]).growChildAndRemove(0x1054b56c0, 0x0, {0x1054aa628, 0x14000285f98}, 0xe, 0x1054a7a78)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:471 +0xd3c fp=0x140202e1600 sp=0x140202e14c0 pc=0x1052e663c
github.com/google/btree.(*node[...]).remove(0x1054b56c0, {0x1054aa628, 0x14000285f98}, 0xe, 0x0)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:396 +0x45c fp=0x140202e1690 sp=0x140202e1600 pc=0x1052e6c0c
github.com/google/btree.(*node[...]).growChildAndRemove(0x1054b56c0, 0x1, {0x1054aa628, 0x14000285f98}, 0xe, 0x1054a7a78)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:471 +0xd3c fp=0x140202e17d0 sp=0x140202e1690 pc=0x1052e663c
github.com/google/btree.(*node[...]).remove(0x1054b56c0, {0x1054aa628, 0x14000285f98}, 0xe, 0x0)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:396 +0x45c fp=0x140202e1860 sp=0x140202e17d0 pc=0x1052e6c0c
github.com/google/btree.(*node[...]).growChildAndRemove(0x1054b56c0, 0x0, {0x1054aa628, 0x14000285f98}, 0xe, 0x1054a7a78)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:471 +0xd3c fp=0x140202e19a0 sp=0x140202e1860 pc=0x1052e663c
github.com/google/btree.(*node[...]).remove(0x1054b56c0, {0x1054aa628, 0x14000285f98}, 0xe, 0x0)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:396 +0x45c fp=0x140202e1a30 sp=0x140202e19a0 pc=0x1052e6c0c
github.com/google/btree.(*node[...]).growChildAndRemove(0x1054b56c0, 0x1, {0x1054aa628, 0x14000285f98}, 0xe, 0x1054a7a78)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:471 +0xd3c fp=0x140202e1b70 sp=0x140202e1a30 pc=0x1052e663c
github.com/google/btree.(*node[...]).remove(0x1054b56c0, {0x1054aa628, 0x14000285f98}, 0xe, 0x0)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:396 +0x45c fp=0x140202e1c00 sp=0x140202e1b70 pc=0x1052e6c0c
github.com/google/btree.(*node[...]).growChildAndRemove(0x1054b56c0, 0x0, {0x1054aa628, 0x14000285f98}, 0xe, 0x1054a7a78)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:471 +0xd3c fp=0x140202e1d40 sp=0x140202e1c00 pc=0x1052e663c
github.com/google/btree.(*node[...]).remove(0x1054b56c0, {0x1054aa628, 0x14000285f98}, 0xe, 0x0)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:396 +0x45c fp=0x140202e1dd0 sp=0x140202e1d40 pc=0x1052e6c0c
github.com/google/btree.(*node[...]).growChildAndRemove(0x1054b56c0, 0x1, {0x1054aa628, 0x14000285f98}, 0xe, 0x1054a7a78)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:471 +0xd3c fp=0x140202e1f10 sp=0x140202e1dd0 pc=0x1052e663c
github.com/google/btree.(*node[...]).remove(0x1054b56c0, {0x1054aa628, 0x14000285f98}, 0xe, 0x0)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:396 +0x45c fp=0x140202e1fa0 sp=0x140202e1f10 pc=0x1052e6c0c
github.com/google/btree.(*node[...]).growChildAndRemove(0x1054b56c0, 0x0, {0x1054aa628, 0x14000285f98}, 0xe, 0x1054a7a78)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:471 +0xd3c fp=0x140202e20e0 sp=0x140202e1fa0 pc=0x1052e663c
github.com/google/btree.(*node[...]).remove(0x1054b56c0, {0x1054aa628, 0x14000285f98}, 0xe, 0x0)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:396 +0x45c fp=0x140202e2170 sp=0x140202e20e0 pc=0x1052e6c0c
github.com/google/btree.(*node[...]).growChildAndRemove(0x1054b56c0, 0x1, {0x1054aa628, 0x14000285f98}, 0xe, 0x1054a7a78)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:471 +0xd3c fp=0x140202e22b0 sp=0x140202e2170 pc=0x1052e663c
github.com/google/btree.(*node[...]).remove(0x1054b56c0, {0x1054aa628, 0x14000285f98}, 0xe, 0x0)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:396 +0x45c fp=0x140202e2340 sp=0x140202e22b0 pc=0x1052e6c0c
github.com/google/btree.(*node[...]).growChildAndRemove(0x1054b56c0, 0x0, {0x1054aa628, 0x14000285f98}, 0xe, 0x1054a7a78)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:471 +0xd3c fp=0x140202e2480 sp=0x140202e2340 pc=0x1052e663c
github.com/google/btree.(*node[...]).remove(0x1054b56c0, {0x1054aa628, 0x14000285f98}, 0xe, 0x0)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:396 +0x45c fp=0x140202e2510 sp=0x140202e2480 pc=0x1052e6c0c
github.com/google/btree.(*node[...]).growChildAndRemove(0x1054b56c0, 0x1, {0x1054aa628, 0x14000285f98}, 0xe, 0x1054a7a78)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:471 +0xd3c fp=0x140202e2650 sp=0x140202e2510 pc=0x1052e663c
github.com/google/btree.(*node[...]).remove(0x1054b56c0, {0x1054aa628, 0x14000285f98}, 0xe, 0x0)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:396 +0x45c fp=0x140202e26e0 sp=0x140202e2650 pc=0x1052e6c0c
github.com/google/btree.(*node[...]).growChildAndRemove(0x1054b56c0, 0x0, {0x1054aa628, 0x14000285f98}, 0xe, 0x1054a7a78)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:471 +0xd3c fp=0x140202e2820 sp=0x140202e26e0 pc=0x1052e663c
github.com/google/btree.(*node[...]).remove(0x1054b56c0, {0x1054aa628, 0x14000285f98}, 0xe, 0x0)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:396 +0x45c fp=0x140202e28b0 sp=0x140202e2820 pc=0x1052e6c0c
github.com/google/btree.(*node[...]).growChildAndRemove(0x1054b56c0, 0x1, {0x1054aa628, 0x14000285f98}, 0xe, 0x1054a7a78)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:471 +0xd3c fp=0x140202e29f0 sp=0x140202e28b0 pc=0x1052e663c
github.com/google/btree.(*node[...]).remove(0x1054b56c0, {0x1054aa628, 0x14000285f98}, 0xe, 0x0)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:396 +0x45c fp=0x140202e2a80 sp=0x140202e29f0 pc=0x1052e6c0c
github.com/google/btree.(*node[...]).growChildAndRemove(0x1054b56c0, 0x0, {0x1054aa628, 0x14000285f98}, 0xe, 0x1054a7a78)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:471 +0xd3c fp=0x140202e2bc0 sp=0x140202e2a80 pc=0x1052e663c
github.com/google/btree.(*node[...]).remove(0x1054b56c0, {0x1054aa628, 0x14000285f98}, 0xe, 0x0)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:396 +0x45c fp=0x140202e2c50 sp=0x140202e2bc0 pc=0x1052e6c0c
github.com/google/btree.(*node[...]).growChildAndRemove(0x1054b56c0, 0x1, {0x1054aa628, 0x14000285f98}, 0xe, 0x1054a7a78)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:471 +0xd3c fp=0x140202e2d90 sp=0x140202e2c50 pc=0x1052e663c
github.com/google/btree.(*node[...]).remove(0x1054b56c0, {0x1054aa628, 0x14000285f98}, 0xe, 0x0)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:396 +0x45c fp=0x140202e2e20 sp=0x140202e2d90 pc=0x1052e6c0c
github.com/google/btree.(*node[...]).growChildAndRemove(0x1054b56c0, 0x0, {0x1054aa628, 0x14000285f98}, 0xe, 0x1054a7a78)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:471 +0xd3c fp=0x140202e2f60 sp=0x140202e2e20 pc=0x1052e663c
...2314001 frames elided...
github.com/google/btree.(*node[...]).growChildAndRemove(0x1054b56c0, 0x1, {0x1054aa628, 0x14000285f98}, 0xe, 0x1054a7a78)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:471 +0xd3c fp=0x140402dd7b0 sp=0x140402dd670 pc=0x1052e663c
github.com/google/btree.(*node[...]).remove(0x1054b56c0, {0x1054aa628, 0x14000285f98}, 0xe, 0x0)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:396 +0x45c fp=0x140402dd840 sp=0x140402dd7b0 pc=0x1052e6c0c
github.com/google/btree.(*node[...]).growChildAndRemove(0x1054b56c0, 0x0, {0x1054aa628, 0x14000285f98}, 0xe, 0x1054a7a78)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:471 +0xd3c fp=0x140402dd980 sp=0x140402dd840 pc=0x1052e663c
github.com/google/btree.(*node[...]).remove(0x1054b56c0, {0x1054aa628, 0x14000285f98}, 0xe, 0x0)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:396 +0x45c fp=0x140402dda10 sp=0x140402dd980 pc=0x1052e6c0c
github.com/google/btree.(*node[...]).growChildAndRemove(0x1054b56c0, 0x1, {0x1054aa628, 0x14000285f98}, 0xe, 0x1054a7a78)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:471 +0xd3c fp=0x140402ddb50 sp=0x140402dda10 pc=0x1052e663c
github.com/google/btree.(*node[...]).remove(0x1054b56c0, {0x1054aa628, 0x14000285f98}, 0xe, 0x0)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:396 +0x45c fp=0x140402ddbe0 sp=0x140402ddb50 pc=0x1052e6c0c
github.com/google/btree.(*node[...]).growChildAndRemove(0x1054b56c0, 0x0, {0x1054aa628, 0x14000285f98}, 0xe, 0x1054a7a78)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:471 +0xd3c fp=0x140402ddd20 sp=0x140402ddbe0 pc=0x1052e663c
github.com/google/btree.(*node[...]).remove(0x1054b56c0, {0x1054aa628, 0x14000285f98}, 0xe, 0x0)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:396 +0x45c fp=0x140402dddb0 sp=0x140402ddd20 pc=0x1052e6c0c
github.com/google/btree.(*node[...]).growChildAndRemove(0x1054b56c0, 0x1, {0x1054aa628, 0x14000285f98}, 0xe, 0x1054a7a78)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:471 +0xd3c fp=0x140402ddef0 sp=0x140402dddb0 pc=0x1052e663c
github.com/google/btree.(*node[...]).remove(0x1054b56c0, {0x1054aa628, 0x14000285f98}, 0xe, 0x0)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:396 +0x45c fp=0x140402ddf80 sp=0x140402ddef0 pc=0x1052e6c0c
github.com/google/btree.(*node[...]).growChildAndRemove(0x1054b56c0, 0x0, {0x1054aa628, 0x14000285f98}, 0xe, 0x1054a7a78)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:471 +0xd3c fp=0x140402de0c0 sp=0x140402ddf80 pc=0x1052e663c
github.com/google/btree.(*node[...]).remove(0x1054b56c0, {0x1054aa628, 0x14000285f98}, 0xe, 0x0)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:396 +0x45c fp=0x140402de150 sp=0x140402de0c0 pc=0x1052e6c0c
github.com/google/btree.(*node[...]).growChildAndRemove(0x1054b56c0, 0x1, {0x1054aa628, 0x14000285f98}, 0xe, 0x1054a7a78)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:471 +0xd3c fp=0x140402de290 sp=0x140402de150 pc=0x1052e663c
github.com/google/btree.(*node[...]).remove(0x1054b56c0, {0x1054aa628, 0x14000285f98}, 0xe, 0x0)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:396 +0x45c fp=0x140402de320 sp=0x140402de290 pc=0x1052e6c0c
github.com/google/btree.(*node[...]).growChildAndRemove(0x1054b56c0, 0x0, {0x1054aa628, 0x14000285f98}, 0xe, 0x1054a7a78)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:471 +0xd3c fp=0x140402de460 sp=0x140402de320 pc=0x1052e663c
github.com/google/btree.(*node[...]).remove(0x1054b56c0, {0x1054aa628, 0x14000285f98}, 0xe, 0x0)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:396 +0x45c fp=0x140402de4f0 sp=0x140402de460 pc=0x1052e6c0c
github.com/google/btree.(*node[...]).growChildAndRemove(0x1054b56c0, 0x1, {0x1054aa628, 0x14000285f98}, 0xe, 0x1054a7a78)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:471 +0xd3c fp=0x140402de630 sp=0x140402de4f0 pc=0x1052e663c
github.com/google/btree.(*node[...]).remove(0x1054b56c0, {0x1054aa628, 0x14000285f98}, 0xe, 0x0)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:396 +0x45c fp=0x140402de6c0 sp=0x140402de630 pc=0x1052e6c0c
github.com/google/btree.(*node[...]).growChildAndRemove(0x1054b56c0, 0x0, {0x1054aa628, 0x14000285f98}, 0xe, 0x1054a7a78)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:471 +0xd3c fp=0x140402de800 sp=0x140402de6c0 pc=0x1052e663c
github.com/google/btree.(*node[...]).remove(0x1054b56c0, {0x1054aa628, 0x14000285f98}, 0xe, 0x0)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:396 +0x45c fp=0x140402de890 sp=0x140402de800 pc=0x1052e6c0c
github.com/google/btree.(*node[...]).growChildAndRemove(0x1054b56c0, 0x1, {0x1054aa628, 0x14000285f98}, 0xe, 0x1054a7a78)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:471 +0xd3c fp=0x140402de9d0 sp=0x140402de890 pc=0x1052e663c
github.com/google/btree.(*node[...]).remove(0x1054b56c0, {0x1054aa628, 0x14000285f98}, 0xe, 0x0)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:396 +0x45c fp=0x140402dea60 sp=0x140402de9d0 pc=0x1052e6c0c
github.com/google/btree.(*node[...]).growChildAndRemove(0x1054b56c0, 0x0, {0x1054aa628, 0x14000285f98}, 0xe, 0x1054a7a78)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:471 +0xd3c fp=0x140402deba0 sp=0x140402dea60 pc=0x1052e663c
github.com/google/btree.(*node[...]).remove(0x1054b56c0, {0x1054aa628, 0x14000285f98}, 0xe, 0x0)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:396 +0x45c fp=0x140402dec30 sp=0x140402deba0 pc=0x1052e6c0c
github.com/google/btree.(*node[...]).growChildAndRemove(0x1054b56c0, 0x1, {0x1054aa628, 0x14000285f98}, 0xe, 0x1054a7a78)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:471 +0xd3c fp=0x140402ded70 sp=0x140402dec30 pc=0x1052e663c
github.com/google/btree.(*node[...]).remove(0x1054b56c0, {0x1054aa628, 0x14000285f98}, 0xe, 0x0)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:396 +0x45c fp=0x140402dee00 sp=0x140402ded70 pc=0x1052e6c0c
github.com/google/btree.(*node[...]).growChildAndRemove(0x1054b56c0, 0x0, {0x1054aa628, 0x14000285f98}, 0xe, 0x1054a7a78)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:471 +0xd3c fp=0x140402def40 sp=0x140402dee00 pc=0x1052e663c
github.com/google/btree.(*node[...]).remove(0x1054b56c0, {0x1054aa628, 0x14000285f98}, 0xe, 0x0)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:396 +0x45c fp=0x140402defd0 sp=0x140402def40 pc=0x1052e6c0c
github.com/google/btree.(*node[...]).growChildAndRemove(0x1054b56c0, 0x1, {0x1054aa628, 0x14000285f98}, 0xe, 0x1054a7a78)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:471 +0xd3c fp=0x140402df110 sp=0x140402defd0 pc=0x1052e663c
github.com/google/btree.(*node[...]).remove(0x1054b56c0, {0x1054aa628, 0x14000285f98}, 0xe, 0x0)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:396 +0x45c fp=0x140402df1a0 sp=0x140402df110 pc=0x1052e6c0c
github.com/google/btree.(*node[...]).growChildAndRemove(0x1054b56c0, 0x0, {0x1054aa628, 0x14000285f98}, 0xe, 0x1054a7a78)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:471 +0xd3c fp=0x140402df2e0 sp=0x140402df1a0 pc=0x1052e663c
github.com/google/btree.(*node[...]).remove(0x1054b56c0, {0x1054aa628, 0x14000285f98}, 0xe, 0x0)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:396 +0x45c fp=0x140402df370 sp=0x140402df2e0 pc=0x1052e6c0c
github.com/google/btree.(*node[...]).growChildAndRemove(0x1054b56c0, 0x1, {0x1054aa628, 0x14000285f98}, 0xe, 0x1054a7a78)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:471 +0xd3c fp=0x140402df4b0 sp=0x140402df370 pc=0x1052e663c
github.com/google/btree.(*node[...]).remove(0x1054b56c0, {0x1054aa628, 0x14000285f98}, 0xe, 0x0)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:396 +0x45c fp=0x140402df540 sp=0x140402df4b0 pc=0x1052e6c0c
github.com/google/btree.(*node[...]).growChildAndRemove(0x1054b56c0, 0x0, {0x1054aa628, 0x14000285f98}, 0xe, 0x1054a7a78)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:471 +0xd3c fp=0x140402df680 sp=0x140402df540 pc=0x1052e663c
github.com/google/btree.(*node[...]).remove(0x1054b56c0, {0x1054aa628, 0x14000285f98}, 0xe, 0x0)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:396 +0x45c fp=0x140402df710 sp=0x140402df680 pc=0x1052e6c0c
github.com/google/btree.(*node[...]).growChildAndRemove(0x1054b56c0, 0x1, {0x1054aa628, 0x14000285f98}, 0xe, 0x1054a7a78)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:471 +0xd3c fp=0x140402df850 sp=0x140402df710 pc=0x1052e663c
github.com/google/btree.(*node[...]).remove(0x1054b56c0, {0x1054aa628, 0x14000285f98}, 0xe, 0x0)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:396 +0x45c fp=0x140402df8e0 sp=0x140402df850 pc=0x1052e6c0c
github.com/google/btree.(*node[...]).growChildAndRemove(0x1054b56c0, 0x0, {0x1054aa628, 0x14000285f98}, 0xe, 0x1054a7a78)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:471 +0xd3c fp=0x140402dfa20 sp=0x140402df8e0 pc=0x1052e663c
github.com/google/btree.(*node[...]).remove(0x1054b56c0, {0x1054aa628, 0x14000285f98}, 0xe, 0x0)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:396 +0x45c fp=0x140402dfab0 sp=0x140402dfa20 pc=0x1052e6c0c
github.com/google/btree.(*node[...]).growChildAndRemove(0x1054b56c0, 0x1, {0x1054aa628, 0x14000285f98}, 0xe, 0x1054a7a78)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:471 +0xd3c fp=0x140402dfbf0 sp=0x140402dfab0 pc=0x1052e663c
github.com/google/btree.(*node[...]).remove(0x1054b56c0, {0x1054aa628, 0x14000285f98}, 0xe, 0x0)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:396 +0x45c fp=0x140402dfc80 sp=0x140402dfbf0 pc=0x1052e6c0c
github.com/google/btree.(*BTreeG[...]).deleteItem(0x1054b5400, {0x1054aa628, 0x14000285f98}, 0x14000285f98)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:734 +0xa4 fp=0x140402dfce0 sp=0x140402dfc80 pc=0x1052e8864
github.com/google/btree.(*BTreeG[...]).Delete(...)
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:712
github.com/google/btree.(*BTree).Delete(0x105459520?, {0x1054aa628?, 0x14000285f98?})
	/Users/igadassi/.gvm/pkgsets/go1.21.7/global/pkg/mod/github.com/google/[email protected]/btree_generic.go:956 +0x40 fp=0x140402dfd20 sp=0x140402dfce0 pc=0x1052e5020
xdr.panw/ipl/internal/dml/cronus/throttler.Test_B.func1(0x140001fc9e0, 0x0?, {{0x10534714c, 0x2}, 0x5})
	/Users/igadassi/gonzo/src/xdr.panw/ipl/internal/dml/cronus/throttler/throttler_test.go:361 +0xa8 fp=0x140402dfd70 sp=0x140402dfd20 pc=0x105328e58
xdr.panw/ipl/internal/dml/cronus/throttler.Test_B(0x14000268001?)
	/Users/igadassi/gonzo/src/xdr.panw/ipl/internal/dml/cronus/throttler/throttler_test.go:384 +0x1bc fp=0x140402dff60 sp=0x140402dfd70 pc=0x105328d7c
testing.tRunner(0x140001a7860, 0x1054a6fa8)
	/opt/homebrew/opt/go/libexec/src/testing/testing.go:1595 +0xe8 fp=0x140402dffb0 sp=0x140402dff60 pc=0x1050b7908
testing.(*T).Run.func1()
	/opt/homebrew/opt/go/libexec/src/testing/testing.go:1648 +0x2c fp=0x140402dffd0 sp=0x140402dffb0 pc=0x1050b871c
runtime.goexit()
	/opt/homebrew/opt/go/libexec/src/runtime/asm_arm64.s:1197 +0x4 fp=0x140402dffd0 sp=0x140402dffd0 pc=0x10500dca4
created by testing.(*T).Run in goroutine 1
	/opt/homebrew/opt/go/libexec/src/testing/testing.go:1648 +0x33c

goroutine 1 [chan receive]:
runtime.gopark(0x1400024d9b8?, 0x104fac00c?, 0x78?, 0xaf?, 0x18?)
	/opt/homebrew/opt/go/libexec/src/runtime/proc.go:398 +0xc8 fp=0x1400024d940 sp=0x1400024d920 pc=0x104fd97b8
runtime.chanrecv(0x140002383f0, 0x1400024da3f, 0x1)
	/opt/homebrew/opt/go/libexec/src/runtime/chan.go:583 +0x414 fp=0x1400024d9c0 sp=0x1400024d940 pc=0x104fa52a4
runtime.chanrecv1(0x10577c9e0?, 0x10540bcc0?)
	/opt/homebrew/opt/go/libexec/src/runtime/chan.go:442 +0x14 fp=0x1400024d9f0 sp=0x1400024d9c0 pc=0x104fa4e54
testing.(*T).Run(0x140001a76c0, {0x10532b6d3?, 0x90133395fa5?}, 0x1054a6fa8)
	/opt/homebrew/opt/go/libexec/src/testing/testing.go:1649 +0x350 fp=0x1400024dab0 sp=0x1400024d9f0 pc=0x1050b85e0
testing.runTests.func1(0x14000265d70?)
	/opt/homebrew/opt/go/libexec/src/testing/testing.go:2054 +0x48 fp=0x1400024db00 sp=0x1400024dab0 pc=0x1050ba408
testing.tRunner(0x140001a76c0, 0x1400024dc28)
	/opt/homebrew/opt/go/libexec/src/testing/testing.go:1595 +0xe8 fp=0x1400024db50 sp=0x1400024db00 pc=0x1050b7908
testing.runTests(0x1400025e8c0?, {0x105775000, 0x6, 0x6}, {0x40?, 0x10546faa0?, 0x0?})
	/opt/homebrew/opt/go/libexec/src/testing/testing.go:2052 +0x3b4 fp=0x1400024dc50 sp=0x1400024db50 pc=0x1050ba304
testing.(*M).Run(0x1400025e8c0)
	/opt/homebrew/opt/go/libexec/src/testing/testing.go:1925 +0x538 fp=0x1400024dea0 sp=0x1400024dc50 pc=0x1050b8fd8
main.main()
	_testmain.go:67 +0x1a8 fp=0x1400024df30 sp=0x1400024dea0 pc=0x10532a648
runtime.main()
	/opt/homebrew/opt/go/libexec/src/runtime/proc.go:267 +0x2bc fp=0x1400024dfd0 sp=0x1400024df30 pc=0x104fd935c
runtime.goexit()
	/opt/homebrew/opt/go/libexec/src/runtime/asm_arm64.s:1197 +0x4 fp=0x1400024dfd0 sp=0x1400024dfd0 pc=0x10500dca4

goroutine 2 [force gc (idle)]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
	/opt/homebrew/opt/go/libexec/src/runtime/proc.go:398 +0xc8 fp=0x1400005af90 sp=0x1400005af70 pc=0x104fd97b8
runtime.goparkunlock(...)
	/opt/homebrew/opt/go/libexec/src/runtime/proc.go:404
runtime.forcegchelper()
	/opt/homebrew/opt/go/libexec/src/runtime/proc.go:322 +0xb8 fp=0x1400005afd0 sp=0x1400005af90 pc=0x104fd9618
runtime.goexit()
	/opt/homebrew/opt/go/libexec/src/runtime/asm_arm64.s:1197 +0x4 fp=0x1400005afd0 sp=0x1400005afd0 pc=0x10500dca4
created by runtime.init.6 in goroutine 1
	/opt/homebrew/opt/go/libexec/src/runtime/proc.go:310 +0x24

goroutine 3 [GC sweep wait]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
	/opt/homebrew/opt/go/libexec/src/runtime/proc.go:398 +0xc8 fp=0x1400005b760 sp=0x1400005b740 pc=0x104fd97b8
runtime.goparkunlock(...)
	/opt/homebrew/opt/go/libexec/src/runtime/proc.go:404
runtime.bgsweep(0x0?)
	/opt/homebrew/opt/go/libexec/src/runtime/mgcsweep.go:280 +0xa0 fp=0x1400005b7b0 sp=0x1400005b760 pc=0x104fc3f50
runtime.gcenable.func1()
	/opt/homebrew/opt/go/libexec/src/runtime/mgc.go:200 +0x28 fp=0x1400005b7d0 sp=0x1400005b7b0 pc=0x104fb8a48
runtime.goexit()
	/opt/homebrew/opt/go/libexec/src/runtime/asm_arm64.s:1197 +0x4 fp=0x1400005b7d0 sp=0x1400005b7d0 pc=0x10500dca4
created by runtime.gcenable in goroutine 1
	/opt/homebrew/opt/go/libexec/src/runtime/mgc.go:200 +0x6c

goroutine 4 [GC scavenge wait]:
runtime.gopark(0x1400007c000?, 0x1053d12f8?, 0x1?, 0x0?, 0x140000031e0?)
	/opt/homebrew/opt/go/libexec/src/runtime/proc.go:398 +0xc8 fp=0x1400005bf50 sp=0x1400005bf30 pc=0x104fd97b8
runtime.goparkunlock(...)
	/opt/homebrew/opt/go/libexec/src/runtime/proc.go:404
runtime.(*scavengerState).park(0x10577d520)
	/opt/homebrew/opt/go/libexec/src/runtime/mgcscavenge.go:425 +0x5c fp=0x1400005bf80 sp=0x1400005bf50 pc=0x104fc17fc
runtime.bgscavenge(0x0?)
	/opt/homebrew/opt/go/libexec/src/runtime/mgcscavenge.go:653 +0x44 fp=0x1400005bfb0 sp=0x1400005bf80 pc=0x104fc1d54
runtime.gcenable.func2()
	/opt/homebrew/opt/go/libexec/src/runtime/mgc.go:201 +0x28 fp=0x1400005bfd0 sp=0x1400005bfb0 pc=0x104fb89e8
runtime.goexit()
	/opt/homebrew/opt/go/libexec/src/runtime/asm_arm64.s:1197 +0x4 fp=0x1400005bfd0 sp=0x1400005bfd0 pc=0x10500dca4
created by runtime.gcenable in goroutine 1
	/opt/homebrew/opt/go/libexec/src/runtime/mgc.go:201 +0xac

goroutine 18 [finalizer wait]:
runtime.gopark(0xf780ec6195be80e2?, 0xa83c30d5eadc8e8f?, 0xc2?, 0xc6?, 0xb54ad9c0557f2d16?)
	/opt/homebrew/opt/go/libexec/src/runtime/proc.go:398 +0xc8 fp=0x1400005a580 sp=0x1400005a560 pc=0x104fd97b8
runtime.runfinq()
	/opt/homebrew/opt/go/libexec/src/runtime/mfinal.go:193 +0x108 fp=0x1400005a7d0 sp=0x1400005a580 pc=0x104fb7af8
runtime.goexit()
	/opt/homebrew/opt/go/libexec/src/runtime/asm_arm64.s:1197 +0x4 fp=0x1400005a7d0 sp=0x1400005a7d0 pc=0x10500dca4
created by runtime.createfing in goroutine 1
	/opt/homebrew/opt/go/libexec/src/runtime/mfinal.go:163 +0x80


Process finished with the exit code 1


@tsman
Copy link

tsman commented Sep 28, 2024

const maxCacheSize = 3

type KCounter struct {
	key   string
	value int
}

func (t *KCounter) Less(than btree.Item) bool {
	// 1. change pointer
	counter := than.(*KCounter)
	if t.key < counter.key {
		return true
	}
	return t.value < counter.value
}

func Test_B(t *testing.T) {

	put := func(tree *btree.BTree, itemByKey map[string]KCounter, kc KCounter) bool {

		_, ok := itemByKey[kc.key]
		if ok {
			//update the value by re-inserting it
			// 2. no need delete
			//tree.Delete(&item)
			tree.ReplaceOrInsert(&kc)
			itemByKey[kc.key] = kc
			return true
		}
		if tree.Len() >= maxCacheSize {
			smallestItem := tree.Min().(*KCounter)
			if kc.value < smallestItem.value {
				//dont add group that have values that are smaller than the smallest elem in tree
				return false
			}
			tree.DeleteMin()
		}
		tree.ReplaceOrInsert(&kc)
		itemByKey[kc.key] = kc
		return true

	}

	itemByKey := make(map[string]KCounter)
	tree := btree.New(15)

	for i := 0; i < 100000; i++ {
		put(tree, itemByKey, KCounter{strconv.Itoa(i % 20), i % 10})
	}
	// 3. use debug for result.
	t.Log("debug: see debug info")
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants