bump index format version number, start checking version on open
This commit is contained in:
parent
251e4717a2
commit
c566d34264
@ -27,7 +27,9 @@ import (
|
||||
|
||||
var VersionKey = []byte{'v'}
|
||||
|
||||
const Version uint8 = 1
|
||||
const Version uint8 = 2
|
||||
|
||||
var IncompatibleVersion = fmt.Errorf("incompatible version, %d is supported", Version)
|
||||
|
||||
type UpsideDownCouch struct {
|
||||
version uint8
|
||||
@ -83,6 +85,19 @@ func (udc *UpsideDownCouch) loadSchema(kvreader store.KVReader) (err error) {
|
||||
key, val, valid = it.Current()
|
||||
}
|
||||
|
||||
keyPrefix = []byte{'v'}
|
||||
val, err = kvreader.Get(keyPrefix)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
vr, err := NewVersionRowKV(keyPrefix, val)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if vr.version != Version {
|
||||
return IncompatibleVersion
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user