29 Commits
Author SHA1 Message Date
Hanzo AI ab37e5f078 feat: reset module path to luxfi/zapdb v1.0.0
Removed /v4 suffix from module path and all internal imports.
Go module is now github.com/luxfi/zapdb (no major version suffix).
Import as: import "github.com/luxfi/zapdb"

No code changes — only module path and import rewrite.
2026-04-11 00:01:08 -07:00
Zach Kelling 97021454b5 fix: use native binary encoding for wire-format compatibility with luxfi/badger
Replace proto.Marshal/Unmarshal with native pb.Marshal/pb.Unmarshal to
match the wire format used by luxfi/badger/v4. This ensures databases
written by nodes using the badger fork (v1.23.4) can be read by nodes
using zapdb (v1.23.5), preventing "proto: cannot parse invalid
wire-format data" errors during rolling upgrades.

Added types_zap.go and marshal_zap.go from luxfi/badger fork, which
provide custom LittleEndian binary encoding for ManifestChangeSet,
KV, Checksum, and other internal types. The standard protobuf
generated code (badgerpb4.pb.go) is now behind a grpc build tag.
2026-02-08 18:33:39 -08:00
Zach Kelling ebeadbd0a2 Rebrand badger to zapdb
- Rename module from github.com/dgraph-io/badger/v4 to github.com/luxfi/zapdb/v4
- Update all internal imports to use new module path
- Preserve all ZAP enhancements from badger fork
2026-02-08 14:14:21 -08:00
Matthew McNeelyandGitHub 56b2d31d75 chore: update README.md with correct links and badges (#2239)
**Description**

Updated links

Closes #2238
2025-12-10 22:11:18 +00:00
Ryan Fox-TylerandGitHub 94498ea84c chore: align repo conventions (#2158) 2025-02-05 17:00:32 -05:00
Shivaji KharseandGitHub 8fe64016c9 upgrade protobuf library to google's protobuf (#2131) 2024-11-29 05:01:57 +05:30
Aman MangalandGitHub 3220a35a10 retract v4.3.0 due to #2121 and #2113, upgrade to Go v1.23, use ristretto v2 (#2122)
Fixes #2121
2024-10-25 22:03:34 +05:30
simonandGitHub a29533f723 Allow stream custom maxsize per batch (#2063) 2024-10-25 09:43:46 +05:30
guangwuandGitHub 6ecff85047 chore: package imported more than once (#1979) 2023-07-11 14:14:43 +05:30
Joshua GoldsteinandGitHub ad428b8122 chore(ci): update changelog + import paths for v4 (#1886)
Changelog should reflect that we are switching to SemVer. This requires
moving to a new major version. We also update all import paths in
Badger.
2023-02-27 22:21:42 +00:00
Aman MangalandGitHub bbd4b3f95c chore: remove dependency on io/ioutil (#1879)
we still have a couple of places where we are using io/ioutil.
2023-02-21 08:06:07 +05:30
Aman MangalandGitHub f83f87e90b fix order of imports (#1869) 2023-02-15 02:12:59 +05:30
aman bansalandGitHub dbca3723b3 changing badger module path to v3 (#1636)
* changing badger module path to v3

* running go mod tidy

* updating metric keys + proto package
2021-01-13 10:55:37 +05:30
b744d51732 Fix(OOM): Use z.Allocator for Stream (#1611)
* Let's use allocator again
* Switch to z.NumAllocBytes
* Make stream work with both another Badger DB or with a file to backup.
* Add a test for Allocator
* Use allocator for Backup
* Bring in latest Ristretto

Co-authored-by: Daniel Mai <daniel@dgraph.io>
2020-12-04 12:59:40 -08:00
Manish R JainandGitHub a5e4775a78 Fix(OOM): Reuse pb.KVs in Stream (#1609)
We store a slice of pb.KVs in Iterator, so it can be used by Stream users.
2020-12-02 19:30:43 -08:00
8916040f62 Opt(stream): Use z.Buffer to stream data (#1606)
Stream.Send now sends out z.Buffer instead of pb.KVList. z.Buffer marshals each KV as a separate slice. This significantly reduces the memory requirement by the Stream framework. Stream no longer uses z.Allocator or tries to put pb.KV struct on the Allocator for memory safety reasons.

Bring back the z.AllocatorPool for table.Builder.

Changes:
* Use z.Buffer for stream.Send
* Only use 8 streams in write bench
* Revert "Bug Fix: Fix up how we use z.Allocator"
This reverts commit d6defb637d.
* Bring allocator back. Use z.Buffer for send
* Add BufferToKVList function
* Print jemalloc while stream
* Bring in latest Ristretto
* Fix memory leak and benchmark read test

Co-authored-by: Ibrahim Jarif <ibrahim@dgraph.io>
2020-11-25 10:44:31 -08:00
656600977c Use AllocatorPool in Stream and TableBuilder (#1593)
We removed the global z.Allocator pool from z package. Instead, we now use a new z.AllocatorPool class in the places which need a pool. In this case, we brought it to TableBuilder and Stream.

Fix up a memory leak in Stream.

Co-authored-by: Ibrahim Jarif <ibrahim@dgraph.io>
2020-11-11 13:02:30 -08:00
546255b85e feat(tests): Run tests in parallel (#1572)
Run tests in parallel. Break up the tests into 3 functions: manual, packages and root. Run those via GNU parallel. Moved some expensive tests to manual mode.

With these changes, the badger tests can now run in under 6 minutes on a fast machine.

Co-authored-by: Manish R Jain <manish@dgraph.io>
2020-11-02 15:39:09 -08:00
Manish R JainandGitHub be00cbf76f opt(memory): Use z.Calloc for allocating KVList (#1563)
KVs can take up a lot of memory in the stream framework. With this change, we allocate them using z.Allocator, and allow callers to KeyToList to use the allocator to generate KVs as well. After we call Send, we release them.

Also change Stream Framework to spit out StreamDone markers.
2020-10-13 14:31:31 -07:00
c6b26d0755 Add a limit to the size of the batches sent over a stream. (#1412)
Currently, there's no limit to how many KVs can be included in a single
batch. This leads to issues when the size is over a hard limit. For
example, a batch of size > 2GB will cause issues if it has to be sent
over gRPC.

Co-authored-by: Ibrahim Jarif <ibrahim@dgraph.io>
2020-07-13 11:29:38 -07:00
Martin Martinez RiveraandGitHub b49d138829 Allow the stream framework to know the thread number (#1327)
The iterator has a new field ThreadId that is set by the stream framework. This allows
the KeyToList function which thread it's running on and can be used to simulate
thread-local storage.
2020-05-22 10:45:26 -07:00
Daniel MaiandGitHub 3ac1b68fe5 Update go.mod to v2 and add v2 import paths. (#1102)
* Update go.mod to v2 and add v2 import paths.

* Run go mod tidy.
2019-10-25 17:45:10 -07:00
Ibrahim JarifandGitHub c5ac7dbd59 Use removeDir instead of defer os.Remove in tests (#1085)
This commit refactors test code and adds `removeDir` function that
removes dir and handles returned error.
2019-10-17 18:32:32 +05:30
Francesc Campoy 74d83eea3e Removing support for Go Modules
As explained in https://discuss.dgraph.io/t/go-modules-on-badger-and-dgraph/4662,
Go Modules force an import path rename that currently breaks support for most other
dependency management systems, including dep.

It seems an effort is being made to add support for this import path renaming by
patching the go tool itself, but until the community hasn't settled and Go Modules
is an easier option to adopt, we are simply not supporting them.

For those willing to use badger v2 from Go modules it is still very simple, you might
notice that once you set the version to be v2.0.0 a +incompatible will be added to it
indicating the dependency has not opted-in into Go Modules. That's normal and not to
be a concern.
2019-06-25 10:52:36 -07:00
Francesc Campoy f530c2718a updating tests 2019-06-24 14:57:56 -07:00
Francesc Campoy 05d91d5ad8 release badger v2.0.0
Modify the import path on go.mod and every internal reference.
2019-06-20 11:02:19 -07:00
Ashish GoswamiandGitHub 0f0de55438 Have same prefix for directory in tests (#878)
Currently, we are using different prefixes for creating Badger directory in tests. This PR makes changes to have prefix badger-test in all tests.
2019-06-19 13:51:22 +05:30
Ashish GoswamiandGitHub eb1b8d94ac Breaking Change: Introduce new APIs for Entry creation/modification
* Add functions to create, modify Entry

Currently no functions are exposed to create and modify Entry, to
be set in a transaction. Functions Set, SetWithMeta, SetWithDiscard,
SetWithTTL, all are part of Txn struct. These functions internally
create an entry and then call txn.SetEntry. All of Set functions,
set a specific property of Entry apart from key and value. This
restricts us from setting multiple property for same entry such as
meta and TTL.
This PR adds functions to set different properties on an existing
Entry. After setting desired properties, user can call txn.SetEntry
to add entry in the transaction. It also removes entry related functions
from Txn Struct except SetEntry and Set.

* Fix all compilation failure due to above change using
new Entry methods.

* Fix comments from GolangCI.
2019-05-28 10:58:37 +05:30
Manish R JainandGitHub ade2e8cc30 Fix race condition in DropAll (#656)
- Fix a race condition in DropAll, caused if concurrent writes are going on.
- Use `blockWrites` during DB.Close as well, so users don't see channel panics when doing writes after DB.Close.
- Port tests over for Stream framework from Dgraph.

Changes:
* Starting to add a test for stream
* Add a test for Stream. Allow repeated calls to Orchestrate on the same Stream object.
* Fix various race conditions with concurrent writes during DropAll.
* Use blockWrites during Close as well, to avoid the chan panics users see when doing writes after Close.
* Add license for stream_test.go
* 100 chars
2018-12-30 11:35:11 -08:00