Skip to content

Commit

Permalink
Merge pull request #243 from dave-tucker/fix-delete
Browse files Browse the repository at this point in the history
cache: Fix Delete Handling
  • Loading branch information
dave-tucker committed Oct 12, 2021
2 parents ba06477 + c107630 commit c6d93b9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
9 changes: 5 additions & 4 deletions cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -606,10 +606,11 @@ func (t *TableCache) Populate2(tableUpdates ovsdb.TableUpdates2) {
t.eventProcessor.AddEvent(updateEvent, table, existing, modified)
}
case row.Delete != nil:
m, err := t.CreateModel(table, row.Delete, uuid)
if err != nil {
panic(err)
}
fallthrough
default:
// If everything else is nil (including Delete because it's a key with
// no value on the wire), then process a delete
m := tCache.Row(uuid)
if err := tCache.Delete(uuid); err != nil {
panic(err)
}
Expand Down
3 changes: 2 additions & 1 deletion server/transact.go
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,8 @@ func (o *OvsdbServer) Delete(database, table string, where []ovsdb.Condition) (o
panic(err)
}
tableUpdate.AddRowUpdate(uuid.(string), &ovsdb.RowUpdate2{
Delete: &oldRow,
Delete: &ovsdb.Row{},
Old: &oldRow,
})
}
return ovsdb.OperationResult{
Expand Down
6 changes: 6 additions & 0 deletions test/ovs/ovs_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,12 @@ func (suite *OVSIntegrationSuite) TestInsertAndDeleteTransactIntegration() {
}
suite.T().Fatal(err)
}

require.Eventually(suite.T(), func() bool {
br := &bridgeType{UUID: bridgeUUID}
err := suite.client.Get(br)
return err != nil
}, 2*time.Second, 500*time.Millisecond)
}

func (suite *OVSIntegrationSuite) TestTableSchemaValidationIntegration() {
Expand Down

0 comments on commit c6d93b9

Please sign in to comment.