Giter Site home page Giter Site logo

fs2's Introduction

fs2 - File Structures 2

by Tim Henderson ([email protected])

Licensed under the GNU GPL version 3 or at your option any later version. If you need another licensing option please contact me directly.

What is this?

  1. A B+ Tree implementation
  2. A list implementation supporting O(1) Append, Pop, Get and Set operations.
  3. A command to generate type specific wrappers around the above structures. It's generic, in Go, kinda.
  4. A platform for implementing memory mapped high performance file structures in Go.

Why did you make this?

In my academic research some of the algorithms I work on (such as frequent subgraph mining) have exponential characteristics in their memory usage. In order to run these algorithms on larger data sets they need to be able to transparently cache less popular parts of the data to disk. However, in general it is best to keep as much data in memory as possible.

Of course, there are many options for such data stores. I could have used a off the shelf database, however I also want to explore ways to achieve higher performance than those solutions offer.

Have you worked on this type of system before?

I have! In the golang world I believe I was the first to implement a disk backed B+ Tree. Here is an early commit from my file-structures repository. Note the date: February 21, 2010. Go was made public in November of 2009 (the first weekly was November 06, 2009). I started work on the B+ Tree in January of 2010.

This particular experiment is a follow up to my work in the file-structures repository. I have used those structures successfully many times but I want to experiment with new ways of doing things to achieve better results. Besides my disk backed versions of these structures you can also find good implementations of in memory version in my data-structures repository.

Limitations

Currently, fs2 is only available for Linux. I am looking for assistance making a darwin (Mac OS) port and a Windows port. Please get in touch if you are interested and have a Mac or Windows PC.

B+ Tree

docs

This is a disk backed low level "key-value store". The closest thing similar to what it offers is Bolt DB. My blog post is a great place to start to learn more about the ubiquitous B+ Tree.

Features

  1. Variable length size key or fixed sized keys. Fixed sized keys should be kept relatively short, less than 1024 bytes (the shorter the better). Variable length keys can be up to 2^31 - 1 bytes long.

  2. Variable length values or fixed sized values. Fixed sized values should also be kept short, less than 1024 bytes. Variable length values can be up to 2^31 - 1 bytes long.

  3. Duplicate key support. Duplicates are kept out of the index and only occur in the leaves.

  4. Data is only written to disk when you tell it (or when need due to OS level page management).

  5. Simple (but low level) interface.

  6. Can operate in either a anonymous memory map or in a file backed memory map. If you plan to have a very large tree (even one that never needs to be persisted) it is recommend you use a file backed memory map. The OS treats pages in the file cache different than pages which are not backed by files.

  7. The command fs2-generic can generate a wrapper specialized to your data type. Typing saved! To use go install github.com/timtadh/fs2/fs2-generic. Get help with fs2-generic --help

Limitations

  1. Not thread safe and therefore no transactions which you only need with multiple threads.

  2. Maximum fixed key/value size is ~1350 bytes.

  3. Maximum variable length key/value size is 2^31 - 1

  4. This is not a database. You could make it into a database or build a database on top of it.

Quick Start

usage docs on godoc

Importing

import (
	"github.com/timtadh/fs2/bptree"
	"github.com/timtadh/fs2/fmap"
)

Creating a new B+ Tree (fixed key size, variable length value size).

bf, err := fmap.CreateBlockFile("/path/to/file")
if err != nil {
	log.Fatal(err)
}
defer bf.Close()
bpt, err := bptree.New(bf, 8, -1)
if err != nil {
	log.Fatal(err)
}
// do stuff with bpt

Opening a B+ Tree

bf, err := fmap.OpenBlockFile("/path/to/file")
if err != nil {
	log.Fatal(err)
}
defer bf.Close()
bpt, err := bptree.Open(bf)
if err != nil {
	log.Fatal(err)
}
// do stuff with bpt

Add a key/value pair. Note, since this is low level you have to serialize your keys and values. The length of the []byte representing the key must exactly match the key size of the B+ Tree. You can find out what that was set to by called bpt.KeySize()

import (
	"encoding/binary"
)

var key uint64 = 12
value := "hello world"
kBytes := make([]byte, 8)
binary.PutUvarint(kBytes, key)
err := bpt.Add(kBytes, []byte(value))
if err != nil {
	log.Fatal(err)
}

As you can see it can be a little verbose to serialize and de-serialize your keys and values. So be sure to wrap that up in utility functions or even to wrap the interface of the B+ Tree so that client code does not have to think about it.

Since a B+Tree is a "multi-map" meaning there may be more than one value per key. There is no "Get" method. To retrieve the values associated with a key use the Find method.

{
	var key, value []byte
	kvi, err := bpt.Find(kBytes)
	if err != nil {
		log.Fatal(err)
	}
	for key, value, err, kvi = kvi(); kvi != nil; key, value, err, kvi = kvi() {
		// do stuff with the keys and values
	}
	if err != nil {
		log.Fatal(err)
	}
}

That interface is easy to misuse if you do not check the error values as show in the example above. An easier interface is provided for all of the iterators (Range, Find, Keys, Values, Iterate) called the Do interface.

err = bpt.DoFind(kBytes, func(key, value []byte) error {
	// do stuff with the keys and values
	return nil
})
if err != nil {
	log.Fatal(err)
}

It is recommended that you always use the Do* interfaces. The other is provided if the cost of extra method calls is too high.

Removal is also slightly more complicated due to the duplicate keys. This example will remove all key/value pairs associated with the given key:

err = bpt.Remove(kBytes, func(value []byte) bool {
	return true
})
if err != nil {
	log.Fatal(err)
}

to remove just the one I added earlier do:

err = bpt.Remove(kBytes, func(v []byte) bool {
	return bytes.Equal(v, []byte(value))
})
if err != nil {
	log.Fatal(err)
}

That wraps up the basic usage. If you want to ensure that the bytes you have written are in fact on disk you have 2 options

  1. call bf.Sync() - Note this uses the async mmap interface under the hood. The bytes are not guaranteed to hit the disk after this returns but they will go there soon.

  2. call bf.Close()

MMList

docs

A Memory Mapped List. This list works more like a stack and less like a queue. It is not a good thing to build a job queue on. It is a good thing to build a large set of items which can be efficiently randomly sampled. It uses the same varchar system that the B+Tree uses so it can store variably sized items up to 2^31 - 1 bytes long.

Operations

  1. Size O(1)
  2. Append O(1)
  3. Pop O(1)
  4. Get O(1)
  5. Set O(1)
  6. Swap O(1)
  7. SwapDelete O(1)

I will consider implementing a Delete method. However, it will be O(n) since this is implemented a bit like an ArrayList under the hood. The actual way it works is there is a B+Tree which indexes to list index blocks. The list index blocks hold pointers (511 of them) to varchar locations. I considered having a restricted 2 level index but that would have limited the size of the list to a maximum of ~1 billion items which was uncomfortably small to me. In the future the implementation may change to use something more like an ISAM index which will be a bit more compact for this use case.

Quickstart

package main

import (
	"binary"
	"log"
)

import (
	"github.com/timtadh/fs2/fmap"
	"github.com/timtadh/fs2/mmlist"
)

func main() {
	file, err := fmap.CreateBlockFile("/tmp/file")
	if err != nil {
		log.Fatal(err)
	}
	defer file.Close()
	list, err := mmlist.New(file)
	if err != nil {
		log.Fatal(err)
	}
	idx, err := list.Append([]byte("hello"))
	if err != nil {
		log.Fatal(err)
	}
	if d, err := list.Get(idx); err != nil {
		log.Fatal(err)
	} else if !bytes.Equal([]byte("hello"), d) {
		log.Fatal("bytes where not hello")
	}
	if err := list.Set(idx, "bye!"); err != nil {
		log.Fatal(err)
	}
	if d, err := list.Get(idx); err != nil {
		log.Fatal(err)
	} else if !bytes.Equal([]byte("bye!"), d) {
		log.Fatal("bytes where not bye!")
	}
	if d, err := list.Pop(); err != nil {
		log.Fatal(err)
	} else if !bytes.Equal([]byte("bye!"), d) {
		log.Fatal("bytes where not bye!")
	}
}

fs2-generic

A command to generate type specialized wrappers around fs2 structures.

Since Go does not support generics and is not going to support generics anytime soon, this program will produce a wrapper specialized to the supplied types. It is essentially manually implementing type specialized generics in a very limited form. All fs2 structures operate on sequences of bytes, aka []byte, because they memory mapped and file backed structures. Therefore, the supplied types must be serializable to be used as keys and values in an fs2 structure.

How to install

Assuming you already have the code downloaded and in your GOPATH just run:

$ go install github.com/timtadh/fs2/fs2-generic

How to generate a wrapper for the B+ Tree

$ fs2-generic \
    --output=src/output/package/file.go \
    --package-name=package \
    bptree \
        --key-type=my/package/name/Type \
        --key-serializer=my/package/name/Func \
        --key-deserializer=my/package/name/Func \
        --value-type=my/package/name/Type \
        --value-serializer=my/package/name/Func \
        --value-deserializer=my/package/name/Func

How to generate a wrapper for the MMList

$ fs2-generic \
    --output=src/output/package/file.go \
    --package-name=package \
    mmlist \
        --item-type=my/package/name/Type \
        --item-serializer=my/package/name/Func \
        --item-deserializer=my/package/name/Func

Variations

Supplying a pointer type:

--key-type=*my/package/name/Type
--value-type=*my/package/name/Type

Serializer Type Signature (let T be a type parameter)

func(T) ([]byte)

Deserializer Type Signature (let T be a type parameter)

func([]byte) T

Fixed sized types can have their sizes specified with

--key-size=<# of bytes>
--value-size=<# of bytes>

If the generated file is going into the same package that the types and function are declared in one should drop the package specifiers

$ fs2-generic \
    --output=src/output/package/file.go \
    --package-name=package \
    bptree \
        --key-type=KeyType \
        --key-serializer=SerializeKey \
        --key-deserializer=DeserializeKey \
        --value-type=ValueType \
        --value-serializer=SerializeValue \
        --value-deserializer=DeserializeValue

If nil is not a valid "empty" value for your type (for instance it is an integer, a float, or a struct value) then your must supply a valid "empty" value. Here is an example of a tree with int32 keys and float64 values:

$ fs2-generic \
    --output=src/output/package/file.go \
    --package-name=package \
    bptree \
        --key-type=int32 \
        --key-size=4 \
        --key-empty=0 \
        --key-serializer=SerializeInt32 \
        --key-deserializer=DeserializeInt32 \
        --value-type=float64 \
        --value-size=8 \
        --value-empty=0.0 \
        --value-serializer=SerializeFloat64 \
        --value-deserializer=DeserializeFloat64

Using with go generate

The fs2-generic command can be used on conjunction with go generate. To do so simply create a .go file in the package where the generated code should live. For example, let's pretend that we want to create a B+Tree with 3 dimension integer points as keys and float64's as values. Lets create a package structure for that (assuming you are in the root of your $GOPATH)

mkdir ./src/edu/cwru/eecs/pointbptree/
touch ./src/edu/cwru/eecs/pointbptree/types.go

types.go should then have the point defined + functions for serialization. Below is the full example. Note the top line specifies how to generate the file ./src/edu/cwru/eecs/pointbptree/wrapper.go. To generate it run go generate edu/cwru/eecs/pointbptree.

//go:generate fs2-generic --output=wrapper.go --package-name=pointbptree bptree --key-type=*Point --key-size=12 --key-empty=nil --key-serializer=SerializePoint --key-deserializer=DeserializePoint --value-type=float64 --value-size=8 --value-empty=0.0 --value-serializer=SerializeFloat64 --value-deserializer=DeserializeFloat64
package pointbptree

import (
	"encoding/binary"
	"math"
)

type Point struct {
	X, Y, Z int32
}

func SerializePoint(p *Point) []byte {
	bytes := make([]byte, 4*3)
	binary.BigEndian.PutUint32(bytes[0:04], uint32(p.X))
	binary.BigEndian.PutUint32(bytes[4:08], uint32(p.Y))
	binary.BigEndian.PutUint32(bytes[8:12], uint32(p.Z))
	return bytes
}

func DeserializePoint(bytes []byte) *Point {
	return &Point{
		X: int32(binary.BigEndian.Uint32(bytes[0:04])),
		Y: int32(binary.BigEndian.Uint32(bytes[4:08])),
		Z: int32(binary.BigEndian.Uint32(bytes[8:12])),
	}
}

func SerializeFloat64(f float64) []byte {
	bytes := make([]byte, 8)
	binary.BigEndian.PutUint64(bytes, math.Float64bits(f))
	return bytes
}

func DeserializeFloat64(bytes []byte) float64 {
	return math.Float64frombits(binary.BigEndian.Uint64(bytes))
}

FMap

docs

FMap provides a block oriented interface for implementing memory mapped file structures. It is block oriented because memory mapped structures should be block aligned. By making the interface block oriented, the programmer is forced to write the structures in a block oriented fashion. I use it with fs2/slice which provides a simple way to cast []byte to other types of pointers. You can accomplish a similar thing with just using the reflect package but you might find fs2/slice more convenient.

FMap provides an interface for creating both anonymous and file backed memory maps. It supports resizing the memory maps dynamically via allocation and free methods. Note, when an allocation occurs the underlying file and memory map may resize using mremap with the flag MREMAP_MAYMOVE. So don't let pointers escape your memory map! Keep everything as file offsets and be happy!

Memory Mapped IO versus Read/Write

A key motivation of this work is to explore memory mapped IO versus a read/write interface in the context of Go. I have two hypotheses:

  1. The operating system is good at page management generally. While, we know more about how to manage the structure of B+Trees, VarChar stores, and Linear Hash tables than the OS there is no indication that from Go you can achieve better performance. Therefore, I hypothesize that leaving it to the OS will lead to a smaller working set and a faster data structure in general.

  2. You can make Memory Mapping performant in Go. There are many challenges here. The biggest of which is that there are no dynamically size array TYPES in go. The size of the array is part of the type, you have to use slices. This creates complications when hooking up structures which contain slices to mmap allocated blocks of memory. I hypothesize that this repository can achieve good (enough) performance here.

In my past experience using the read/write interface I have encountered two challenges:

  1. When using the read/write interface one needs to block and cache management. In theory databases which bypass the OS cache management get better performance. In practice, there are challenges achieving this from a garbage collected language.

  2. Buffer management is a related problem. In the past I have relied on Go's built in memory management scheme. This often become a bottle neck. To solve this problem, one must implement custom allocators and buffer management subsystems.

Memory mapped IO avoids both of these problems by delegating them to the operating system. If the OS does a good job, then this system will perform well. If it does a bad job it will perform poorly. The reason why systems such as Oracle circumvent all OS level functions for page management is the designers believe: a) they can do it better, and b) it provides consistent performance across platforms.

Memory mapped IO in Go has several challenges.

  1. You have to subvert type and memory safety.

  2. There is no dynamically sized arrays. Therefore, everything has to use slices. This means that you can't just point a struct at a memory mapped block and expect it work if it has slices in it. Instead, some book keeping needs to be done to hook up the slices properly. This adds overhead.

The results so far:

  1. It can be done

  2. Integrating (partial) runtime checking for safety can be achieved through the use of the "do" interface.

  3. The performance numbers look like they are as good or better than the Linear Hash table I implemented in my file-structures repository.

Related Projects

  1. file-structures - A collection of file-structures includes: B+Tree, BTree, Linear Hash Table, VarChar Store.
  2. data-structures - A collection of in memory data structures. Includes a B+Tree.
  3. boltdb - a mmap'ed b+ tree based key/value store.
  4. goleveldb - another database written in go
  5. cznic/b - an in memory b+ tree
  6. xiang90/bplustree - an in memory b+ tree
  7. your project here.

fs2's People

Contributors

timtadh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fs2's Issues

Duplicate Key insert in internal block.

2015/06/25 14:32:52 would have inserted a duplicate key, [0 0 0 40]
goroutine 5 [running]:
github.com/timtadh/fs2/errors.Errorf(0xc20e8272c0, 0x2f, 0x0, 0x0, 0x0, 0x0, 0x0)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/errors/error.go:16 +0x92
github.com/timtadh/fs2/bptree.(*internal).putKey(0x7fded5867000, 0x0, 0x7fded63de020, 0x4, 0xfe0, 0xc20ee88ea8, 0x0, 0x0)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/bptree/internal.go:277 +0x3c4
github.com/timtadh/fs2/bptree.(*internal).putKP(0x7fded5867000, 0x0, 0x7fded63de020, 0x4, 0xfe0, 0xbe2000, 0x0, 0x0)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/bptree/internal.go:211 +0x1d8
github.com/timtadh/fs2/bptree.funcยท073(0x7fded63de020, 0x4, 0xfe0, 0x0, 0x0)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/bptree/insert.go:156 +0x18b
github.com/timtadh/fs2/bptree.funcยท023(0x7fded63de000, 0x0, 0x0)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/bptree/first.go:20 +0x124
github.com/timtadh/fs2/bptree.funcยท021(0x7fded63de000, 0x1000, 0x1000, 0x0, 0x0)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/bptree/do.go:103 +0xfa
github.com/timtadh/fs2/fmap.(*BlockFile).Do(0xc20cc28240, 0xbe2000, 0x1, 0xc20ee890a8, 0x0, 0x0)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/fmap/fmap.go:559 +0xbf
github.com/timtadh/fs2/bptree.(*BpTree).do(0xc20fc78fc0, 0xbe2000, 0xc20ee89108, 0xc20ee890f8, 0x0, 0x0)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/bptree/do.go:107 +0x79
github.com/timtadh/fs2/bptree.(*BpTree).firstKey(0xc20fc78fc0, 0xbe2000, 0xc20ee891b8, 0x0, 0x0)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/bptree/first.go:22 +0x84
github.com/timtadh/fs2/bptree.funcยท074(0x7fded5867000, 0x0, 0x0)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/bptree/insert.go:157 +0x253
github.com/timtadh/fs2/bptree.funcยท021(0x7fded5867000, 0x1000, 0x1000, 0x0, 0x0)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/bptree/do.go:101 +0xab
github.com/timtadh/fs2/fmap.(*BlockFile).Do(0xc20cc28240, 0x6b000, 0x1, 0xc20ee892e0, 0x0, 0x0)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/fmap/fmap.go:559 +0xbf
github.com/timtadh/fs2/bptree.(*BpTree).do(0xc20fc78fc0, 0x6b000, 0xc20ee89400, 0x685ea8, 0x0, 0x0)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/bptree/do.go:107 +0x79
github.com/timtadh/fs2/bptree.(*BpTree).doInternal(0xc20fc78fc0, 0x6b000, 0xc20ee89400, 0x0, 0x0)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/bptree/do.go:43 +0x5a
github.com/timtadh/fs2/bptree.(*BpTree).internalInsert(0xc20fc78fc0, 0x6b000, 0xc209b61dc0, 0x4, 0x4, 0xc209b61dc8, 0x8, 0x8, 0x18, 0xc209b61dc8, ...)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/bptree/insert.go:160 +0x273
github.com/timtadh/fs2/bptree.(*BpTree).insert(0xc20fc78fc0, 0x6b000, 0xc209b61dc0, 0x4, 0x4, 0xc209b61dc8, 0x8, 0x8, 0x0, 0xc209b61dc8, ...)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/bptree/insert.go:100 +0x13c
github.com/timtadh/fs2/bptree.(*BpTree).Add(0xc20fc78fc0, 0xc209b61dc0, 0x4, 0x4, 0xc209b61dc8, 0x8, 0x8, 0x0, 0x0)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/bptree/insert.go:54 +0x2ff
github.com/timtadh/fs2/bptree.(*Varchar).szAdd(0xc20f688390, 0x24, 0xa24c34, 0x0, 0x0)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/bptree/varchar.go:407 +0xd2
github.com/timtadh/fs2/bptree.(*Varchar).free(0xc20f688390, 0xa24c34, 0x24, 0x0, 0x0)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/bptree/varchar.go:397 +0x5f2
github.com/timtadh/fs2/bptree.(*Varchar).freeExtra(0xc20f688390, 0xa24bc8, 0x90, 0x6c, 0x0, 0x0, 0x0)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/bptree/varchar.go:268 +0xfd
github.com/timtadh/fs2/bptree.(*Varchar).newRun(0xc20f688390, 0xa24bc8, 0x5c, 0x6c, 0x90, 0x0, 0x0)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/bptree/varchar.go:675 +0x13a
github.com/timtadh/fs2/bptree.(*Varchar).Alloc(0xc20f688390, 0x5c, 0xa24bc8, 0x0, 0x0)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/bptree/varchar.go:222 +0x479
github.com/timtadh/fs2/bptree.(*BpTree).checkValue(0xc20fc78fe0, 0xc20e6f8f00, 0x5c, 0x5c, 0x0, 0x0, 0x0, 0x0, 0x0)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/bptree/insert.go:15 +0xa8
github.com/timtadh/fs2/bptree.(*BpTree).Add(0xc20fc78fe0, 0xc20e6f8d20, 0x5c, 0x5c, 0xc20e6f8f00, 0x5c, 0x5c, 0x0, 0x0)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/bptree/insert.go:50 +0x230
github.com/timtadh/fsm/store.(*Fs2BpTree).Add(0xc20fc79020, 0xc20e6f8d20, 0x5c, 0x5c, 0xc20bfc5f00)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fsm/store/fs.go:146 +0x769
github.com/timtadh/fsm/mine.(*Queue).Add(0xc20cc282c0, 0xc20ba58c00)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fsm/mine/queue.go:66 +0x1d1
github.com/timtadh/fsm/mine.funcยท014(0xc20ba58c00)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fsm/mine/depth.go:123 +0x79
github.com/timtadh/fsm/mine.(*DepthMiner).process(0xc20e6a41c0, 0xc20c0f1020, 0xc20ee89f18)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fsm/mine/depth.go:181 +0x440
github.com/timtadh/fsm/mine.(*DepthMiner).search(0xc20e6a41c0, 0xa)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fsm/mine/depth.go:128 +0x59f
github.com/timtadh/fsm/mine.(*DepthMiner).mine(0xc20e6a41c0)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fsm/mine/depth.go:79 +0x31
created by github.com/timtadh/fsm/mine.Depth
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fsm/mine/depth.go:73 +0x321
Command exited with non-zero status 1

