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

Disable database migration code on unsupported platforms or if the nobolt tag is present #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Elara6331
Copy link

@Elara6331 Elara6331 commented Jul 29, 2023

Currently, raft-boltdb does not compile for unsupported architectures such as RISC-V because of its dependency on the unmaintained github.com/boltdb/bolt library. It appears the only reason that dependency exists is to be able to migrate v1 databases to v2, but it's not needed for this package to work.

This PR moves the migration code and its associated unit tests to separate files and uses build tags to only build those files if the platform is supported by bolt and the nobolt tag is not set.

Here are the results of running tests on this PR:

$ go test -v
=== RUN   TestBoltStore_MigrateToV2
--- PASS: TestBoltStore_MigrateToV2 (0.00s)
=== RUN   TestBoltStore_Implements
--- PASS: TestBoltStore_Implements (0.00s)
=== RUN   TestBoltOptionsTimeout
--- PASS: TestBoltOptionsTimeout (0.05s)
=== RUN   TestBoltOptionsReadOnly
--- PASS: TestBoltOptionsReadOnly (0.00s)
=== RUN   TestNewBoltStore
--- PASS: TestNewBoltStore (0.00s)
=== RUN   TestBoltStore_FirstIndex
--- PASS: TestBoltStore_FirstIndex (0.00s)
=== RUN   TestBoltStore_LastIndex
--- PASS: TestBoltStore_LastIndex (0.00s)
=== RUN   TestBoltStore_GetLog
--- PASS: TestBoltStore_GetLog (0.00s)
=== RUN   TestBoltStore_SetLog
--- PASS: TestBoltStore_SetLog (0.00s)
=== RUN   TestBoltStore_SetLogs
--- PASS: TestBoltStore_SetLogs (0.00s)
=== RUN   TestBoltStore_DeleteRange
--- PASS: TestBoltStore_DeleteRange (0.00s)
=== RUN   TestBoltStore_Set_Get
--- PASS: TestBoltStore_Set_Get (0.00s)
=== RUN   TestBoltStore_SetUint64_GetUint64
--- PASS: TestBoltStore_SetUint64_GetUint64 (0.00s)
PASS
ok  	github.com/hashicorp/raft-boltdb/v2	0.056s

And on riscv64:

$ GOARCH=riscv64 go test -v
=== RUN   TestBoltStore_Implements
--- PASS: TestBoltStore_Implements (0.00s)
=== RUN   TestBoltOptionsTimeout
--- PASS: TestBoltOptionsTimeout (0.06s)
=== RUN   TestBoltOptionsReadOnly
--- PASS: TestBoltOptionsReadOnly (0.02s)
=== RUN   TestNewBoltStore
--- PASS: TestNewBoltStore (0.00s)
=== RUN   TestBoltStore_FirstIndex
--- PASS: TestBoltStore_FirstIndex (0.00s)
=== RUN   TestBoltStore_LastIndex
--- PASS: TestBoltStore_LastIndex (0.00s)
=== RUN   TestBoltStore_GetLog
--- PASS: TestBoltStore_GetLog (0.00s)
=== RUN   TestBoltStore_SetLog
--- PASS: TestBoltStore_SetLog (0.00s)
=== RUN   TestBoltStore_SetLogs
--- PASS: TestBoltStore_SetLogs (0.00s)
=== RUN   TestBoltStore_DeleteRange
--- PASS: TestBoltStore_DeleteRange (0.00s)
=== RUN   TestBoltStore_Set_Get
--- PASS: TestBoltStore_Set_Get (0.00s)
=== RUN   TestBoltStore_SetUint64_GetUint64
--- PASS: TestBoltStore_SetUint64_GetUint64 (0.00s)
PASS
ok  	github.com/hashicorp/raft-boltdb/v2	0.154s

Fixes #27

@hashicorp-cla
Copy link

hashicorp-cla commented Jul 29, 2023

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incompatibility with RISC-V architecture
2 participants