Skip to content

Commit

Permalink
ovsdb: Strong references cascade performance fix.
Browse files Browse the repository at this point in the history
Improves the performance of OVSDB avoiding the chain
reaction produced when modifing rows with a strong
reference and the pointed rows have more strong
references.

The approach taken was using the change bitmap to avoid
triggering a change count when the column hasn't changed.

One way to trigger the issue is emulating a simple linked list
with strong references within a table, where each new row
points to the previous.

Without the fix OVSDB creates a ovsdb_txn_row (and a copy
of the row) for each row in the table.
With the fix it only creates two ovsdb_txn_row: the new row and
the directly pointed row.

Signed-off-by: Esteban Rodriguez Betancourt <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
estebarbhpe authored and blp committed Jun 23, 2016
1 parent 8a16ab9 commit 4f94601
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions ovsdb/transaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -271,16 +271,18 @@ update_row_ref_count(struct ovsdb_txn *txn, struct ovsdb_txn_row *r)
const struct ovsdb_column *column = node->data;
struct ovsdb_error *error;

if (r->old) {
error = ovsdb_txn_adjust_row_refs(txn, r->old, column, -1);
if (error) {
return OVSDB_WRAP_BUG("error decreasing refcount", error);
if (bitmap_is_set(r->changed, column->index)) {
if (r->old) {
error = ovsdb_txn_adjust_row_refs(txn, r->old, column, -1);
if (error) {
return OVSDB_WRAP_BUG("error decreasing refcount", error);
}
}
}
if (r->new) {
error = ovsdb_txn_adjust_row_refs(txn, r->new, column, 1);
if (error) {
return error;
if (r->new) {
error = ovsdb_txn_adjust_row_refs(txn, r->new, column, 1);
if (error) {
return error;
}
}
}
}
Expand Down

0 comments on commit 4f94601

Please sign in to comment.