Skip to content

Commit 716d7b0

Browse files
author
Harshil Goel
authored
Merge branch 'main' into dev-stream-change-max-size
2 parents 1f83b06 + 2725dc8 commit 716d7b0

File tree

19 files changed

+189
-128
lines changed

19 files changed

+189
-128
lines changed

.github/dependabot.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "gomod"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
day: "wednesday"
8+
time: "16:00"
9+
rebase-strategy: "disabled"
10+
groups:
11+
patch:
12+
update-types: ["patch"]
13+
minor:
14+
update-types: ["minor"]
15+
16+
- package-ecosystem: "github-actions"
17+
# Workflow files stored in the default location of `.github/workflows`. (You don't need to specify `/.github/workflows` for `directory`. You can use `directory: "/"`.)
18+
directory: "/"
19+
schedule:
20+
interval: "weekly"
21+
day: wednesday
22+
time: "16:00"

.github/stale.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.

.github/workflows/cd-badger.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
- name: Tar Archive for Linux Build
4646
run: cd badger && tar -zcvf badger-linux-amd64.tar.gz badger-linux-amd64
4747
- name: Upload Badger Binary Build Artifacts
48-
uses: actions/upload-artifact@v3
48+
uses: actions/upload-artifact@v4
4949
with:
5050
path: |
5151
badger/badger-checksum-linux-amd64.sha256
@@ -88,7 +88,7 @@ jobs:
8888
- name: Tar Archive for Linux Build
8989
run: cd badger && tar -zcvf badger-linux-arm64.tar.gz badger-linux-arm64
9090
- name: Upload Badger Binary Build Artifacts
91-
uses: actions/upload-artifact@v3
91+
uses: actions/upload-artifact@v4
9292
with:
9393
path: |
9494
badger/badger-checksum-linux-arm64.sha256

.github/workflows/ci-aqua-security-trivy-tests.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ on:
88
- ready_for_review
99
branches:
1010
- main
11+
schedule:
12+
- cron: "0 0 * * *"
13+
14+
permissions:
15+
security-events: write
16+
1117
jobs:
1218
build:
1319
name: trivy-tests
@@ -23,6 +29,6 @@ jobs:
2329
format: 'sarif'
2430
output: 'trivy-results.sarif'
2531
- name: Upload Trivy scan results to GitHub Security tab
26-
uses: github/codeql-action/upload-sarif@v2
32+
uses: github/codeql-action/upload-sarif@v3
2733
with:
2834
sarif_file: 'trivy-results.sarif'

.github/workflows/ci-golang-lint.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,10 @@ jobs:
2020
with:
2121
go-version: ${{ env.GOVERSION }}
2222
- name: golang-lint
23-
uses: golangci/golangci-lint-action@v4
23+
uses: golangci/golangci-lint-action@v6
2424
with:
2525
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
2626
version: latest
2727
only-new-issues: true
2828
args: --timeout=10m
29-
skip-pkg-cache: true
30-
skip-build-cache: true
29+
skip-cache: true

