[CBRD-26463] [POC] support replication for OOS#6813
Conversation
| const PGBUF_WATCHER heap_header_watcher, HEAP_HDR_STATS * heap_hdr, | ||
| const VPID new_next_vpid, const VPID new_last_vpid, const int new_num_pages); | ||
|
|
||
| static bool heap_recdes_contains_oos (const RECDES * record); |
There was a problem hiding this comment.
heap_file.hpp에 extern으로 선언
src/storage/heap_file.c
Outdated
| // TODO: Find a way to obtain the Replication Key at this point, or change where repl_log_insert is called. | ||
| // For now, since this is a POC, an arbitrary value is temporarily passed as a dbvalue. | ||
| repl_log_insert (thread_p, &attr_info->class_oid, &oos_oid, LOG_REPLICATION_DATA, RVREPL_OOS_INSERT, | ||
| &attr_info->values[i].dbvalue, REPL_INFO_TYPE_RBR_NORMAL); |
There was a problem hiding this comment.
replication key를 NULL로 전달하게 될 경우 NULL 체크 시 에러 발생하기 때문에 임시로 현재 dbvalue를 전달
src/storage/oos_oid_queue.cpp
Outdated
| #include "oid.h" | ||
| #include "oos_oid_queue.hpp" | ||
|
|
||
| thread_local std::deque<OID> g_oos_oid_queue; |
There was a problem hiding this comment.
OID를 queue에 넣어놨다가 사용하는 방식은 POC 수준에서 빨리 구현하기 위해 사용되었습니다.
추후 성능 측면에서 더 좋은 방식이 있다면 변경될 예정입니다.
| || (rcvindex) == RVREPL_OOS_INSERT \ | ||
| || (rcvindex) == RVREPL_OOS_DELETE) |
There was a problem hiding this comment.
OOS Replication log는 OID를 queue에 넣어 치환하는 작업을 추가로 진행해줘야하기 때문에 rcvindex 타입을 추가하였습니다.
src/transaction/locator_sr.c
Outdated
| recdes->data = recdes->data + 16; | ||
| recdes->length = recdes->length - 16; |
There was a problem hiding this comment.
현재 OOS에 저장된 recdes는 OOS_REC_HEADER + RECDES 구조로 되어있어 log에 해당 구조로 저장됩니다.
log에 저장된 data를 recovery시에는 해당 레코드가 존재했던 oid에 data를 그대로 쓰는 작업을 수행하고
replication시에는 log에 저장된 data(recdes)를 가지고 logical insert를 수행하고 있습니다.
logical insert시에 oos_insert를 호출하게 되면 전달받은 recdes 앞에 OOS_REC_HEADER를 또 추가하게 되는데, 이 때 OOS_REC_HEADER가 있음에도 불구하고 또 추가되는 문제가 발생합니다.
이 문제를 해결하기 위해 OOS_REC_HEADER의 크기인 16바이트를 제외한 영역을 recdes로 설정하는 작업입니다.
locator단에서 (int)sizeof (OOS_RECORD_HEADER)를 사용할 수 없어 임시로 16바이트 하드코딩을 해놓은 상태입니다.
추후 OOS_REC_HEADER 크기를 반환하는 함수 또는 매크로로 변경할 예정입니다.
|
/run build |
| // XXX: SHOULD BE THE LAST INCLUDE HEADER | ||
| #include "memory_wrapper.hpp" | ||
|
|
||
| struct oos_record_header |
| LOG_READ_ADD_ALIGN (thread_p, sizeof (*undoredo), &process_lsa, log_page_p); | ||
|
|
||
| //TODO : Additional handling for OOS columns in CDC will be needed later. | ||
| //TODO : Additional handling for OOS columns in CDC will be needed later. |
http://jira.cubrid.org/browse/CBRD-26463
Purpose
Implementation
Remarks
OOS INSERT 시 로직