Skip to content

Commit

Permalink
fix lateststableDump
Browse files Browse the repository at this point in the history
  • Loading branch information
majst01 committed Aug 24, 2023
1 parent 98abd10 commit 8e72438
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions cmd/internal/database/meilisearch/meilisearch.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@ import (
const (
meilisearchCmd = "meilisearch"
meilisearchVersionFile = "VERSION"
meilisearchDBDir = "data.ms"
meilisearchDumpDir = "dumps"
dumpExtension = ".dump"
latestStableDump = "forupgrade.latestdump"
)

// Meilisearch implements the database interface
type Meilisearch struct {
datadir string
dbdir string
dumpdir string
log *zap.SugaredLogger
executor *utils.CmdExecutor
Expand All @@ -45,7 +46,7 @@ func New(log *zap.SugaredLogger, datadir string, url string, apikey string) *Mei
})
return &Meilisearch{
log: log,
datadir: datadir,
dbdir: path.Join(datadir, meilisearchDBDir),
dumpdir: path.Join(datadir, meilisearchDumpDir),
executor: utils.NewExecutor(log),
client: client,
Expand Down Expand Up @@ -104,7 +105,7 @@ func (db *Meilisearch) Backup() error {

// Check implements database.Database.
func (db *Meilisearch) Check() (bool, error) {
empty, err := utils.IsEmpty(db.datadir)
empty, err := utils.IsEmpty(db.dbdir)
if err != nil {
return false, err
}
Expand Down Expand Up @@ -135,7 +136,7 @@ func (db *Meilisearch) Recover() error {
func (db *Meilisearch) Upgrade() error {
start := time.Now()

versionFile := path.Join(db.datadir, meilisearchVersionFile)
versionFile := path.Join(db.dbdir, meilisearchVersionFile)
if _, err := os.Stat(meilisearchVersionFile); errors.Is(err, fs.ErrNotExist) {
db.log.Infof("%q is not present, no upgrade required", meilisearchVersionFile)
return nil
Expand Down

0 comments on commit 8e72438

Please sign in to comment.