Changeset: dcc6f9951a32 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/dcc6f9951a32
Modified Files:
sql/storage/objectset.c
Branch: Jan2022
Log Message:
increase critical section of rw lock:
Concurrently unlocking the read lock in the rw lock is a costly operation
and when concurrently executed in a big loop becomes a major bottleneck.
Increasing the critical section to cover the entire loop, improves the
performance quite a bit.
diffs (39 lines):
diff --git a/sql/storage/objectset.c b/sql/storage/objectset.c
--- a/sql/storage/objectset.c
+++ b/sql/storage/objectset.c
@@ -1095,6 +1095,7 @@ oi_next(struct os_iter *oi)
if (oi->name) {
versionhead *n = oi->n;
+ lock_reader(oi->os); /* intentionally outside of while loop */
while (n && !b) {
if (n->ov->b->name && strcmp(n->ov->b->name, oi->name)
== 0) {
@@ -1105,24 +1106,23 @@ oi_next(struct os_iter *oi)
if (ov && os_atmc_get_state(ov) == active)
b = ov->b;
} else {
- lock_reader(oi->os);
n = oi->n = n->next;
- unlock_reader(oi->os);
}
}
+ unlock_reader(oi->os);
} else {
versionhead *n = oi->n;
+ lock_reader(oi->os); /* intentionally outside of while loop */
while (n && !b) {
objectversion *ov = n->ov;
- lock_reader(oi->os);
n = oi->n = n->next;
- unlock_reader(oi->os);
ov = get_valid_object_id(oi->tr, ov);
if (ov && os_atmc_get_state(ov) == active)
b = ov->b;
}
+ unlock_reader(oi->os);
}
return b;
}
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]