The function static void xlog_outdesc(StringInfo buf, XLogReaderState *record);
in src/backend/access/transam/xlog.c is called by XLogInsertRecord, and after returning a string describing an XLogRecord, it clears the state data in its XLogReaderState argument. That mixes the read-only semantics of "give me a string that describes this argument" and the read-write semantics of "clear out the value in this argument". That seems ok, except that xlog_outdesc is also called by the function static void rm_redo_error_callback(const void *arg); also in xlog.c, which appears to only want the string description of the argument, and not the side effect of clearing out the value. Now, perhaps under exceptional conditions it won't matter one way or the other if the xlog record gets modified; perhaps it's going to be discarded anyway. I didn't look far enough to find out. But this is the only function of all the (void)(void *arg) callback functions in the entire postgresql source tree that modifies its argument. I discovered this while trying to convert all the callback function signatures to (void)(const void *), and this was the only monkey-wrench in the works. Is this a bug? Do I just have to live with the unfortunate lack of orthogonality in the callback mechanisms? At the very least, there should perhaps be some documentation about how all this is intended to work. Thanks, please find my work-in-progress attempt and constify-ing these functions attached. Mark Dilger
callback.patch.wip.1
Description: Binary data
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers