Skip to content

Commit e4d2d86

Browse files
authored
Merge pull request #326 from trozet/fix_mod_missing_column
On row modification ignore unknown columns
2 parents 5dae49b + 1e87d5a commit e4d2d86

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

cache/cache.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"crypto/sha256"
66
"encoding/gob"
77
"encoding/hex"
8+
"errors"
89
"fmt"
910
"log"
1011
"os"
@@ -1284,7 +1285,12 @@ func (t *TableCache) ApplyModifications(tableName string, base model.Model, upda
12841285
}
12851286

12861287
current, err := info.FieldByColumn(k)
1287-
if err != nil {
1288+
var colNotFoundErr *mapper.ErrColumnNotFound
1289+
if errors.As(err, &colNotFoundErr) {
1290+
// Ignore missing columns
1291+
t.logger.V(2).Info("OVSDB row modification received with missing column", "name", k)
1292+
continue
1293+
} else if err != nil {
12881294
return modified, err
12891295
}
12901296

cache/cache_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2264,6 +2264,14 @@ func TestTableCacheApplyModifications(t *testing.T) {
22642264
false,
22652265
false,
22662266
},
2267+
{
2268+
"add to set with other columns that do not exist in client schema",
2269+
ovsdb.Row{"foo": "bar", "set": aFooSet, "does": "notExist"},
2270+
&testDBModel{Set: []string{}},
2271+
&testDBModel{Set: []string{"foo"}},
2272+
true,
2273+
false,
2274+
},
22672275
}
22682276
for _, tt := range tests {
22692277
t.Run(tt.name, func(t *testing.T) {

0 commit comments

Comments
 (0)