Do XID sequences need to be contiguous?
От | Mark Dilger |
---|---|
Тема | Do XID sequences need to be contiguous? |
Дата | |
Msg-id | fb330ebf-f3f7-5fa4-30c2-5a62ed6924ce@gmail.com обсуждение исходный текст |
Ответы |
Re: Do XID sequences need to be contiguous?
Re: Do XID sequences need to be contiguous? |
Список | pgsql-hackers |
Hackers, While working on the problem of XID wraparound within the LISTEN/NOTIFY system, I tried to increment XIDs by more than one per transaction. This leads to a number of test failures, many which look like: +ERROR: could not access status of transaction 7485 +DETAIL: Could not read from file "pg_subtrans/0000" at offset 24576: read too few bytes. I might not have read the right documentation, but.... I do not see anything in src/backend/access/transam/README nor elsewhere documenting a design decision or assumption that transaction IDs must be assigned contiguously. I suppose this is such a fundamental assumption that it is completely implicit and nobody thought to document it, but I'd like to check for two reasons: First, I'd like a good method of burning through transaction ids in tests designed to check for problems in XID wrap-around. Second, I'd like to add Asserts where appropriate regarding this assumption. It seems strange to me that I should have gotten as far as a failing read() without having tripped an Assert somewhere along the way. To duplicate the errors I hit, you can either apply this simple change: diff --git a/src/include/access/transam.h b/src/include/access/transam.h index 33fd052156..360b7335bb 100644 --- a/src/include/access/transam.h +++ b/src/include/access/transam.h @@ -83,7 +83,7 @@ FullTransactionIdFromEpochAndXid(uint32 epoch, TransactionId xid) static inline void FullTransactionIdAdvance(FullTransactionId *dest) { - dest->value++; + dest->value += 2; while (XidFromFullTransactionId(*dest) < FirstNormalTransactionId) dest->value++; } or apply the much larger WIP patch, attached, and then be sure to provide the --enable-xidcheck flag to configure before building. -- Mark Dilger
Вложения
В списке pgsql-hackers по дате отправления: