Skip to content

Commit 00e10ab

Browse files
authored
CBG-4989 don't panic if no _vv but _sync.rev.ver on import (#7877)
1 parent f4e6253 commit 00e10ab

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

db/import_listener.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ func (il *importListener) ImportFeedEvent(ctx context.Context, collection *Datab
202202
il.importStats.ImportErrorCount.Add(1)
203203
return
204204
}
205-
var cv cvExtractor
205+
var cv *rawHLV
206206
vv := rawDoc.Xattrs[base.VvXattrName]
207207
if len(vv) > 0 {
208208
cv = base.Ptr(rawHLV(vv))

db/import_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1477,3 +1477,20 @@ func TestImportCancelOnDocWithCorruptSequenceOndemand(t *testing.T) {
14771477
}, 1)
14781478

14791479
}
1480+
1481+
func TestImportWithSyncCVAndNoVV(t *testing.T) {
1482+
db, ctx := setupTestDBWithOptionsAndImport(t, nil, DatabaseContextOptions{})
1483+
defer db.Close(ctx)
1484+
1485+
collection, ctx := GetSingleDatabaseCollectionWithUser(ctx, t, db)
1486+
docID := SafeDocumentName(t, t.Name())
1487+
1488+
_, doc, err := collection.Put(ctx, docID, Body{"foo": "baz"})
1489+
require.NoError(t, err)
1490+
1491+
err = collection.dataStore.RemoveXattrs(ctx, docID, []string{base.VvXattrName}, doc.Cas)
1492+
require.NoError(t, err)
1493+
1494+
base.RequireWaitForStat(t, db.DbStats.Database().Crc32MatchCount.Value, 1)
1495+
1496+
}

0 commit comments

Comments
 (0)