Unexpected Free Blk

edit 2015-06-12 : This seems to be a very rare error. I have only seen it this once. Not exactly sure what caused it, it looks like either an error in leafInsert returning the wrong value of a key or perhaps a dangling pointer. Not sure how that would have happened since the program using this was never deleting items from the tree. I will keep my eye out for it.

2015/06/10 14:31:59 unexpected free blk
goroutine 183064 [running]:
github.com/timtadh/fs2/errors.Errorf(0x614490, 0x13, 0x0, 0x0, 0x0, 0x0, 0x0)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/errors/error.go:16 +0x92
github.com/timtadh/fs2/bptree.funcยท144(0x7f03f021be60, 0x0, 0x0)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/bptree/varchar.go:558 +0x62
github.com/timtadh/fs2/bptree.funcยท149(0x7f03f021be60, 0x1a0, 0x1a0, 0x0, 0x0)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/bptree/varchar.go:605 +0x13d
github.com/timtadh/fs2/fmap.(*BlockFile).Do(0xc20d9214c0, 0xbb1d000, 0x1, 0xc20dc653f0, 0x0, 0x0)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/fmap/fmap.go:558 +0xbf
github.com/timtadh/fs2/bptree.(*Varchar).do(0xc20f280f60, 0xbb1de60, 0x64a340, 0x64a348, 0x64a338, 0x0, 0x0)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/bptree/varchar.go:611 +0xc1
github.com/timtadh/fs2/bptree.(*Varchar).doRun(0xc20f280f60, 0xbb1de60, 0x64a338, 0x0, 0x0)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/bptree/varchar.go:560 +0x66
github.com/timtadh/fs2/bptree.(*Varchar).Ref(0xc20f280f60, 0xbb1de60, 0x0, 0x0)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/bptree/varchar.go:507 +0x50
github.com/timtadh/fs2/bptree.(*internal).bigUpdateK(0x7f03e470f000, 0xc20f280f60, 0x0, 0x7f03e47fe020, 0x8, 0xfe0, 0x0, 0x0)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/bptree/internal.go:181 +0x147
github.com/timtadh/fs2/bptree.(*internal).updateK(0x7f03e470f000, 0xc20f280f60, 0x0, 0x7f03e47fe020, 0x8, 0xfe0, 0x0, 0x0)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/bptree/internal.go:168 +0x115
github.com/timtadh/fs2/bptree.funcยท072(0x7f03e47fe020, 0x8, 0xfe0, 0x0, 0x0)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/bptree/insert.go:143 +0x77
github.com/timtadh/fs2/bptree.funcยท023(0x7f03e47fe000, 0x0, 0x0)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/bptree/first.go:20 +0x124
github.com/timtadh/fs2/bptree.funcยท021(0x7f03e47fe000, 0x1000, 0x1000, 0x0, 0x0)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/bptree/do.go:103 +0xdd
github.com/timtadh/fs2/fmap.(*BlockFile).Do(0xc20d9214c0, 0x100000, 0x1, 0xc20dc65750, 0x0, 0x0)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/fmap/fmap.go:558 +0xbf
github.com/timtadh/fs2/bptree.(*BpTree).do(0xc20ff232e0, 0x100000, 0xc20dc657b0, 0xc20dc657a0, 0x0, 0x0)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/bptree/do.go:107 +0x79
github.com/timtadh/fs2/bptree.(*BpTree).firstKey(0xc20ff232e0, 0x100000, 0xc20dc65840, 0x0, 0x0)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/bptree/first.go:22 +0x84
github.com/timtadh/fs2/bptree.funcยท074(0x7f03e470f000, 0x0, 0x0)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/bptree/insert.go:144 +0x12d
github.com/timtadh/fs2/bptree.funcยท021(0x7f03e470f000, 0x1000, 0x1000, 0x0, 0x0)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/bptree/do.go:101 +0x8f
github.com/timtadh/fs2/fmap.(*BlockFile).Do(0xc20d9214c0, 0x11000, 0x1, 0xc20dc65988, 0x0, 0x0)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/fmap/fmap.go:558 +0xbf
github.com/timtadh/fs2/bptree.(*BpTree).do(0xc20ff232e0, 0x11000, 0xc20dc65aa8, 0x64a318, 0x0, 0x0)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/bptree/do.go:107 +0x79
github.com/timtadh/fs2/bptree.(*BpTree).doInternal(0xc20ff232e0, 0x11000, 0xc20dc65aa8, 0x0, 0x0)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/bptree/do.go:43 +0x5a
github.com/timtadh/fs2/bptree.(*BpTree).internalInsert(0xc20ff232e0, 0x11000, 0xc20c11c820, 0x18c, 0x18c, 0xc209de2f40, 0x1, 0x1, 0x49fc3a, 0xc20ff232e0, ...)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/bptree/insert.go:160 +0x273
github.com/timtadh/fs2/bptree.(*BpTree).insert(0xc20ff232e0, 0x11000, 0xc20c11c820, 0x18c, 0x18c, 0xc209de2f40, 0x1, 0x1, 0xc20dc65be0, 0x0, ...)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/bptree/insert.go:100 +0x138
github.com/timtadh/fs2/bptree.(*BpTree).internalInsert(0xc20ff232e0, 0x7da2000, 0xc20c11c820, 0x18c, 0x18c, 0xc209de2f40, 0x1, 0x1, 0x49fec9, 0xc20d9214c0, ...)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/bptree/insert.go:134 +0x17a
github.com/timtadh/fs2/bptree.(*BpTree).insert(0xc20ff232e0, 0x7da2000, 0xc20c11c820, 0x18c, 0x18c, 0xc209de2f40, 0x1, 0x1, 0x0, 0x0, ...)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/bptree/insert.go:100 +0x138
github.com/timtadh/fs2/bptree.(*BpTree).Add(0xc20ff232e0, 0xc20c11c820, 0x18c, 0x18c, 0xc209de2f40, 0x1, 0x1, 0x0, 0x0)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fs2/bptree/insert.go:54 +0x2fd
github.com/timtadh/fsm/mine.addToLabels(0xc20ff232e0, 0xc20c11c820, 0x18c, 0x18c)
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fsm/mine/maximal.go:65 +0x1c9
github.com/timtadh/fsm/mine.funcยท024()
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fsm/mine/maximal.go:46 +0x3e5
created by github.com/timtadh/fsm/mine.MaximalSubGraphs
        /home/hendersont/stuff/research/fsm/src/github.com/timtadh/fsm/mine/maximal.go:55 +0x345

