Don't insert tombstone for empty prefix delete. Other minor unit test fixes

pull/3313/head
Preetha Appan 2017-07-25 21:54:11 -05:00
parent fee418d378
commit 4498814843
2 changed files with 6 additions and 4 deletions

View File

@ -430,9 +430,11 @@ func (s *Store) kvsDeleteTreeTxn(tx *memdb.Txn, idx uint64, prefix string) error
}
if deleted {
if prefix != "" { // don't insert a tombstone if the entire tree is deleted, all watchers on keys will see the max_index of the tree
if err := s.kvsGraveyard.InsertTxn(tx, prefix, idx); err != nil {
return fmt.Errorf("failed adding to graveyard: %s", err)
}
}
if err := tx.Insert("index", &IndexEntry{"kvs", idx}); err != nil {
return fmt.Errorf("failed updating index: %s", err)
}

View File

@ -698,7 +698,7 @@ func TestStateStore_Txn_KVS_RO_Safety(t *testing.T) {
expected := []string{
"cannot insert in read-only transaction",
"cannot insert in read-only transaction",
"cannot insert in read-only transaction",
"failed recursive deleting kvs entry",
}
if len(errors) != len(expected) {
t.Fatalf("bad len: %d != %d", len(errors), len(expected))