Hi,
Attached v6 which addresses the feedback from the last review.
1/ Rahila raised a point about the necessity to allocate new dsa pointers
for tranche names when copying ( during resize). That is correct. We can simply
memcpy those dsa pointers at the time of copy. All we need to
do is free the dsa pointer that tracks the list.
2/ I also implemented a full sync of the local cache when necessary.
That is the tranche name is not found locally and the tranche index is
not higher than the max used index. To do that we do have to track the
highest index used as the allocated counter is not sufficient to do this.
Allocation will grow geometrically to avoid resize operations.
3/ I also added tests using INJECTION_POINTS. Although the same tests
could be done with DEBUG, I felt INJECTION_POINTS
are better to use for this purpose to avoid unnecessary logging.
I created a test module called test_lwlock_tranches which has
a perl test because we do need to set shared_preload_libraries.
I did have to define the following in wait_classes.h:
+#define WAIT_EVENT_CLASS_MASK 0xFF000000
+#define WAIT_EVENT_ID_MASK 0x0000FFFF
This is because the extension calls
GetLWLockIdentifier ( to mimic pg_stat_activity) and
needs to calculate a classId.
--
Sami