[CBRD-27075] Fix CDC timestamp lookup on continuation-only log pages#7478
Merged
Conversation
A volume may begin with continuation-only pages whose NULL offset cannot identify a log record header. Advance only to a valid recorded page and stop at the first unflushed LSA boundary. Constraint: Timestamp lookup must not read at or beyond the NXIO boundary. Rejected: Guarding archive deletion alone | The defect reproduces without archive deletion. Confidence: high Scope-risk: narrow Directive: Preserve NULL_OFFSET handling before LOG_GET_LOG_RECORD_HEADER at log-volume start points. Tested: debug cmc/bd build-install; baseline reproduction; four fixed stress variants; GNU indent 2.2.11; git diff --check; cppcheck 2.13.0 Not-tested: Physical archive deletion was not observed; no CTest targets were configured.
Contributor
|
Reviews (1): Last reviewed commit: "[CBRD-27075] Prevent CDC time lookup fro..." | Re-trigger Greptile |
hornetmj
approved these changes
Jul 16, 2026
| */ | ||
| while (process_lsa.offset == NULL_OFFSET) | ||
| { | ||
| LOG_LSA nxio_lsa = log_Gl.append.get_nxio_lsa (); |
Contributor
There was a problem hiding this comment.
archive 경계 검사 고려
--- a/src/transaction/log_manager.c
+++ b/src/transaction/log_manager.c
@@ cdc_get_start_point_from_file (...)
LOG_LSA cur_log_lsa = LSA_INITIALIZER;
+ /* First pageid past the target archive (exclusive bound for the continuation-skip loop).
+ * Taken from the header of the very archive being processed, where npages == the number of
+ * data pages actually written by logpb_archive_active_log, so it is exact for this volume. */
+ LOG_PAGEID arv_last_pageid = NULL_PAGEID;
@@ (arv_num != -1, 이미 마운트된 archive — LOG_ARCHIVE_CS 안, arv_num 일치 보장)
process_lsa.pageid = log_Gl.archive.hdr.fpageid;
process_lsa.offset = 0;
+ arv_last_pageid = log_Gl.archive.hdr.fpageid + log_Gl.archive.hdr.npages;
}
@@ (arv_num != -1, 파일 헤더를 갓 읽은 경로 — dismount 전에 캡처)
process_lsa.pageid = arv_hdr->fpageid;
process_lsa.offset = 0;
+ arv_last_pageid = arv_hdr->fpageid + arv_hdr->npages;
fileio_dismount (thread_p, vdes);
@@ (연속-only 페이지 skip 루프)
while (process_lsa.offset == NULL_OFFSET)
{
- LOG_LSA nxio_lsa = log_Gl.append.get_nxio_lsa ();
+ /* Active volume: never cross the durable (flushed) frontier nxio_lsa.
+ * Archive volume: never read past this archive's own page range (from its header). */
+ LOG_PAGEID limit_pageid =
+ (arv_num == -1) ? log_Gl.append.get_nxio_lsa ().pageid : arv_last_pageid;
cdc_log ("%s : skip continuation-only log page %lld", __func__, (long long int) process_lsa.pageid);
process_lsa.pageid++;
- if (process_lsa.pageid >= nxio_lsa.pageid)
+ if (process_lsa.pageid >= limit_pageid)
{
ctime_r (time, ctime_buf);
er_set (ER_NOTIFICATION_SEVERITY, ARG_FILE_LINE, ER_CDC_LSA_NOT_FOUND, 1, ctime_buf);
return ER_CDC_LSA_NOT_FOUND;
}
Contributor
|
Reviews (2): Last reviewed commit: "[CBRD-27075] Limit timestamp lookup to o..." | Re-trigger Greptile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
http://jira.cubrid.org/browse/CBRD-27075
Purpose
CDC 또는 Flashback이 시간 기준으로 시작 LSA를 찾을 때, archive/active log volume의 첫 page가 이전 page에서 시작된 log record의 continuation data만 포함할 수 있다.
이 page에는 새로운
LOG_RECORD_HEADER가 없으므로LOG_PAGE_HEADER::offset이NULL_OFFSET이다. 기존cdc_get_start_point_from_file()은 이를 확인하지 않고 page data를LOG_RECORD_HEADER로 해석하여, payload 일부를forw_lsa.pageid로 사용할 수 있었다.그 결과 비정상적인 logical page ID를
logpb_fetch_page()에 전달하면서ER_LOG_PAGE_CORRUPTED가 기록되고, 시간 기반 LSA 조회가 빈 응답으로 끝날 수 있다.Implementation
src/transaction/log_manager.c—cdc_get_start_point_from_file()hdr.offset을 확인한다.hdr.offset == NULL_OFFSET이면 해당 page를 continuation-only page로 판단하고, 실제 log record header가 시작되는 다음 page까지 이동한다.logical_pageid와offset을 새 page header 기준으로 갱신한다.NXIO경계에 도달하면 page data를 잘못 해석하지 않고ER_CDC_LSA_NOT_FOUND를 반환한다.정상적인 시작 page에서는 기존 경로를 그대로 사용하며 추가 page fetch는 발생하지 않는다.
Test
4KB log page와 작은 active log volume을 사용하고, 압축되지 않는 20,000 byte
BIT VARYING값을 반복 갱신하여 log record가 여러 page 및 archive volume 경계를 넘도록 했다. 동시에 시간 기반 LSA 조회를 60회 반복했다.cdc_get_start_point_from_file()오류 stack추가로
cdc_logging_debug비활성화, archive 무제한 보관, 조회 대상 table에 committed row가 존재하는 조건에서도 조회 60회가 모두 정상 완료되고 storage 오류가 발생하지 않는 것을 확인했다.Remarks
NULL_OFFSET비교만 추가되며, continuation-only page일 때만 다음 page를 fetch한다.