Skip to content

Commit

Permalink
send DBE_PROPERTY events only if property field actually changed
Browse files Browse the repository at this point in the history
  • Loading branch information
dirk-zimoch committed Aug 30, 2024
1 parent 052a0c7 commit 5385213
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
5 changes: 5 additions & 0 deletions documentation/RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ should also be read to understand what has changed since earlier releases:

## Changes made on the 7.0 branch since 7.0.8.1

### DBE_PROPERTY event rate changed

Updating property fields now only post DBE_PROPERTY events if the
field actually changed.

### Allow users to delete previously created records from the database

From this release, record instances and aliases that have already been loaded
Expand Down
25 changes: 18 additions & 7 deletions modules/database/src/ioc/db/dbAccess.c
Original file line number Diff line number Diff line change
Expand Up @@ -1325,6 +1325,7 @@ long dbPut(DBADDR *paddr, short dbrType,
long status = 0;
dbFldDes *pfldDes;
int isValueField;
int propertyUpdate = paddr->pfldDes->prop && precord->mlis.count;

if (special == SPC_ATTRIBUTE)
return S_db_noMod;
Expand Down Expand Up @@ -1369,8 +1370,22 @@ long dbPut(DBADDR *paddr, short dbrType,
if (nRequest < 1) {
recGblSetSevr(precord, LINK_ALARM, INVALID_ALARM);
} else {
status = dbFastPutConvertRoutine[dbrType][field_type](pbuffer,
paddr->pfield, paddr);
if (propertyUpdate && paddr->field_size <= sizeof(epicsAny)) {
epicsAny propBuffer;
status = dbFastPutConvertRoutine[dbrType][field_type](pbuffer,
&propBuffer, paddr);
if (!status) {
if (memcmp(paddr->pfield, &propBuffer, paddr->field_size) != 0) {
memcpy(paddr->pfield, &propBuffer, paddr->field_size);
} else {
/* suppress DBE_PROPERTY event if property did not change */
propertyUpdate = 0;
}
}
} else {
status = dbFastPutConvertRoutine[dbrType][field_type](pbuffer,
paddr->pfield, paddr);
}
nRequest = 1;
}
}
Expand All @@ -1391,11 +1406,7 @@ long dbPut(DBADDR *paddr, short dbrType,
if (precord->mlis.count &&
!(isValueField && pfldDes->process_passive))
db_post_events(precord, pfieldsave, DBE_VALUE | DBE_LOG);
/* If this field is a property (metadata) field,
* then post a property change event (even if the field
* didn't change).
*/
if (precord->mlis.count && pfldDes->prop)
if (propertyUpdate)
db_post_events(precord, NULL, DBE_PROPERTY);
done:
paddr->pfield = pfieldsave;
Expand Down

0 comments on commit 5385213

Please sign in to comment.