slapproxy: Make rows unique for forwarded requests
Avoid bloating the proxy database due to each instance processing adding the same entries for forwarded requests as duplicate rows again and again, leading to unbounded growth.
The code for adding the entries to the database already seemed to do the right thing by using INSERT OR REPLACE
, but that SQLite command is a bit misleading: it only replaces existing rows that have the same values if the insertion would cause a UNIQUE
or PRIMARY KEY
constraint violation, so this only works as intended if the inserted combination of keys is marked as unique when the table is created. See https://www.sqlite.org/lang_conflict.html.
To fix this, the keys of the forwarded_partition_request
table are now constrained together as a PRIMARY KEY
.