diff --git a/.changelog/unreleased/breaking/578-add-goleveldb-build-flag.md b/.changelog/v1.0.0/breaking/578-add-goleveldb-build-flag.md similarity index 100% rename from .changelog/unreleased/breaking/578-add-goleveldb-build-flag.md rename to .changelog/v1.0.0/breaking/578-add-goleveldb-build-flag.md diff --git a/.changelog/v1.0.0/summary.md b/.changelog/v1.0.0/summary.md new file mode 100644 index 0000000..93209e3 --- /dev/null +++ b/.changelog/v1.0.0/summary.md @@ -0,0 +1,5 @@ +*September 20, 2024* + +This release swaps the "default" DB from goleveldb to pebbledb. There's now a +`goleveldb` build flag that must be used when using goleveldb. If you're using +`pebbledb`, you don't need a build flag anymore. diff --git a/CHANGELOG.md b/CHANGELOG.md index b721237..c68864c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # CHANGELOG +## v1.0.0 + +*September 20, 2024* + +This release swaps the "default" DB from goleveldb to pebbledb. There's now a +`goleveldb` build flag that must be used when using goleveldb. If you're using +`pebbledb`, you don't need a build flag anymore. + +### BREAKING + +- Add `goleveldb` build flag. + ([\#202](https://github.com/cometbft/cometbft-db/pull/202)) + ## v0.15.0 *September 9, 2024* diff --git a/Makefile b/Makefile index 9a14560..2fb0603 100644 --- a/Makefile +++ b/Makefile @@ -12,42 +12,48 @@ endif all: lint test -### go tests -## By default this will only test memdb & goleveldb +#? test: Run pure Go tests only test: @echo "--> Running go test" - @go test $(PACKAGES) -v + @go test $(PACKAGES) -tags goleveldb,boltdb,badgerdb .PHONY: test +#? test-goleveldb: Run goleveldb tests +test-goleveldb: + @echo "--> Running go test" + @go test $(PACKAGES) -tags goleveldb -v +.PHONY: test-goleveldb + +#? test-cleveldb: Run cleveldb tests test-cleveldb: @echo "--> Running go test" @go test $(PACKAGES) -tags cleveldb -v .PHONY: test-cleveldb +#? test-rocksdb: Run rocksdb tests test-rocksdb: @echo "--> Running go test" @go test $(PACKAGES) -tags rocksdb -v .PHONY: test-rocksdb +#? test-boltdb: Run boltdb tests test-boltdb: @echo "--> Running go test" @go test $(PACKAGES) -tags boltdb -v .PHONY: test-boltdb +#? test-badgerdb: Run badgerdb tests test-badgerdb: @echo "--> Running go test" @go test $(PACKAGES) -tags badgerdb -v .PHONY: test-badgerdb -test-pebble: +#? test-pebbledb: Run pebbledb tests +test-pebbledb: @echo "--> Running go test" - @go test $(PACKAGES) -tags pebbledb -v - -test-all: - @echo "--> Running go test" - @go test $(PACKAGES) -tags cleveldb,boltdb,rocksdb,grocksdb_clean_link,badgerdb,pebbledb -v -.PHONY: test-all + @go test $(PACKAGES) -v +#? test-all-with-coverage: Run all tests with coverage test-all-with-coverage: @echo "--> Running go test for all databases, with coverage" @CGO_ENABLED=1 go test ./... \ @@ -56,28 +62,31 @@ test-all-with-coverage: -race \ -coverprofile=coverage.txt \ -covermode=atomic \ - -tags=memdb,goleveldb,cleveldb,boltdb,rocksdb,grocksdb_clean_link,badgerdb,pebbledb \ + -tags=goleveldb,cleveldb,boltdb,rocksdb,badgerdb\ -v .PHONY: test-all-with-coverage +#? lint: Run linter lint: @echo "--> Running linter" @go run github.com/golangci/golangci-lint/cmd/golangci-lint@latest run @go mod verify .PHONY: lint +#? format: Format the code format: find . -name '*.go' -type f -not -path "*.git*" -not -name '*.pb.go' -not -name '*pb_test.go' | xargs gofmt -w -s find . -name '*.go' -type f -not -path "*.git*" -not -name '*.pb.go' -not -name '*pb_test.go' | xargs goimports -w .PHONY: format +#? docker-test-image: Build the Docker test image docker-test-image: @echo "--> Building Docker test image" @cd tools && \ docker build -t $(DOCKER_TEST_IMAGE):$(DOCKER_TEST_IMAGE_VERSION) . .PHONY: docker-test-image -# Runs the same test as is executed in CI, but locally. +#? docker-test: Run the same test as is executed in CI, but locally. docker-test: @echo "--> Running all tests with all databases with Docker (interactive flags: \"$(DOCKER_TEST_INTERACTIVE_FLAGS)\")" @docker run $(DOCKER_TEST_INTERACTIVE_FLAGS) --rm --name cometbft-db-test \ @@ -88,10 +97,12 @@ docker-test: make test-all-with-coverage .PHONY: docker-test +#? tools: Install tools tools: go get -v $(GOTOOLS) .PHONY: tools +#? vulncheck: Run go vuln check vulncheck: @go run golang.org/x/vuln/cmd/govulncheck@latest ./... .PHONY: vulncheck diff --git a/UPGRADING.md b/UPGRADING.md new file mode 100644 index 0000000..7c8bbff --- /dev/null +++ b/UPGRADING.md @@ -0,0 +1,10 @@ +# Upgrading + +## v0.15 -> v1.0 + +There's now a `goleveldb` build flag that must be used when using goleveldb. If +you're using `pebbledb`, you don't need a build flag anymore. + +```sh +go build -tags goleveldb +``` diff --git a/db.go b/db.go index de0ad30..6e22f52 100644 --- a/db.go +++ b/db.go @@ -31,7 +31,7 @@ const ( // - pure go // - use boltdb build tag (go build -tags boltdb) BoltDBBackend BackendType = "boltdb" - // RocksDBBackend represents rocksdb (uses github.com/tecbot/gorocksdb) + // RocksDBBackend represents rocksdb (uses https://github.com/linxGnu/grocksdb) // - requires gcc // - use rocksdb build tag (go build -tags rocksdb) RocksDBBackend BackendType = "rocksdb"