Skip to content

Commit 12f7f45

Browse files
authored
Merge branch 'main' into fix-read-only
2 parents cc7ac72 + 773a835 commit 12f7f45

4 files changed

Lines changed: 42 additions & 2 deletions

File tree

.github/workflows/cd-badger.yml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
type: string
1010

1111
permissions:
12-
contents: read
12+
contents: write
1313

1414
jobs:
1515
badger-build-amd64:
@@ -95,3 +95,25 @@ jobs:
9595
path: |
9696
badger/badger-checksum-linux-arm64.sha256
9797
badger/badger-linux-arm64.tar.gz
98+
99+
upload-to-release:
100+
runs-on: ubuntu-latest
101+
needs: [badger-build-amd64, badger-build-arm64]
102+
steps:
103+
- name: Download all build artifacts
104+
uses: actions/download-artifact@v4
105+
with:
106+
path: artifacts
107+
merge-multiple: true
108+
- name: List downloaded artifacts
109+
run: ls -alR artifacts/
110+
- name: Upload assets to GitHub Release
111+
env:
112+
GH_TOKEN: ${{ github.token }}
113+
run: |
114+
gh release upload "${{ github.event.inputs.releasetag }}" \
115+
artifacts/badger-linux-amd64.tar.gz \
116+
artifacts/badger-checksum-linux-amd64.sha256 \
117+
artifacts/badger-linux-arm64.tar.gz \
118+
artifacts/badger-checksum-linux-arm64.sha256 \
119+
--repo "${{ github.repository }}"

.trunk/trunk.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ lint:
2222
- pb/*.pb.go
2323
enabled:
2424
- golangci-lint2@2.4.0
25-
- trivy@0.64.1
25+
- trivy@0.69.3
2626
- renovate@41.76.0
2727
- actionlint@1.7.7
2828
- checkov@3.2.461

db.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,11 @@ const (
671671
// Sync syncs database content to disk. This function provides
672672
// more control to user to sync data whenever required.
673673
func (db *DB) Sync() error {
674+
if db.opt.InMemory {
675+
// InMemory mode does not use WAL/vlog files, so Sync is a no-op.
676+
return nil
677+
}
678+
674679
/**
675680
Make an attempt to sync both the logs, the active memtable's WAL and the vLog (1847).
676681
Cases:

db_test.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2159,6 +2159,19 @@ func TestSyncForReadingTheEntriesThatWereSynced(t *testing.T) {
21592159
}
21602160
}
21612161

2162+
func TestSyncInMemoryNoError(t *testing.T) {
2163+
opt := getTestOptions("")
2164+
opt.InMemory = true
2165+
2166+
runBadgerTest(t, &opt, func(t *testing.T, db *DB) {
2167+
err := db.Update(func(txn *Txn) error {
2168+
return txn.Set([]byte("key"), []byte("value"))
2169+
})
2170+
require.NoError(t, err)
2171+
require.NoError(t, db.Sync())
2172+
})
2173+
}
2174+
21622175
func TestForceFlushMemtable(t *testing.T) {
21632176
dir, err := os.MkdirTemp("", "badger-test")
21642177
require.NoError(t, err, "temp dir for badger could not be created")

0 commit comments

Comments
 (0)