.github/workflows/stale.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: 'Close stale issues and PRs'
2+
on:
3+
schedule:
4+
- cron: '00 02,14 * * *'
5+
6+
permissions:
7+
issues: write
8+
pull-requests: write
9+
10+
jobs:
11+
stale:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/stale@v9
15+
with:
16+
stale-issue-message: 'This issue has been stale for 60 days and will be closed automatically in 7 days. Comment to keep it open.'
17+
stale-pr-message: 'This PR has been stale for 60 days and will be closed automatically in 7 days. Comment to keep it open.'
18+
operations-per-run: 100

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ Below is a list of known projects that use Badger:
221221
* [DVID](https://github.com/janelia-flyem/dvid) - A dataservice for branched versioning of a variety of data types. Originally created for large-scale brain reconstructions in Connectomics.
222222
* [KVS](https://github.com/tauraamui/kvs) - A library for making it easy to persist, load and query full structs into BadgerDB, using an ownership hierarchy model.
223223
* [LLS](https://github.com/Boc-chi-no/LLS) - LLS is an efficient URL Shortener that can be used to shorten links and track link usage. Support for BadgerDB and MongoDB. Improved performance by more than 30% when using BadgerDB
224+
* [lakeFS](https://github.com/treeverse/lakeFS) - lakeFS is an open-source data version control that transforms your object storage to Git-like repositories. lakeFS uses BadgerDB for its underlying local metadata KV store implementation.
224225

225226
If you are using Badger in a project please send a pull request to add it to the list.
226227

db.go

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import (
3434
humanize "github.com/dustin/go-humanize"
3535
"github.com/pkg/errors"
3636

37+
"github.com/dgraph-io/badger/v4/fb"
3738
"github.com/dgraph-io/badger/v4/options"
3839
"github.com/dgraph-io/badger/v4/pb"
3940
"github.com/dgraph-io/badger/v4/skl"
@@ -123,8 +124,8 @@ type DB struct {
123124

124125
pub *publisher
125126
registry *KeyRegistry
126-
blockCache *ristretto.Cache
127-
indexCache *ristretto.Cache
127+
blockCache *ristretto.Cache[[]byte, *table.Block]
128+
indexCache *ristretto.Cache[uint64, *fb.TableIndex]
128129
allocPool *z.AllocatorPool
129130
}
130131

@@ -165,7 +166,7 @@ func checkAndSetOptions(opt *Options) error {
165166
"reduce opt.ValueThreshold or increase opt.BaseTableSize.",
166167
opt.ValueThreshold, opt.maxBatchSize)
167168
}
168-
// ValueLogFileSize should be stricly LESS than 2<<30 otherwise we will
169+
// ValueLogFileSize should be strictly LESS than 2<<30 otherwise we will
169170
// overflow the uint32 when we mmap it in OpenMemtable.
170171
if !(opt.ValueLogFileSize < 2<<30 && opt.ValueLogFileSize >= 1<<20) {
171172
return ErrValueLogSize
@@ -274,14 +275,14 @@ func Open(opt Options) (*DB, error) {
274275
numInCache = 1
275276
}
276277

277-
config := ristretto.Config{
278+
config := ristretto.Config[[]byte, *table.Block]{
278279
NumCounters: numInCache * 8,
279280
MaxCost: opt.BlockCacheSize,
280281
BufferItems: 64,
281282
Metrics: true,
282283
OnExit: table.BlockEvictHandler,
283284
}
284-
db.blockCache, err = ristretto.NewCache(&config)
285+
db.blockCache, err = ristretto.NewCache[[]byte, *table.Block](&config)
285286
if err != nil {
286287
return nil, y.Wrap(err, "failed to create data cache")
287288
}
@@ -297,7 +298,7 @@ func Open(opt Options) (*DB, error) {
297298
numInCache = 1
298299
}
299300

300-
config := ristretto.Config{
301+
config := ristretto.Config[uint64, *fb.TableIndex]{
301302
NumCounters: numInCache * 8,
302303
MaxCost: opt.IndexCacheSize,
303304
BufferItems: 64,
@@ -402,7 +403,7 @@ func Open(opt Options) (*DB, error) {
402403
return db, nil
403404
}
404405

405-
// initBannedNamespaces retrieves the banned namepsaces from the DB and updates in-memory structure.
406+
// initBannedNamespaces retrieves the banned namespaces from the DB and updates in-memory structure.
406407
func (db *DB) initBannedNamespaces() error {
407408
if db.opt.NamespaceOffset < 0 {
408409
return nil
@@ -904,7 +905,7 @@ func (db *DB) sendToWriteCh(entries []*Entry) (*request, error) {
904905
return nil, ErrTxnTooBig
905906
}
906907

907-
// We can only service one request because we need each txn to be stored in a contigous section.
908+
// We can only service one request because we need each txn to be stored in a contiguous section.
908909
// Txns should not interleave among other txns or rewrites.
909910
req := requestPool.Get().(*request)
910911
req.reset()
@@ -1709,7 +1710,7 @@ func (db *DB) dropAll() (func(), error) {
17091710
if err != nil {
17101711
return f, err
17111712
}
1712-
// prepareToDrop will stop all the incomming write and flushes any pending memtables.
1713+
// prepareToDrop will stop all the incoming write and flushes any pending memtables.
17131714
// Before we drop, we'll stop the compaction because anyways all the datas are going to
17141715
// be deleted.
17151716
db.stopCompactions()
@@ -1752,7 +1753,7 @@ func (db *DB) dropAll() (func(), error) {
17521753

17531754
// DropPrefix would drop all the keys with the provided prefix. It does this in the following way:
17541755
// - Stop accepting new writes.
1755-
// - Stop memtable flushes before acquiring lock. Because we're acquring lock here
1756+
// - Stop memtable flushes before acquiring lock. Because we're acquiring lock here
17561757
// and memtable flush stalls for lock, which leads to deadlock
17571758
// - Flush out all memtables, skipping over keys with the given prefix, Kp.
17581759
// - Write out the value log header to memtables when flushing, so we don't accidentally bring Kp

docs/config.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
languageCode = "en-us"
22
theme = "hugo-docs"
33
canonifyURLs = false
4-
relativeURLs = true
54

65
[markup.goldmark.renderer]
76
unsafe = true

docs/content/projects-using-badger/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,6 @@ Below is a list of known projects that use Badger:
5858
* [DVID](https://github.com/janelia-flyem/dvid) - A dataservice for branched versioning of a variety of data types. Originally created for large-scale brain reconstructions in Connectomics.
5959
* [KVS](https://github.com/tauraamui/kvs) - A library for making it easy to persist, load and query full structs into BadgerDB, using an ownership hierarchy model.
6060
* [LLS](https://github.com/Boc-chi-no/LLS) - LLS is an efficient URL Shortener that can be used to shorten links and track link usage. Support for BadgerDB and MongoDB. Improved performance by more than 30% when using BadgerDB
61+
* [ActionManager](https://mftlabs.io/actionmanager) - A dynamic entity manager based on rjsf schema and badger db
6162

6263
If you are using Badger in a project please send a pull request to add it to the list.

0 commit comments

Comments
 (0)