-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CBRD-25365] Change 'Creation_time' in 'SHOW VOLUME|LOG|ARCHIVE LOG HEADER' statements to Volume creation time. #5230
[CBRD-25365] Change 'Creation_time' in 'SHOW VOLUME|LOG|ARCHIVE LOG HEADER' statements to Volume creation time. #5230
Conversation
f723921
to
c034f21
Compare
…e addition of 'vol_creation_time'.
…ge 'Creation_time' in the 'show volume header' statement to 'volume creation time' instead of 'database creation time'.
c034f21
to
0d689ad
Compare
0d689ad
to
8a45b9b
Compare
…OG_HEADER', and enabled checking the creation time of each log volume using the 'SHOW' command.
… update vol_creation_time only when a new database file is created.
8a45b9b
to
75c9960
Compare
… volume only at initial creation. Update the archive log volume creation time to reflect the time when it is archived.
src/storage/disk_manager.c
Outdated
assert (*new_dbcreation == vhdr->db_creation_time); | ||
} | ||
|
||
if ((vhdr->chkpt_lsa.pageid != new_chkptlsa->pageid) || (vhdr->chkpt_lsa.offset != new_chkptlsa->offset)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ((vhdr->chkpt_lsa.pageid != new_chkptlsa->pageid) || (vhdr->chkpt_lsa.offset != new_chkptlsa->offset)) | |
if (!LSA_EQ (&vhdr->chkpt_lsa, new_chkptlsa)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
추가적으로, is_new_db_creation == true
를 만족하는 경우에만 !LSA_EQ (&vhdr->chkpt_lsa, new_chkptlsa)
조건이 만족합니다. 따라서, if 구문을 하나로 합칠 수 있습니다.
@joohok 위 조건이 만족하지 않는 경우가 있는지 더블 체크해 주세요.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
호출관계만 간단히 봤을 땐, volume header에 저장된 checkpoint lsa와 disk_set_creation 함수가 불릴 당시의 checkpoint lsa가 같을 것이란 보장이 없을 것 같습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joohok 달라질 수 있는 예시 호출 관계 추가로 남겨주세요. 확인해 보겠습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@H2SU 위에 제안드린 if 조건식 변경 - if (!LSA_EQ (&vhdr->chkpt_lsa, new_chkptlsa))
이 아직 반영되지 않은 상태에서 리뷰가 다시 요청되었습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hornetmj
분석해보니, 현재까지의 구현에서는 is_new_db_creation == true 를 만족하는 상황에서만 !LSA_EQ (&vhdr->chkpt_lsa, new_chkptlsa) 조건을 만족시키네요. backup, restore 하는 과정에서 위 조건을 만족하지 못하는 상황이 있을 거라 짐작했는데, 아니었습니다. 하지만, assertion을 추가하여 확인해보는 것도 좋을 거라 생각됩니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수정하였습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@H2SU 지금 수정하신 것처럼 db_creation과 chkpt_lsa는 별도로 체크해 주시면 되겠습니다.
@joohok log_final() 호출 시 다음과 같이 활성 로그 볼륨 헤더의 checkpoint lsa 정보만 변경하는 로직이 있네요. 따라서, 활성 로그 볼륨의 checkpoint lsa 정보와 데이터 볼륨의 checkpoint lsa 정보가 다른 경우가 존재합니다.
// 콜스택 일부
#0 LSA_COPY (plsa1=0x7ffff707e320 <log_Gl+288>, plsa2=0x7ffff707e318 <log_Gl+280>) at ../src/transaction/log_lsa.hpp:143
#1 0x00007ffff64a7d43 in log_final (thread_p=0x698850) at ../src/transaction/log_manager.c:1798
#2 0x00007ffff6464e42 in xboot_shutdown_server (thread_p=@0x7fffffffaf60: 0x698850, is_er_final=ER_ALL_FINAL) at ../src/transa
ction/boot_sr.c:3131
// 변경된 checkpoint lsa, 데이터 볼륨 헤더는 Old value를 갖음
Old value = {pageid = 0, offset = 14248}
New value = {pageid = 136, offset = 14648}
… to db_creation and vol_creation.
585824c
to
ce79520
Compare
|
build가 실패합니다. |
8b9ecfa
to
52b85b1
Compare
빌드 실패하는 부분 전부 수정하여 반영하였습니다. |
src/storage/disk_manager.c
Outdated
@@ -599,6 +600,7 @@ disk_format (THREAD_ENTRY * thread_p, const char *dbname, VOLID volid, DBDEF_VOL | |||
vhdr->nsect_max = ext_info->nsect_max; | |||
vhdr->db_charset = lang_charset (); | |||
vhdr->hint_allocsect = NULL_SECTID; | |||
vhdr->vol_creation = time (NULL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT:
vhdr->db_creation 값을 설정하는 log_get_db_start_parameters() 호출 다음에 설정하는게 어떨까요? 이후 유지보수 관점에서 두 멤버 변수는 함께 검토되게 될 것인데, 일관되게 db_creation와 vol_creation는 순서대로 근처에서 처리되는게 좋을 것 같아요.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
그렇게 변경하는게 좀 더 가독성 측면에서도 좋은 것 같습니다. 변경했습니다
src/transaction/log_applier.c
Outdated
@@ -455,7 +455,7 @@ static void la_decache_page_buffers (LOG_PAGEID from, LOG_PAGEID to); | |||
static int la_find_required_lsa (LOG_LSA * required_lsa); | |||
|
|||
static int la_get_ha_apply_info (const char *log_path, const char *prefix_name, LA_HA_APPLY_INFO * ha_apply_info); | |||
static int la_insert_ha_apply_info (DB_DATETIME * creation_time); | |||
static int la_insert_ha_apply_info (DB_DATETIME * db_creation); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이슈와 무관한 수정입니다. 원복해 주세요.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
원복했습니다
src/transaction/log_page_buffer.c
Outdated
@@ -2344,7 +2346,7 @@ logpb_write_page_to_disk (THREAD_ENTRY * thread_p, LOG_PAGE * log_pgptr, LOG_PAG | |||
PGLENGTH | |||
logpb_find_header_parameters (THREAD_ENTRY * thread_p, const bool force_read_log_header, const char *db_fullname, | |||
const char *logpath, const char *prefix_logname, PGLENGTH * io_page_size, | |||
PGLENGTH * log_page_size, INT64 * creation_time, float *db_compatibility, int *db_charset) | |||
PGLENGTH * log_page_size, INT64 * db_creation, float *db_compatibility, int *db_charset) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이슈와 무관해 보입니다. 원복해 주세요.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
원복했습니다
52b85b1
to
e72ba1c
Compare
src/storage/disk_manager.c
Outdated
@@ -612,14 +613,14 @@ disk_format (THREAD_ENTRY * thread_p, const char *dbname, VOLID volid, DBDEF_VOL | |||
goto exit; | |||
} | |||
|
|||
/* Find the time of the creation of the database and the current LSA checkpoint. */ | |||
|
|||
/* Find the time of the creation of the database, volume and the current LSA checkpoint. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
기존 주석이 불필요한 주석 같습니다. 제거하시죠.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넵 제거하였습니다.
src/storage/disk_manager.c
Outdated
vhdr->vol_creation = time (NULL); | ||
memcpy (&vhdr->db_creation, new_dbcreation, sizeof (*new_dbcreation)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT:
vhdr->vol_creation = time (NULL); | |
memcpy (&vhdr->db_creation, new_dbcreation, sizeof (*new_dbcreation)); | |
memcpy (&vhdr->db_creation, new_dbcreation, sizeof (*new_dbcreation)); | |
vhdr->vol_creation = time (NULL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수정하였습니다.
src/transaction/log_impl.h
Outdated
@@ -1029,7 +1029,7 @@ extern int logpb_fetch_header_from_active_log (THREAD_ENTRY * thread_p, const ch | |||
extern PGLENGTH logpb_find_header_parameters (THREAD_ENTRY * thread_p, const bool force_read_log_header, | |||
const char *db_fullname, const char *logpath, | |||
const char *prefix_logname, PGLENGTH * io_page_size, | |||
PGLENGTH * log_page_size, INT64 * db_creation, float *db_compatibility, | |||
PGLENGTH * log_page_size, INT64 * creation_time, float *db_compatibility, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
원복 시 diff가 발생하면 안됩니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
해당 문제에 대해 팀즈로 질문드렸습니다!
44fa8ee
to
f58b335
Compare
f58b335
to
a7778c8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다
c931aa0
to
5d7f397
Compare
d8a0caa
to
09487ee
Compare
52ea64f
into
CUBRID:feature/show_volume_header
http://jira.cubrid.org/browse/CBRD-25365
Purpose
현재, 'SHOW VOLUME HEADER' 구문은 각 볼륨 별 생성시간을 출력하지 않습니다.
사용자의 요청에 따라 데이터베이스의 생성시간을 출력하고 있던 'Creation_time'을 각 볼륨 별 생성시간으로 변경합니다.
또한, 'SHOW VOLUME HEADER' 뿐만 아니라
'SHOW LOG HEADER', 'SHOW ARCHIVE LOG HEADER'의 'Creation_time'도 '볼륨 생성 시간'으로 변경하여 출력합니다.
Implementation
새 볼륨이 생성될 때 볼륨 생성시간을 저장하기 위해 disk_volume_header 구조체에 'vol_creation' field가 추가됩니다.
log header 구조체와 archive log header 구조체, background archive log header 구조체에 vol_creation_time 필드가 추가됩니다.
Remarks
N/A