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

Unexpected error: delete bucket: incompatible value #208

Closed
d2r2 opened this issue Mar 13, 2020 · 1 comment
Closed

Unexpected error: delete bucket: incompatible value #208

d2r2 opened this issue Mar 13, 2020 · 1 comment

Comments

@d2r2
Copy link
Contributor

d2r2 commented Mar 13, 2020

If at least one element added to the bucket with a value equal to null, then deleting this bucket will raise error: "delete bucket: incompatible value".

Code which reproduce the issue:

package main

import (
	"fmt"

	bolt "go.etcd.io/bbolt"
)

// Error description:
//      If at least one element added to the bucket with a value equal to null,
//      then deleting this bucket will raise error: "delete bucket: incompatible value".
func main() {
	db, _ := bolt.Open("/tmp/bolt.db", 0666, nil)
	defer db.Close()
	tx, _ := db.Begin(true)
	defer tx.Rollback()

	bucketName := []byte("oops")
	b, _ := tx.CreateBucket(bucketName)

	// putting element with empty value works fine
	b.Put([]byte("any_key"), nil)

	// trying to delete bucket with unexpected error
	fmt.Println(tx.DeleteBucket(bucketName))
}

// Error output:
//      delete bucket: incompatible value
@d2r2
Copy link
Contributor Author

d2r2 commented Mar 23, 2020

#209 has been merged, so the issue is resolved.

@d2r2 d2r2 closed this as completed Mar 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant