Skip to content

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