Double Internal put

Not sure if this is a real issue or a usage error

2015/12/03 20:56:41 <internal (debug) (vchar <nil>) meta: <{1 4 39 340}>, keys: <[[0 0 0 24] [0 0 0 28] [0 0 0 32] [0 0 0 36] [0 0 0 40] [0 0 0 44] [0 0 0 48] [0 0 0 52] [0 0 0 56] [0 0 0 60] [0 0 0 64] [0 0 0 68] [0 0 0 72] [0 0 0 76] [0 0 0 80] [0 0 0 84] [0 0 0 88] [0 0 0 92] [0 0 0 96] [0 0 0 100] [0 0 0 104] [0 0 0 108] [0 0 0 112] [0 0 0 116] [0 0 0 120] [0 0 0 124] [0 0 0 128] [0 0 0 132] [0 0 0 136] [0 0 0 140] [0 0 0 144] [0 0 0 148] [0 0 0 152] [0 0 0 156] [0 0 0 164] [0 0 0 168] [0 0 0 176] [0 0 0 180] [0 0 0 208]]>, ptrs: <[1024000 765952 4583424 4440064 65822720 49954816 19202048 56877056 49369088 91881472 13000704 27590656 50708480 8515584 26238976 20332544 36560896 32595968 14405632 29827072 27242496 111857664 65892352 107053056 41676800 91000832 57516032 108855296 43786240 99532800 108916736 214274048 215560192 165625856 338407424 209829888 349868032 349970432 349982720]>>
2015/12/03 20:56:41 key [0 0 0 168] v was nil
2015/12/03 20:56:41 replacing [0 0 0 164]
2015/12/03 20:56:41 <internal (debug) (vchar <nil>) meta: <{1 4 39 340}>, keys: <[[0 0 0 24] [0 0 0 28] [0 0 0 32] [0 0 0 36] [0 0 0 40] [0 0 0 44] [0 0 0 48] [0 0 0 52] [0 0 0 56] [0 0 0 60] [0 0 0 64] [0 0 0 68] [0 0 0 72] [0 0 0 76] [0 0 0 80] [0 0 0 84] [0 0 0 88] [0 0 0 92] [0 0 0 96] [0 0 0 100] [0 0 0 104] [0 0 0 108] [0 0 0 112] [0 0 0 116] [0 0 0 120] [0 0 0 124] [0 0 0 128] [0 0 0 132] [0 0 0 136] [0 0 0 140] [0 0 0 144] [0 0 0 148] [0 0 0 152] [0 0 0 156] [0 0 0 164] [0 0 0 168] [0 0 0 176] [0 0 0 180] [0 0 0 208]]>, ptrs: <[1024000 765952 4583424 4440064 65822720 49954816 19202048 56877056 49369088 91881472 13000704 27590656 50708480 8515584 26238976 20332544 36560896 32595968 14405632 29827072 27242496 111857664 65892352 107053056 41676800 91000832 57516032 108855296 43786240 99532800 108916736 214274048 215560192 165625856 338407424 209829888 349868032 349970432 349982720]>>
2015/12/03 20:56:41 was removing: [0 0 0 164]
2015/12/03 20:56:41 n: 921600, parent: 0, sibling: 209829888, okid 338407424, kid: 338407424
2015/12/03 20:56:41 internal already had key [0 0 0 168], at 35, was going to put it at 34, replacing [0 0 0 164]
goroutine 34 [running]:
github.com/timtadh/fs2/errors.Errorf(0x6e3f00, 0x4b, 0xc829ce47b0, 0x4, 0x4, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/errors/error.go:16 +0x89
github.com/timtadh/fs2/bptree.(*internal).updateK(0x7f66a01dd000, 0x0, 0x22, 0x7f66b43b7020, 0x4, 0xfe0, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/internal.go:229 +0x5ff
github.com/timtadh/fs2/bptree.(*BpTree).internalDelete.func4.1(0x7f66b43b7020, 0x4, 0xfe0, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/remove.go:118 +0x63
github.com/timtadh/fs2/bptree.(*BpTree).firstKey.func2(0x7f66b43b7000, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/first.go:20 +0xed
github.com/timtadh/fs2/bptree.(*BpTree).do.func1(0x7f66b43b7000, 0x1000, 0x1000, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/do.go:103 +0xe7
github.com/timtadh/fs2/fmap.(*BlockFile).Do(0xc8251ab440, 0x142bb000, 0x1, 0xc829ce49c0, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/fmap/fmap.go:563 +0xb6
github.com/timtadh/fs2/bptree.(*BpTree).do(0xc82636ff80, 0x142bb000, 0xc829ce4a20, 0xc829ce4a10, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/do.go:107 +0x69
github.com/timtadh/fs2/bptree.(*BpTree).firstKey(0xc82636ff80, 0x142bb000, 0xc829ce4a60, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/first.go:22 +0x6f
github.com/timtadh/fs2/bptree.(*BpTree).internalDelete.func4(0x7f66a01dd000, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/remove.go:119 +0x93
github.com/timtadh/fs2/bptree.(*BpTree).do.func1(0x7f66a01dd000, 0x1000, 0x1000, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/do.go:101 +0x98
github.com/timtadh/fs2/fmap.(*BlockFile).Do(0xc8251ab440, 0xe1000, 0x1, 0xc829ce4bb0, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/fmap/fmap.go:563 +0xb6
github.com/timtadh/fs2/bptree.(*BpTree).do(0xc82636ff80, 0xe1000, 0xc829ce4d40, 0x6f9da0, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/do.go:107 +0x69
github.com/timtadh/fs2/bptree.(*BpTree).doInternal(0xc82636ff80, 0xe1000, 0xc829ce4d40, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/do.go:43 +0x4d
github.com/timtadh/fs2/bptree.(*BpTree).internalDelete(0xc82636ff80, 0x0, 0xe1000, 0xc81c000, 0xc823239630, 0x4, 0x4, 0xc829ce4f70, 0x142bb000, 0x0, ...)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/remove.go:120 +0x894
github.com/timtadh/fs2/bptree.(*BpTree).delete(0xc82636ff80, 0x0, 0xe1000, 0x0, 0xc823239630, 0x4, 0x4, 0xc829ce4f70, 0xc823239630, 0x0, ...)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/remove.go:58 +0x120
github.com/timtadh/fs2/bptree.(*BpTree).remove(0xc82636ff80, 0xe1000, 0xc823239630, 0x4, 0x4, 0xc829ce4f70, 0x4, 0x4, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/remove.go:35 +0x83
github.com/timtadh/fs2/bptree.(*BpTree).Remove(0xc82636ff80, 0xc823239630, 0x4, 0x4, 0xc829ce4f70, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/remove.go:25 +0x6d
github.com/timtadh/fs2/bptree.(*Varchar).szDel(0xc8224c2780, 0xa4, 0x14c4ef5c, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/varchar.go:413 +0x2e3
github.com/timtadh/fs2/bptree.(*Varchar).indexRemove(0xc8224c2780, 0xa4, 0x14c4ef5c, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/varchar.go:425 +0x5c
github.com/timtadh/fs2/bptree.(*Varchar).Alloc(0xc8224c2780, 0x8c, 0x14c4ef5c, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/varchar.go:220 +0x52e
github.com/timtadh/fs2/bptree.(*BpTree).checkValue(0xc82636ffc0, 0xc8294ad950, 0x8c, 0x8c, 0x0, 0x0, 0x0, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/insert.go:16 +0x9e
github.com/timtadh/fs2/bptree.(*BpTree).Add(0xc82636ffc0, 0xc8294a4cf0, 0x88, 0x88, 0xc8294ad950, 0x8c, 0x8c, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/insert.go:51 +0x254
github.com/timtadh/sfp/stores/bytes_subgraph.(*BpTree).Add(0xc8251ab4c0, 0xc8294a4cf0, 0x88, 0x88, 0xc82ee45200, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/sfp/stores/bytes_subgraph/wrapper.go:237 +0x16a

Internal double put

2015/11/29 22:19:15 <internal (debug) (vchar <nil>) meta: <{1 4 3 340}>, keys: <[[0 0 0 28] [0 0 11 92] [0 0 16 0]]>, ptrs: <[1024000 819200 819200]>>
2015/11/29 22:19:15 key [0 0 11 92] v was nil
2015/11/29 22:19:15 replacing [0 0 16 0]
2015/11/29 22:19:15 <internal (debug) (vchar <nil>) meta: <{1 4 3 340}>, keys: <[[0 0 0 28] [0 0 11 92] [0 0 16 0]]>, ptrs: <[1024000 819200 819200]>>
2015/11/29 22:19:15 was removing: [0 0 16 0]
2015/11/29 22:19:15 n: 831488, parent: 0, sibling: 0, okid 823296, kid: 819200
2015/11/29 22:19:15 internal already had key [0 0 11 92], at 1, was going to put it at 2, replacing [0 0 16 0]
goroutine 35 [running]:
github.com/timtadh/fs2/errors.Errorf(0x6d6fa0, 0x4b, 0xc8202f2d70, 0x4, 0x4, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/errors/error.go:16 +0x89
github.com/timtadh/fs2/bptree.(*internal).updateK(0x7fd0be3a4000, 0x0, 0x2, 0x7fd0be3a1020, 0x4, 0xfe0, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/internal.go:229 +0x5ff
github.com/timtadh/fs2/bptree.(*BpTree).internalDelete.func4.1(0x7fd0be3a1020, 0x4, 0xfe0, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/remove.go:118 +0x63
github.com/timtadh/fs2/bptree.(*BpTree).firstKey.func2(0x7fd0be3a1000, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/first.go:20 +0xed
github.com/timtadh/fs2/bptree.(*BpTree).do.func1(0x7fd0be3a1000, 0x1000, 0x1000, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/do.go:103 +0xe7
github.com/timtadh/fs2/fmap.(*BlockFile).Do(0xc8200124c0, 0xc8000, 0x1, 0xc8202f2f80, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/fmap/fmap.go:563 +0xb6
github.com/timtadh/fs2/bptree.(*BpTree).do(0xc8200108a0, 0xc8000, 0xc8202f2fe0, 0xc8202f2fd0, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/do.go:107 +0x69
github.com/timtadh/fs2/bptree.(*BpTree).firstKey(0xc8200108a0, 0xc8000, 0xc8202f3020, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/first.go:22 +0x6f
github.com/timtadh/fs2/bptree.(*BpTree).internalDelete.func4(0x7fd0be3a4000, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/remove.go:119 +0x93
github.com/timtadh/fs2/bptree.(*BpTree).do.func1(0x7fd0be3a4000, 0x1000, 0x1000, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/do.go:101 +0x98
github.com/timtadh/fs2/fmap.(*BlockFile).Do(0xc8200124c0, 0xcb000, 0x1, 0xc8202f3170, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/fmap/fmap.go:563 +0xb6
github.com/timtadh/fs2/bptree.(*BpTree).do(0xc8200108a0, 0xcb000, 0xc8202f3300, 0x6ec470, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/do.go:107 +0x69
github.com/timtadh/fs2/bptree.(*BpTree).doInternal(0xc8200108a0, 0xcb000, 0xc8202f3300, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/do.go:43 +0x4d
github.com/timtadh/fs2/bptree.(*BpTree).internalDelete(0xc8200108a0, 0x0, 0xcb000, 0x0, 0xc8203a2000, 0x4, 0x4, 0xc8202f3530, 0x7fd0c15d7970, 0x0, ...)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/remove.go:120 +0x894
github.com/timtadh/fs2/bptree.(*BpTree).delete(0xc8200108a0, 0x0, 0xcb000, 0x0, 0xc8203a2000, 0x4, 0x4, 0xc8202f3530, 0xc8203a2000, 0x0, ...)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/remove.go:58 +0x120
github.com/timtadh/fs2/bptree.(*BpTree).remove(0xc8200108a0, 0xcb000, 0xc8203a2000, 0x4, 0x4, 0xc8202f3530, 0x4, 0x4, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/remove.go:35 +0x83
github.com/timtadh/fs2/bptree.(*BpTree).Remove(0xc8200108a0, 0xc8203a2000, 0x4, 0x4, 0xc8202f3530, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/remove.go:25 +0x6d
github.com/timtadh/fs2/bptree.(*Varchar).szDel(0xc82001a720, 0x1000, 0xcc000, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/varchar.go:413 +0x2e3
github.com/timtadh/fs2/bptree.(*Varchar).indexRemove(0xc82001a720, 0x1000, 0xcc000, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/varchar.go:425 +0x5c
github.com/timtadh/fs2/bptree.(*Varchar).Alloc(0xc82001a720, 0x68, 0xcc000, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/varchar.go:220 +0x52e
github.com/timtadh/fs2/bptree.(*Varchar).allocNew(0xc82001a720, 0x68, 0x78, 0x0, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/varchar.go:245 +0x12a
github.com/timtadh/fs2/bptree.(*Varchar).Alloc(0xc82001a720, 0x68, 0x0, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/varchar.go:218 +0x4d7
github.com/timtadh/fs2/bptree.(*BpTree).checkValue(0xc8200108c0, 0xc82065b1f0, 0x68, 0x68, 0x0, 0x0, 0x0, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/insert.go:16 +0x9e
github.com/timtadh/fs2/bptree.(*BpTree).Add(0xc8200108c0, 0xc8200c6120, 0x5c, 0x5c, 0xc82065b1f0, 0x68, 0x68, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/insert.go:51 +0x254
github.com/timtadh/sfp/types/graph.(*Node).cache(0xc820613a80, 0x7fd0bfde3438, 0xc8200109a0, 0x7fd0bfde33b0, 0xc8200108c0, 0xc8200c6120, 0x5c, 0x5c, 0xc8201b7240, 0x3, ...)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/sfp/types/graph/node.go:304 +0x299
github.com/timtadh/sfp/types/graph.(*Node).Children(0xc820613a80, 0xc8201b7240, 0x3, 0x4, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/sfp/types/graph/node.go:286 +0xa55
github.com/timtadh/sfp/miners/absorbing.walk(0xc820012580, 0x0, 0x0, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/sfp/miners/absorbing/mine.go:176 +0x166
github.com/timtadh/sfp/miners/absorbing.RejectingWalk.func1(0xc820012580, 0xc820258120, 0xc8202580c0, 0xc820258060)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/sfp/miners/absorbing/mine.go:149 +0x30
created by github.com/timtadh/sfp/miners/absorbing.RejectingWalk
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/sfp/miners/absorbing/mine.go:163 +0xbb

goroutine 1 [runnable]:
github.com/timtadh/sfp/stores/bytes_subgraph.(*BpTree).kvIter.func1(0xc8203fc4c0, 0xc, 0xc, 0xc8206d9400, 0x0, 0x0, 0xc820368480)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/sfp/stores/bytes_subgraph/wrapper.go:254
github.com/timtadh/sfp/stores/bytes_subgraph.Do(0xc8202f6dd8, 0xc8203fc060, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/sfp/stores/bytes_subgraph/wrapper.go:88 +0x129
github.com/timtadh/sfp/stores/bytes_subgraph.(*BpTree).DoFind(0xc8201320c0, 0xc8203fc050, 0xc, 0xc, 0xc8203fc060, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/sfp/stores/bytes_subgraph/wrapper.go:339 +0x68
github.com/timtadh/sfp/types/graph.edgeChain(0xc820096000, 0xc8206be300, 0x5c, 0xc8206f1ef0, 0x5, 0x5, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/sfp/types/graph/node.go:212 +0x359
github.com/timtadh/sfp/types/graph.(*Node).FindNode(0xc82056d680, 0xc820096000, 0xc8206be300, 0x0, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/sfp/types/graph/node.go:159 +0x3b3
github.com/timtadh/sfp/types/graph.(*Node).Parents(0xc82056d680, 0x0, 0x0, 0x0, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/sfp/types/graph/node.go:128 +0x50d
github.com/timtadh/sfp/lattice.lattice(0x7fd0be09b838, 0xc82056d680, 0x7fd0bfdf5738, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/sfp/lattice/lattice.go:35 +0x359
github.com/timtadh/sfp/lattice.MakeLattice(0x7fd0be09b838, 0xc82056d680, 0xb00, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/sfp/lattice/lattice.go:16 +0xaf
github.com/timtadh/sfp/miners/absorbing.(*Walker).PrMatrices(0xc820012580, 0x7fd0be09b838, 0xc82056d680, 0xc820464440, 0xc8204c8c00, 0xa54, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/sfp/miners/absorbing/mine.go:37 +0x54
github.com/timtadh/sfp/miners/absorbing.(*MatrixReporter).Report(0xc820225980, 0x7fd0be09b838, 0xc82056d680, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/sfp/miners/absorbing/reporter.go:43 +0x62
github.com/timtadh/sfp/miners/reporters.(*Chain).Report(0xc820164800, 0x7fd0be09b838, 0xc82056d680, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/sfp/miners/reporters/chain.go:18 +0xcb
github.com/timtadh/sfp/miners/walker.(*Walker).Mine(0xc820012580, 0x7fd0be09bc68, 0xc820096000, 0x7fd0be09bd80, 0xc820164800, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/sfp/miners/walker/walker.go:58 +0x219
github.com/timtadh/sfp/miners/absorbing.(*Walker).Mine(0xc820012580, 0x7fd0be09bc68, 0xc820096000, 0x7fd0be09bd80, 0xc820164740, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/sfp/miners/absorbing/mine.go:140 +0x1bf
main.main()
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/sfp/main.go:556 +0x1737

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
        /home/hendersont/srcs/go/src/runtime/asm_amd64.s:1696 +0x1

goroutine 36 [chan receive]:
github.com/timtadh/sfp/miners/walker.(*Walker).RejectingWalk.func1(0xc820258060, 0xc820012580, 0xc820258180, 0xc8202580c0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/sfp/miners/walker/walker.go:75 +0x5d
created by github.com/timtadh/sfp/miners/walker.(*Walker).RejectingWalk
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/sfp/miners/walker/walker.go:89 +0x71

There was error during the mining process
Unknown block type
goroutine 1 [running]:
github.com/timtadh/fs2/errors.Errorf(0x6a9b00, 0x12, 0x0, 0x0, 0x0, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/errors/error.go:16 +0x89
github.com/timtadh/fs2/bptree.(*BpTree).insert(0xc8200108a0, 0xc8000, 0xc82044b980, 0x4, 0x4, 0xc82044b990, 0x8, 0x8, 0x1, 0xc8202f6070, ...)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/insert.go:110 +0x226
github.com/timtadh/fs2/bptree.(*BpTree).internalInsert(0xc8200108a0, 0xcb000, 0xc82044b980, 0x4, 0x4, 0xc82044b990, 0x8, 0x8, 0x1, 0x0, ...)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/insert.go:141 +0x172
github.com/timtadh/fs2/bptree.(*BpTree).insert(0xc8200108a0, 0xcb000, 0xc82044b980, 0x4, 0x4, 0xc82044b990, 0x8, 0x8, 0xc82044b901, 0x0, ...)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/insert.go:106 +0x144
github.com/timtadh/fs2/bptree.(*BpTree).add(0xc8200108a0, 0xcb000, 0xc82044b980, 0x4, 0x4, 0xc82044b990, 0x8, 0x8, 0x1, 0xc82044b990, ...)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/insert.go:65 +0xab
github.com/timtadh/fs2/bptree.(*BpTree).Add(0xc8200108a0, 0xc82044b980, 0x4, 0x4, 0xc82044b990, 0x8, 0x8, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/insert.go:55 +0x2fb
github.com/timtadh/fs2/bptree.(*Varchar).szAdd(0xc82001a720, 0x1000, 0xc8000, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/varchar.go:401 +0x2bf
github.com/timtadh/fs2/bptree.(*Varchar).indexAdd(0xc82001a720, 0x1000, 0xc8000, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/varchar.go:417 +0x5c
github.com/timtadh/fs2/bptree.(*Varchar).free(0xc82001a720, 0xc8000, 0x1000, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/varchar.go:395 +0x734
github.com/timtadh/fs2/bptree.(*Varchar).allocNew(0xc82001a720, 0x2c, 0x3c, 0x0, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/varchar.go:241 +0xea
github.com/timtadh/fs2/bptree.(*Varchar).Alloc(0xc82001a720, 0x2c, 0x0, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/varchar.go:218 +0x4d7
github.com/timtadh/fs2/bptree.(*BpTree).newVarcharKey(0xc8200108c0, 0xce000, 0xc8205c27b0, 0x2c, 0x2c, 0x7fd0be3a7001, 0x0, 0x0, 0x0, 0x0, ...)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/insert.go:210 +0x19e
github.com/timtadh/fs2/bptree.(*BpTree).leafInsert(0xc8200108c0, 0xce000, 0xc8205c27b0, 0x2c, 0x2c, 0xc82044b850, 0x8, 0x8, 0x6ec401, 0x5226dd, ...)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/insert.go:227 +0xb9
github.com/timtadh/fs2/bptree.(*BpTree).insert(0xc8200108c0, 0xce000, 0xc8205c27b0, 0x2c, 0x2c, 0xc82044b850, 0x8, 0x8, 0x545a01, 0x7fd0be3a3fa4, ...)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/insert.go:108 +0x1c0
github.com/timtadh/fs2/bptree.(*BpTree).internalInsert(0xc8200108c0, 0xf6000, 0xc8205c27b0, 0x2c, 0x2c, 0xc82044b850, 0x8, 0x8, 0x1, 0x0, ...)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/insert.go:141 +0x172
github.com/timtadh/fs2/bptree.(*BpTree).insert(0xc8200108c0, 0xf6000, 0xc8205c27b0, 0x2c, 0x2c, 0xc82044b850, 0x8, 0x8, 0x1, 0x3c, ...)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/insert.go:106 +0x144
github.com/timtadh/fs2/bptree.(*BpTree).add(0xc8200108c0, 0xf6000, 0xc8205c27b0, 0x2c, 0x2c, 0xc82044b850, 0x8, 0x8, 0x1, 0x0, ...)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/insert.go:65 +0xab
github.com/timtadh/fs2/bptree.(*BpTree).Add(0xc8200108c0, 0xc8205c27b0, 0x2c, 0x2c, 0xc82044b850, 0x8, 0x8, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/fs2/bptree/insert.go:55 +0x2fb
github.com/timtadh/sfp/types/graph.(*Node).cache(0xc8203a81c0, 0x7fd0bfde3438, 0xc8200109a0, 0x7fd0bfde33b0, 0xc8200108c0, 0xc8205c27b0, 0x2c, 0x2c, 0xc8201e3540, 0x2, ...)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/sfp/types/graph/node.go:304 +0x299
github.com/timtadh/sfp/types/graph.(*Node).Children(0xc8203a81c0, 0xc8201e3540, 0x2, 0x2, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/sfp/types/graph/node.go:286 +0xa55
github.com/timtadh/sfp/lattice.lattice(0x7fd0be09b838, 0xc82056d680, 0x7fd0bfdf5738, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/sfp/lattice/lattice.go:55 +0x9fd
github.com/timtadh/sfp/lattice.MakeLattice(0x7fd0be09b838, 0xc82056d680, 0xb00, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/sfp/lattice/lattice.go:16 +0xaf
github.com/timtadh/sfp/miners/absorbing.(*Walker).PrMatrices(0xc820012580, 0x7fd0be09b838, 0xc82056d680, 0xc820464440, 0xc8204c8c00, 0xa54, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/sfp/miners/absorbing/mine.go:37 +0x54
github.com/timtadh/sfp/miners/absorbing.(*MatrixReporter).Report(0xc820225980, 0x7fd0be09b838, 0xc82056d680, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/sfp/miners/absorbing/reporter.go:43 +0x62
github.com/timtadh/sfp/miners/reporters.(*Chain).Report(0xc820164800, 0x7fd0be09b838, 0xc82056d680, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/sfp/miners/reporters/chain.go:18 +0xcb
github.com/timtadh/sfp/miners/walker.(*Walker).Mine(0xc820012580, 0x7fd0be09bc68, 0xc820096000, 0x7fd0be09bd80, 0xc820164800, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/sfp/miners/walker/walker.go:58 +0x219
github.com/timtadh/sfp/miners/absorbing.(*Walker).Mine(0xc820012580, 0x7fd0be09bc68, 0xc820096000, 0x7fd0be09bd80, 0xc820164740, 0x0, 0x0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/sfp/miners/absorbing/mine.go:140 +0x1bf
main.main()
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/sfp/main.go:556 +0x1737

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
        /home/hendersont/srcs/go/src/runtime/asm_amd64.s:1696 +0x1

goroutine 35 [chan send]:
github.com/timtadh/sfp/miners/absorbing.RejectingWalk.func1(0xc820012580, 0xc820258120, 0xc8202580c0, 0xc820258060)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/sfp/miners/absorbing/mine.go:151 +0x8f
created by github.com/timtadh/sfp/miners/absorbing.RejectingWalk
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/sfp/miners/absorbing/mine.go:163 +0xbb

goroutine 36 [chan receive]:
github.com/timtadh/sfp/miners/walker.(*Walker).RejectingWalk.func1(0xc820258060, 0xc820012580, 0xc820258180, 0xc8202580c0)
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/sfp/miners/walker/walker.go:75 +0x5d
created by github.com/timtadh/sfp/miners/walker.(*Walker).RejectingWalk
        /home/hendersont/stuff/research/sfp/src/github.com/timtadh/sfp/miners/walker/walker.go:89 +0x71

Command exited with non-zero status 1

Great work but documentation is restricted.

https://pkg.go.dev/github.com/timtadh/fs2/bptree?utm_source=godoc

The link is restricted. Possible to get it to work? Thx

to get range of item 100 - 1000, should i do like this or there's more efficient means to get 100-1000 items?

    //      var key, value []byte
    kvi, err := bpt.Find(k)
    if err != nil {  
            log.Fatal(err)
    }
    var i uint64
    var b [][]byte
    for key, value, err, kvi = kvi(); kvi != nil; key, value, err, kvi = kvi() {
            if i > 100 {
                     b[i] = value
            }
            if i == 1000 {
                  break;
            }
            i++

            // do stuff with the keys and values
            return value, err
    }
    if err != nil {
            log.Fatal(err)
    }
    return nil, err

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.