private/testplanet: disable WAL for storagenodes
Change-Id: I1be4f7901c830e829118afeb90f04b87df555459
This commit is contained in:
parent
5d956c9dc5
commit
8777523255
@ -226,6 +226,8 @@ func (planet *Planet) newStorageNode(ctx context.Context, prefix string, index,
|
||||
|
||||
verisonInfo := planet.NewVersionInfo()
|
||||
|
||||
dbconfig := config.DatabaseConfig()
|
||||
dbconfig.TestingDisableWAL = true
|
||||
var db storagenode.DB
|
||||
db, err = storagenodedbtest.OpenNew(ctx, log.Named("db"), config.DatabaseConfig())
|
||||
if err != nil {
|
||||
|
@ -83,6 +83,8 @@ type Config struct {
|
||||
Driver string // if unset, uses sqlite3
|
||||
Pieces string
|
||||
Filestore filestore.Config
|
||||
|
||||
TestingDisableWAL bool
|
||||
}
|
||||
|
||||
// DB contains access to different database tables.
|
||||
@ -319,7 +321,12 @@ func (db *DB) openDatabase(ctx context.Context, dbName string) error {
|
||||
return ErrDatabase.Wrap(err)
|
||||
}
|
||||
|
||||
sqlDB, err := tagsql.Open(ctx, driver, "file:"+path+"?_journal=WAL&_busy_timeout=10000")
|
||||
wal := "&_journal=WAL"
|
||||
if db.config.TestingDisableWAL {
|
||||
wal = "&_journal=MEMORY"
|
||||
}
|
||||
|
||||
sqlDB, err := tagsql.Open(ctx, driver, "file:"+path+"?_busy_timeout=10000"+wal)
|
||||
if err != nil {
|
||||
return ErrDatabase.New("%s opening file %q failed: %w", dbName, path, err)
|
||||
}
|
||||
|
@ -71,6 +71,8 @@ func runSchemaGen(ctx context.Context, log *zap.Logger) (_ []byte, err error) {
|
||||
Info: filepath.Join(storagePath, "piecestore.db"),
|
||||
Info2: filepath.Join(storagePath, "info.db"),
|
||||
Pieces: storagePath,
|
||||
|
||||
TestingDisableWAL: true,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, errs.New("Error creating new storagenode db: %+w", err)
|
||||
|
@ -50,6 +50,8 @@ func run(ctx context.Context, outFile string) error {
|
||||
Info: filepath.Join(tempDir, "piecestore.db"),
|
||||
Info2: filepath.Join(tempDir, "info.db"),
|
||||
Pieces: tempDir,
|
||||
|
||||
TestingDisableWAL: true,
|
||||
}
|
||||
|
||||
db, err := storagenodedb.OpenNew(ctx, log, cfg)
|
||||
|
@ -41,6 +41,8 @@ func Run(t *testing.T, test func(ctx *testcontext.Context, t *testing.T, db stor
|
||||
Info2: filepath.Join(storageDir, "info.db"),
|
||||
Driver: "sqlite3+utccheck",
|
||||
Pieces: storageDir,
|
||||
|
||||
TestingDisableWAL: true,
|
||||
}
|
||||
|
||||
db, err := OpenNew(ctx, log, cfg)
|
||||
|
Loading…
Reference in New Issue
Block a user