From f8e983ca4aa73b5909360d97331fe46ef623522d Mon Sep 17 00:00:00 2001 From: KIM HUISU Date: Thu, 22 Jan 2026 20:42:32 +0900 Subject: [PATCH 01/37] add RVREPL_OOS_* --- src/transaction/recovery.c | 14 +++++++++++++- src/transaction/recovery.h | 4 +++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/transaction/recovery.c b/src/transaction/recovery.c index 2b3e87d9b68..51135812d4a 100644 --- a/src/transaction/recovery.c +++ b/src/transaction/recovery.c @@ -847,7 +847,19 @@ struct rvfun RV_fun[] = { oos_rv_redo_insert, oos_rv_redo_delete, NULL, - NULL} + NULL}, + {RVREPL_OOS_INSERT, + "RVREPL_OOS_INSERT", + NULL, + NULL, + NULL, + repl_data_insert_log_dump}, + {RVREPL_OOS_DELETE, + "RVREPL_OOS_DELETE", + NULL, + NULL, + NULL, + repl_data_insert_log_dump}, }; /* diff --git a/src/transaction/recovery.h b/src/transaction/recovery.h index a1d3e3612cb..245697e6317 100644 --- a/src/transaction/recovery.h +++ b/src/transaction/recovery.h @@ -186,7 +186,9 @@ typedef enum RVOOS_INSERT = 129, RVOOS_DELETE = 130, - RV_LAST_LOGID = RVOOS_DELETE, + RVREPL_OOS_INSERT = 131, + RVREPL_OOS_DELETE = 132, + RV_LAST_LOGID = RVREPL_DATA_DELETE, RV_NOT_DEFINED = 999 } LOG_RCVINDEX; From d0d3d685511091e328b6a2c2b56544088c240132 Mon Sep 17 00:00:00 2001 From: KIM HUISU Date: Thu, 22 Jan 2026 20:44:06 +0900 Subject: [PATCH 02/37] add oos replication --- src/storage/heap_file.c | 7 +- src/storage/heap_file.h | 4 ++ src/storage/oos_oid_queue.cpp | 22 ++++++ src/storage/oos_oid_queue.hpp | 7 ++ src/transaction/locator.h | 3 +- src/transaction/locator_sr.c | 124 ++++++++++++++++++++++++++++++++++ src/transaction/locator_sr.h | 1 + src/transaction/log_applier.c | 5 +- 8 files changed, 170 insertions(+), 3 deletions(-) create mode 100644 src/storage/oos_oid_queue.cpp create mode 100644 src/storage/oos_oid_queue.hpp diff --git a/src/storage/heap_file.c b/src/storage/heap_file.c index 9dabedfdc15..e9b32e0e888 100644 --- a/src/storage/heap_file.c +++ b/src/storage/heap_file.c @@ -12297,6 +12297,11 @@ heap_attrinfo_insert_to_oos (THREAD_ENTRY * thread_p, HEAP_CACHE_ATTRINFO * attr { return S_ERROR; } + + // TODO : 이 때 RK를 알 수 있는 방법을 찾아야 함, POC이기 때문에 임시로 아무 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); + (*oos_oids)[i] = oos_oid; if (recdes.data != PTR_ALIGN (recbuf, MAX_ALIGNMENT)) { @@ -27596,7 +27601,7 @@ heap_log_postpone_heap_append_pages (THREAD_ENTRY * thread_p, const HFID * hfid, // *INDENT-ON* -static bool +bool heap_recdes_contains_oos (const RECDES * record) { int flag = (INT32) OR_GET_MVCC_FLAG (record->data); diff --git a/src/storage/heap_file.h b/src/storage/heap_file.h index 8f0b74b5634..37435670676 100644 --- a/src/storage/heap_file.h +++ b/src/storage/heap_file.h @@ -716,6 +716,10 @@ extern int heap_nonheader_page_capacity (); extern int heap_rv_postpone_append_pages_to_heap (THREAD_ENTRY * thread_p, LOG_RCV * recv); extern void heap_rv_dump_append_pages_to_heap (FILE * fp, int length, void *data); + +extern bool heap_oos_find_vfid (THREAD_ENTRY * thread_p, const HFID * hfid, VFID * oos_vfid, bool docreate); +extern bool heap_recdes_contains_oos (const RECDES * record); + // *INDENT-OFF* extern void heap_log_postpone_heap_append_pages (THREAD_ENTRY * thread_p, const HFID * hfid, const OID * class_oid, const std::vector &heap_pages_array); diff --git a/src/storage/oos_oid_queue.cpp b/src/storage/oos_oid_queue.cpp new file mode 100644 index 00000000000..5a2ca938fa4 --- /dev/null +++ b/src/storage/oos_oid_queue.cpp @@ -0,0 +1,22 @@ +#include +#include "oid.h" +#include "oos_oid_queue.hpp" + +thread_local std::deque g_oos_oid_queue; + +std::deque &oos_oid_queue () +{ + return g_oos_oid_queue; +} + +bool oos_oid_queue_pop (OID *out) +{ + auto &q = oos_oid_queue (); + if (q.empty ()) + { + return false; + } + *out = q.front (); + q.pop_front (); + return true; +} \ No newline at end of file diff --git a/src/storage/oos_oid_queue.hpp b/src/storage/oos_oid_queue.hpp new file mode 100644 index 00000000000..b4ec745263e --- /dev/null +++ b/src/storage/oos_oid_queue.hpp @@ -0,0 +1,7 @@ +#pragma once +#include +#include "oid.h" + +std::deque &oos_oid_queue (); + +bool oos_oid_queue_pop (OID *out); diff --git a/src/transaction/locator.h b/src/transaction/locator.h index 73f7487ae9d..7da6bef248c 100644 --- a/src/transaction/locator.h +++ b/src/transaction/locator.h @@ -111,6 +111,7 @@ typedef enum LC_FLUSH_INSERT, LC_FLUSH_INSERT_PRUNE, LC_FLUSH_INSERT_PRUNE_VERIFY, + LC_FLUSH_INSERT_OOS, LC_FLUSH_DELETE, LC_FLUSH_UPDATE, LC_FLUSH_UPDATE_PRUNE, @@ -120,7 +121,7 @@ typedef enum #define LC_IS_FLUSH_INSERT(operation) \ (operation == LC_FLUSH_INSERT || operation == LC_FLUSH_INSERT_PRUNE \ - || operation == LC_FLUSH_INSERT_PRUNE_VERIFY) + || operation == LC_FLUSH_INSERT_PRUNE_VERIFY || operation == LC_FLUSH_INSERT_OOS) #define LC_IS_FLUSH_UPDATE(operation) \ (operation == LC_FLUSH_UPDATE || operation == LC_FLUSH_UPDATE_PRUNE \ diff --git a/src/transaction/locator_sr.c b/src/transaction/locator_sr.c index fda2ef6ca7d..2995bd1fe70 100644 --- a/src/transaction/locator_sr.c +++ b/src/transaction/locator_sr.c @@ -46,6 +46,8 @@ #include "fetch.h" #include "filter_pred_cache.h" #include "heap_file.h" +#include "oos_file.hpp" +#include "oos_oid_queue.hpp" #include "list_file.h" #include "log_lsa.hpp" #include "lock_manager.h" @@ -230,6 +232,8 @@ static DB_LOGICAL locator_mvcc_reev_cond_and_assignment (THREAD_ENTRY * thread_p MVCC_REC_HEADER * mvcc_header_p, const OID * curr_row_version_oid_p, RECDES * recdes); +static int locator_fixup_oos_oids_in_recdes (THREAD_ENTRY * thread_p, const OID * class_oid, RECDES * recdes); + /* * locator_initialize () - Initialize the locator on the server * @@ -5265,6 +5269,43 @@ locator_insert_force (THREAD_ENTRY * thread_p, HFID * hfid, OID * class_oid, OID return error_code; } +int +locator_oos_insert_force (THREAD_ENTRY * thread_p, OID * class_oid, RECDES * recdes, bool is_repl) +{ + int error_code = NO_ERROR; + HFID oos_hfid = HFID_INITIALIZER; + VFID oos_vfid = VFID_INITIALIZER; + OID oos_oid = OID_INITIALIZER; + + if (heap_get_class_info (thread_p, class_oid, &oos_hfid, NULL, NULL) != NO_ERROR) + { + error_code = S_ERROR; + goto err; + } + + if (!heap_oos_find_vfid (thread_p, &oos_hfid, &oos_vfid, true)) + { + error_code = S_ERROR; + goto err; + } + + if (oos_insert (thread_p, oos_vfid, *recdes, oos_oid) != NO_ERROR) + { + error_code = S_ERROR; + goto err; + } + else + { + oos_oid_queue ().push_back (oos_oid); + } + + repl_log_insert (thread_p, class_oid, &oos_oid, LOG_REPLICATION_DATA, RVREPL_OOS_INSERT, NULL, + REPL_INFO_TYPE_RBR_NORMAL); + +err: + return error_code; +} + /* * locator_move_record () - relocate a record from a partitioned class * return : error code or NO_ERROR @@ -7002,9 +7043,20 @@ xlocator_repl_force (THREAD_ENTRY * thread_p, LC_COPYAREA * force_area, LC_COPYA if (error_code == NO_ERROR) { has_index = LC_ONEOBJ_GET_INDEX_FLAG (obj); + if (obj->operation == LC_FLUSH_INSERT && heap_recdes_contains_oos (&recdes)) + { + error_code = locator_fixup_oos_oids_in_recdes (thread_p, &obj->class_oid, &recdes); + if (error_code != NO_ERROR) + { + goto exit_on_error; + } + } switch (obj->operation) { + case LC_FLUSH_INSERT_OOS: + error_code = locator_oos_insert_force (thread_p, &obj->class_oid, &recdes, true); + break; case LC_FLUSH_INSERT: case LC_FLUSH_INSERT_PRUNE: case LC_FLUSH_INSERT_PRUNE_VERIFY: @@ -12375,6 +12427,7 @@ locator_area_op_to_pruning_type (LC_COPYAREA_OPERATION op) case LC_FLUSH_INSERT: case LC_FLUSH_UPDATE: case LC_FLUSH_DELETE: + case LC_FLUSH_INSERT_OOS: return DB_NOT_PARTITIONED_CLASS; case LC_FLUSH_INSERT_PRUNE: @@ -13930,3 +13983,74 @@ xsynonym_remove_xasl_by_oid (THREAD_ENTRY * thread_p, OID * oidp) { xcache_remove_by_oid (thread_p, oidp); } + +static int +locator_fixup_oos_oids_in_recdes (THREAD_ENTRY * thread_p, const OID * class_oid, RECDES * recdes) +{ + HEAP_CACHE_ATTRINFO attr_info; + int error = NO_ERROR; + + error = heap_attrinfo_start (thread_p, class_oid, -1, NULL, &attr_info); + if (error != NO_ERROR) + return error; + + OR_CLASSREP *classrep = attr_info.read_classrepr; + + for (int i = 0; i < classrep->n_attributes; i++) + { + OR_ATTRIBUTE *attrepr = &classrep->attributes[i]; + + if (attrepr->is_fixed != 0) + continue; + + if (OR_VAR_IS_NULL (recdes->data, attrepr->location)) + continue; + + int offset_size = OR_GET_OFFSET_SIZE (recdes->data); + int offset = 0; + + // var table 엔트리 읽기 (heap_attrvalue_point_variable()과 동일) + switch (offset_size) + { + case OR_BYTE_SIZE: + offset = OR_GET_BYTE (OR_VAR_TABLE_ELEMENT_PTR (OR_GET_OBJECT_VAR_TABLE (recdes->data), + attrepr->location, offset_size)); + break; + case OR_SHORT_SIZE: + offset = OR_GET_SHORT (OR_VAR_TABLE_ELEMENT_PTR (OR_GET_OBJECT_VAR_TABLE (recdes->data), + attrepr->location, offset_size)); + break; + case OR_INT_SIZE: + offset = OR_GET_INT (OR_VAR_TABLE_ELEMENT_PTR (OR_GET_OBJECT_VAR_TABLE (recdes->data), + attrepr->location, offset_size)); + break; + default: + assert_release (false); + error = ER_FAILED; + goto end; + } + + if (!OR_IS_OOS (offset)) + continue; + + char *oid_ptr = (char *) recdes->data + OR_VAR_OFFSET (recdes->data, attrepr->location); + + OID new_oid; + if (!oos_oid_queue_pop (&new_oid)) + { + error = ER_FAILED; + goto end; + } + + OR_BUF b; + b.buffer = (char *) recdes->data; + b.ptr = oid_ptr; + b.endptr = (char *) recdes->data + recdes->length; + + or_put_oid (&b, &new_oid); + } + +end: + heap_attrinfo_end (thread_p, &attr_info); + return error; +} diff --git a/src/transaction/locator_sr.h b/src/transaction/locator_sr.h index 6e9da85698d..ce7bad3825b 100644 --- a/src/transaction/locator_sr.h +++ b/src/transaction/locator_sr.h @@ -133,6 +133,7 @@ extern int locator_insert_force (THREAD_ENTRY * thread_p, HFID * hfid, OID * cla UPDATE_INPLACE_STYLE force_in_place, PGBUF_WATCHER * home_hint_p, bool has_BU_lock, bool dont_check_fk, bool use_bulk_logging = false); +extern int locator_oos_insert_force (THREAD_ENTRY * thread_p, HFID * hfid, OID * class_oid, OID * oid, RECDES * recdes); // *INDENT-OFF* extern int locator_multi_insert_force (THREAD_ENTRY * thread_p, HFID * hfid, OID * class_oid, const std::vector &recdes, int has_index, int op_type, diff --git a/src/transaction/log_applier.c b/src/transaction/log_applier.c index 33be549d20d..1eb30639987 100644 --- a/src/transaction/log_applier.c +++ b/src/transaction/log_applier.c @@ -4928,6 +4928,9 @@ la_repl_add_object (MOP classop, LA_ITEM * item, RECDES * recdes) case RVREPL_DATA_DELETE: operation = LC_FLUSH_DELETE; break; + case RVREPL_OOS_INSERT: + operation = LC_FLUSH_INSERT_OOS; + break; default: assert (false); } @@ -5364,7 +5367,7 @@ la_apply_insert_log (LA_ITEM * item) goto end; } - if (rcvindex != RVHF_INSERT && rcvindex != RVHF_MVCC_INSERT) + if (rcvindex != RVHF_INSERT && rcvindex != RVHF_MVCC_INSERT && rcvindex != RVOOS_INSERT) { er_log_debug (ARG_FILE_LINE, "apply_insert : rcvindex = %d\n", rcvindex); error = ER_FAILED; From 220b69cc6c2c87b03b2e540b35b060b2865f1328 Mon Sep 17 00:00:00 2001 From: KIM HUISU Date: Thu, 22 Jan 2026 20:59:55 +0900 Subject: [PATCH 03/37] fix bug --- src/storage/tde.h | 4 +++- src/transaction/log_applier.c | 1 + src/transaction/log_manager.c | 4 ++++ src/transaction/replication.c | 1 + 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/storage/tde.h b/src/storage/tde.h index 29f3c9492b3..52b0dfdb945 100644 --- a/src/storage/tde.h +++ b/src/storage/tde.h @@ -136,7 +136,9 @@ typedef struct tde_mk_file_item || (rcvindex) == RVBT_ONLINE_INDEX_UNDO_TRAN_INSERT \ || (rcvindex) == RVBT_ONLINE_INDEX_UNDO_TRAN_DELETE \ || (rcvindex) == RVOOS_INSERT \ - || (rcvindex) == RVOOS_DELETE) + || (rcvindex) == RVOOS_DELETE \ + || (rcvindex) == RVREPL_OOS_INSERT \ + || (rcvindex) == RVREPL_OOS_DELETE) #define tde_er_log(...) if (prm_get_bool_value (PRM_ID_ER_LOG_TDE)) _er_log_debug (ARG_FILE_LINE, "TDE: " __VA_ARGS__) diff --git a/src/transaction/log_applier.c b/src/transaction/log_applier.c index 1eb30639987..77bad2813ba 100644 --- a/src/transaction/log_applier.c +++ b/src/transaction/log_applier.c @@ -5811,6 +5811,7 @@ la_apply_repl_log (int tranid, int rectype, LOG_LSA * commit_lsa, int *total_row break; case RVREPL_DATA_INSERT: + case RVREPL_OOS_INSERT: error = la_apply_insert_log (item); break; diff --git a/src/transaction/log_manager.c b/src/transaction/log_manager.c index 82f5abab8da..1c2eab9186d 100644 --- a/src/transaction/log_manager.c +++ b/src/transaction/log_manager.c @@ -6616,6 +6616,10 @@ log_dump_record_replication (THREAD_ENTRY * thread_p, FILE * out_fp, LOG_LSA * l type = "RVREPL_DATA_DELETE"; dump_function = log_repl_data_dump; break; + case RVREPL_OOS_INSERT: + type = "RVREPL_OOS_INSERT"; + dump_function = log_repl_data_dump; + break; default: type = "RVREPL_SCHEMA"; dump_function = log_repl_schema_dump; diff --git a/src/transaction/replication.c b/src/transaction/replication.c index 719f4245cfb..13d4c987c5d 100644 --- a/src/transaction/replication.c +++ b/src/transaction/replication.c @@ -428,6 +428,7 @@ repl_log_insert (THREAD_ENTRY * thread_p, const OID * class_oid, const OID * ins switch (rcvindex) { case RVREPL_DATA_INSERT: + case RVREPL_OOS_INSERT: if (!LSA_ISNULL (&tdes->repl_insert_lsa)) { LSA_COPY (&repl_rec->lsa, &tdes->repl_insert_lsa); From 564c9e6b6ef96f510abe068ace30f63b4f7d037e Mon Sep 17 00:00:00 2001 From: KIM HUISU Date: Fri, 23 Jan 2026 12:27:06 +0900 Subject: [PATCH 04/37] add a record type change to REC_HOME --- src/transaction/locator_sr.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/transaction/locator_sr.c b/src/transaction/locator_sr.c index 2995bd1fe70..03d3a7fd7af 100644 --- a/src/transaction/locator_sr.c +++ b/src/transaction/locator_sr.c @@ -5289,6 +5289,7 @@ locator_oos_insert_force (THREAD_ENTRY * thread_p, OID * class_oid, RECDES * rec goto err; } + recdes->type = REC_HOME; if (oos_insert (thread_p, oos_vfid, *recdes, oos_oid) != NO_ERROR) { error_code = S_ERROR; From 415b6b25ae7c7b6deb83de619db0f0a090131fc0 Mon Sep 17 00:00:00 2001 From: KIM HUISU Date: Fri, 23 Jan 2026 13:12:30 +0900 Subject: [PATCH 05/37] fix bug --- src/transaction/locator_sr.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/transaction/locator_sr.c b/src/transaction/locator_sr.c index 03d3a7fd7af..eb099906c75 100644 --- a/src/transaction/locator_sr.c +++ b/src/transaction/locator_sr.c @@ -5295,10 +5295,8 @@ locator_oos_insert_force (THREAD_ENTRY * thread_p, OID * class_oid, RECDES * rec error_code = S_ERROR; goto err; } - else - { - oos_oid_queue ().push_back (oos_oid); - } + + oos_oid_queue ().push_back (oos_oid); repl_log_insert (thread_p, class_oid, &oos_oid, LOG_REPLICATION_DATA, RVREPL_OOS_INSERT, NULL, REPL_INFO_TYPE_RBR_NORMAL); @@ -7044,6 +7042,7 @@ xlocator_repl_force (THREAD_ENTRY * thread_p, LC_COPYAREA * force_area, LC_COPYA if (error_code == NO_ERROR) { has_index = LC_ONEOBJ_GET_INDEX_FLAG (obj); + if (obj->operation == LC_FLUSH_INSERT && heap_recdes_contains_oos (&recdes)) { error_code = locator_fixup_oos_oids_in_recdes (thread_p, &obj->class_oid, &recdes); @@ -14010,7 +14009,6 @@ locator_fixup_oos_oids_in_recdes (THREAD_ENTRY * thread_p, const OID * class_oid int offset_size = OR_GET_OFFSET_SIZE (recdes->data); int offset = 0; - // var table 엔트리 읽기 (heap_attrvalue_point_variable()과 동일) switch (offset_size) { case OR_BYTE_SIZE: From 090f18e285cbbaa57ae6ce248ba2acd0d1758cdf Mon Sep 17 00:00:00 2001 From: KIM HUISU Date: Fri, 23 Jan 2026 13:30:14 +0900 Subject: [PATCH 06/37] fix locator_fixup_oos_oids_in_recdes() --- src/storage/oos_file.cpp | 6 ++++++ src/storage/oos_file.hpp | 3 ++- src/transaction/locator_sr.c | 6 +++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/storage/oos_file.cpp b/src/storage/oos_file.cpp index 47632323b61..398ca0aca3e 100644 --- a/src/storage/oos_file.cpp +++ b/src/storage/oos_file.cpp @@ -38,6 +38,12 @@ struct oos_record_header OID next_chunk_oid; }; using OOS_RECORD_HEADER = struct oos_record_header; +constexpr size_t OOS_RECORD_HEADER_SIZE = sizeof (OOS_RECORD_HEADER); +extern constexpr size_t oos_get_oos_record_header_size () +{ + return OOS_RECORD_HEADER_SIZE; +} + // **************************************************************************** // static functions diff --git a/src/storage/oos_file.hpp b/src/storage/oos_file.hpp index 198cc2e1794..8f7a22cdeaf 100644 --- a/src/storage/oos_file.hpp +++ b/src/storage/oos_file.hpp @@ -27,4 +27,5 @@ extern int oos_insert (THREAD_ENTRY *thread_p, const VFID &oos_vfid, RECDES &rec extern int oos_read (THREAD_ENTRY *thread_p, const OID &oid, RECDES &recdes); extern int oos_rv_redo_delete (THREAD_ENTRY *thread_p, LOG_RCV *rcv); -extern int oos_rv_redo_insert (THREAD_ENTRY *thread_p, LOG_RCV *rcv); \ No newline at end of file +extern int oos_rv_redo_insert (THREAD_ENTRY *thread_p, LOG_RCV *rcv); +extern constexpr size_t oos_get_oos_record_header_size (); \ No newline at end of file diff --git a/src/transaction/locator_sr.c b/src/transaction/locator_sr.c index eb099906c75..62d4b798b8c 100644 --- a/src/transaction/locator_sr.c +++ b/src/transaction/locator_sr.c @@ -5269,6 +5269,7 @@ locator_insert_force (THREAD_ENTRY * thread_p, HFID * hfid, OID * class_oid, OID return error_code; } +#include "oos_file.hpp" int locator_oos_insert_force (THREAD_ENTRY * thread_p, OID * class_oid, RECDES * recdes, bool is_repl) { @@ -5289,6 +5290,9 @@ locator_oos_insert_force (THREAD_ENTRY * thread_p, OID * class_oid, RECDES * rec goto err; } + recdes->data = recdes->data + oos_get_oos_record_header_size (); + recdes->length = recdes->length - oos_get_oos_record_header_size (); + recdes->type = REC_HOME; if (oos_insert (thread_p, oos_vfid, *recdes, oos_oid) != NO_ERROR) { @@ -13994,7 +13998,7 @@ locator_fixup_oos_oids_in_recdes (THREAD_ENTRY * thread_p, const OID * class_oid if (error != NO_ERROR) return error; - OR_CLASSREP *classrep = attr_info.read_classrepr; + OR_CLASSREP *classrep = attr_info.last_classrepr; for (int i = 0; i < classrep->n_attributes; i++) { From 48b4baad0e4a3db24b23898161012ca9e706693c Mon Sep 17 00:00:00 2001 From: KIM HUISU Date: Fri, 23 Jan 2026 13:36:33 +0900 Subject: [PATCH 07/37] fix bug --- src/storage/oos_file.cpp | 6 ------ src/transaction/locator_sr.c | 5 ++--- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/storage/oos_file.cpp b/src/storage/oos_file.cpp index 398ca0aca3e..47632323b61 100644 --- a/src/storage/oos_file.cpp +++ b/src/storage/oos_file.cpp @@ -38,12 +38,6 @@ struct oos_record_header OID next_chunk_oid; }; using OOS_RECORD_HEADER = struct oos_record_header; -constexpr size_t OOS_RECORD_HEADER_SIZE = sizeof (OOS_RECORD_HEADER); -extern constexpr size_t oos_get_oos_record_header_size () -{ - return OOS_RECORD_HEADER_SIZE; -} - // **************************************************************************** // static functions diff --git a/src/transaction/locator_sr.c b/src/transaction/locator_sr.c index 62d4b798b8c..b4a22373760 100644 --- a/src/transaction/locator_sr.c +++ b/src/transaction/locator_sr.c @@ -5269,7 +5269,6 @@ locator_insert_force (THREAD_ENTRY * thread_p, HFID * hfid, OID * class_oid, OID return error_code; } -#include "oos_file.hpp" int locator_oos_insert_force (THREAD_ENTRY * thread_p, OID * class_oid, RECDES * recdes, bool is_repl) { @@ -5290,8 +5289,8 @@ locator_oos_insert_force (THREAD_ENTRY * thread_p, OID * class_oid, RECDES * rec goto err; } - recdes->data = recdes->data + oos_get_oos_record_header_size (); - recdes->length = recdes->length - oos_get_oos_record_header_size (); + recdes->data = recdes->data + 16; + recdes->length = recdes->length - 16; recdes->type = REC_HOME; if (oos_insert (thread_p, oos_vfid, *recdes, oos_oid) != NO_ERROR) From 01598854c2d34fd2ea4d432b90451e10e1c725e8 Mon Sep 17 00:00:00 2001 From: KIM HUISU Date: Thu, 29 Jan 2026 14:35:54 +0900 Subject: [PATCH 08/37] add oos_oid_queue.cpp in cmakelist --- cubrid/CMakeLists.txt | 1 + sa/CMakeLists.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/cubrid/CMakeLists.txt b/cubrid/CMakeLists.txt index c4600ea9b81..bdd26c3db65 100644 --- a/cubrid/CMakeLists.txt +++ b/cubrid/CMakeLists.txt @@ -454,6 +454,7 @@ set(STORAGE_SOURCES ${STORAGE_DIR}/heap_file.c ${STORAGE_DIR}/oid.c ${STORAGE_DIR}/oos_file.cpp + ${STORAGE_DIR}/oos_oid_queue.cpp ${STORAGE_DIR}/overflow_file.c ${STORAGE_DIR}/page_buffer.c ${STORAGE_DIR}/record_descriptor.cpp diff --git a/sa/CMakeLists.txt b/sa/CMakeLists.txt index 76ece8ef113..da48cdf050b 100644 --- a/sa/CMakeLists.txt +++ b/sa/CMakeLists.txt @@ -504,6 +504,7 @@ set(STORAGE_SOURCES ${STORAGE_DIR}/heap_file.c ${STORAGE_DIR}/oid.c ${STORAGE_DIR}/oos_file.cpp + ${STORAGE_DIR}/oos_oid_queue.cpp ${STORAGE_DIR}/overflow_file.c ${STORAGE_DIR}/page_buffer.c ${STORAGE_DIR}/record_descriptor.cpp From 37bde9f7af254531d01b929467ed93a4c1eaac92 Mon Sep 17 00:00:00 2001 From: KIM HUISU Date: Thu, 29 Jan 2026 14:36:30 +0900 Subject: [PATCH 09/37] remove static function (heap_recdes_contains_oos) --- src/storage/heap_file.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/storage/heap_file.c b/src/storage/heap_file.c index e9b32e0e888..220053c87c1 100644 --- a/src/storage/heap_file.c +++ b/src/storage/heap_file.c @@ -938,7 +938,6 @@ static int heap_update_and_log_header (THREAD_ENTRY * thread_p, const HFID * hfi 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); static SCAN_CODE heap_record_replace_oos_oids_with_values_if_exists (THREAD_ENTRY * thread_p, HEAP_GET_CONTEXT * context); From 9965909f73d6ba1201975ee2e777e44884430f54 Mon Sep 17 00:00:00 2001 From: KIM HUISU Date: Thu, 29 Jan 2026 15:51:28 +0900 Subject: [PATCH 10/37] change todo message --- src/storage/heap_file.c | 4 +++- src/transaction/locator_sr.c | 3 --- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/storage/heap_file.c b/src/storage/heap_file.c index 220053c87c1..396893473b2 100644 --- a/src/storage/heap_file.c +++ b/src/storage/heap_file.c @@ -12297,7 +12297,9 @@ heap_attrinfo_insert_to_oos (THREAD_ENTRY * thread_p, HEAP_CACHE_ATTRINFO * attr return S_ERROR; } - // TODO : 이 때 RK를 알 수 있는 방법을 찾아야 함, POC이기 때문에 임시로 아무 dbvalue값을 전달 + // TODO : Add a way to determine whether it is a replication target + // 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); diff --git a/src/transaction/locator_sr.c b/src/transaction/locator_sr.c index b4a22373760..77d38fe4521 100644 --- a/src/transaction/locator_sr.c +++ b/src/transaction/locator_sr.c @@ -5301,9 +5301,6 @@ locator_oos_insert_force (THREAD_ENTRY * thread_p, OID * class_oid, RECDES * rec oos_oid_queue ().push_back (oos_oid); - repl_log_insert (thread_p, class_oid, &oos_oid, LOG_REPLICATION_DATA, RVREPL_OOS_INSERT, NULL, - REPL_INFO_TYPE_RBR_NORMAL); - err: return error_code; } From 91358a7d113172a9010243bc0e8426ee957fc1f7 Mon Sep 17 00:00:00 2001 From: KIM HUISU Date: Thu, 29 Jan 2026 16:19:27 +0900 Subject: [PATCH 11/37] remove oos_get_oos_record_header_size() function --- src/storage/oos_file.hpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/storage/oos_file.hpp b/src/storage/oos_file.hpp index 8f7a22cdeaf..198cc2e1794 100644 --- a/src/storage/oos_file.hpp +++ b/src/storage/oos_file.hpp @@ -27,5 +27,4 @@ extern int oos_insert (THREAD_ENTRY *thread_p, const VFID &oos_vfid, RECDES &rec extern int oos_read (THREAD_ENTRY *thread_p, const OID &oid, RECDES &recdes); extern int oos_rv_redo_delete (THREAD_ENTRY *thread_p, LOG_RCV *rcv); -extern int oos_rv_redo_insert (THREAD_ENTRY *thread_p, LOG_RCV *rcv); -extern constexpr size_t oos_get_oos_record_header_size (); \ No newline at end of file +extern int oos_rv_redo_insert (THREAD_ENTRY *thread_p, LOG_RCV *rcv); \ No newline at end of file From 519a9978feb61269dc60ae9c8f7a0cdd390e4e13 Mon Sep 17 00:00:00 2001 From: KIM HUISU Date: Thu, 29 Jan 2026 16:19:58 +0900 Subject: [PATCH 12/37] fix locator_fixup_oos_oids_in_recdes() function --- src/transaction/locator_sr.c | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/src/transaction/locator_sr.c b/src/transaction/locator_sr.c index 77d38fe4521..075fb3947b2 100644 --- a/src/transaction/locator_sr.c +++ b/src/transaction/locator_sr.c @@ -13988,26 +13988,37 @@ static int locator_fixup_oos_oids_in_recdes (THREAD_ENTRY * thread_p, const OID * class_oid, RECDES * recdes) { HEAP_CACHE_ATTRINFO attr_info; + OR_CLASSREP *classrep = NULL; + OR_ATTRIBUTE *attrepr = NULL; + char *oid_ptr = NULL; + int offset_size = 0; + int offset = 0; int error = NO_ERROR; error = heap_attrinfo_start (thread_p, class_oid, -1, NULL, &attr_info); if (error != NO_ERROR) - return error; + { + return error; + } - OR_CLASSREP *classrep = attr_info.last_classrepr; + classrep = attr_info.last_classrepr; for (int i = 0; i < classrep->n_attributes; i++) { - OR_ATTRIBUTE *attrepr = &classrep->attributes[i]; + attrepr = &classrep->attributes[i]; if (attrepr->is_fixed != 0) - continue; + { + continue; + } if (OR_VAR_IS_NULL (recdes->data, attrepr->location)) - continue; + { + continue; + } - int offset_size = OR_GET_OFFSET_SIZE (recdes->data); - int offset = 0; + offset_size = OR_GET_OFFSET_SIZE (recdes->data); + offset = 0; switch (offset_size) { @@ -14015,14 +14026,17 @@ locator_fixup_oos_oids_in_recdes (THREAD_ENTRY * thread_p, const OID * class_oid offset = OR_GET_BYTE (OR_VAR_TABLE_ELEMENT_PTR (OR_GET_OBJECT_VAR_TABLE (recdes->data), attrepr->location, offset_size)); break; + case OR_SHORT_SIZE: offset = OR_GET_SHORT (OR_VAR_TABLE_ELEMENT_PTR (OR_GET_OBJECT_VAR_TABLE (recdes->data), attrepr->location, offset_size)); break; + case OR_INT_SIZE: offset = OR_GET_INT (OR_VAR_TABLE_ELEMENT_PTR (OR_GET_OBJECT_VAR_TABLE (recdes->data), attrepr->location, offset_size)); break; + default: assert_release (false); error = ER_FAILED; @@ -14030,9 +14044,12 @@ locator_fixup_oos_oids_in_recdes (THREAD_ENTRY * thread_p, const OID * class_oid } if (!OR_IS_OOS (offset)) - continue; + { + continue; + + } - char *oid_ptr = (char *) recdes->data + OR_VAR_OFFSET (recdes->data, attrepr->location); + oid_ptr = (char *) recdes->data + OR_VAR_OFFSET (recdes->data, attrepr->location); OID new_oid; if (!oos_oid_queue_pop (&new_oid)) From 285bfdfb9f90096e96095f98324a828fa74ad22f Mon Sep 17 00:00:00 2001 From: KIM HUISU Date: Thu, 29 Jan 2026 16:34:42 +0900 Subject: [PATCH 13/37] add TODO message --- src/transaction/locator_sr.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/transaction/locator_sr.c b/src/transaction/locator_sr.c index 075fb3947b2..ee410a0a203 100644 --- a/src/transaction/locator_sr.c +++ b/src/transaction/locator_sr.c @@ -5289,6 +5289,7 @@ locator_oos_insert_force (THREAD_ENTRY * thread_p, OID * class_oid, RECDES * rec goto err; } + //TODO : Later, change to a function or macro that returns the size of OOS_RECORD_HEADER. recdes->data = recdes->data + 16; recdes->length = recdes->length - 16; From 0ce70babad10cb858b8b6c4a6f913570e5fece0f Mon Sep 17 00:00:00 2001 From: KIM HUISU Date: Tue, 3 Feb 2026 14:57:27 +0900 Subject: [PATCH 14/37] add license --- src/storage/oos_oid_queue.cpp | 21 +++++++++++++++++++++ src/storage/oos_oid_queue.hpp | 21 +++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/src/storage/oos_oid_queue.cpp b/src/storage/oos_oid_queue.cpp index 5a2ca938fa4..aadbf6f87b2 100644 --- a/src/storage/oos_oid_queue.cpp +++ b/src/storage/oos_oid_queue.cpp @@ -1,3 +1,24 @@ +/* + * Copyright 2008 Search Solution Corporation + * Copyright 2016 CUBRID Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +/* + * oos_oid_queue.cpp + */ #include #include "oid.h" #include "oos_oid_queue.hpp" diff --git a/src/storage/oos_oid_queue.hpp b/src/storage/oos_oid_queue.hpp index b4ec745263e..3dfad7c03ce 100644 --- a/src/storage/oos_oid_queue.hpp +++ b/src/storage/oos_oid_queue.hpp @@ -1,3 +1,24 @@ +/* + * Copyright 2008 Search Solution Corporation + * Copyright 2016 CUBRID Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +/* + * oos_oid_queue.hpp + */ #pragma once #include #include "oid.h" From b70e2ae0e7870c8926677e36d3a2e68bf8e9a9cc Mon Sep 17 00:00:00 2001 From: KIM HUISU Date: Tue, 3 Feb 2026 14:57:52 +0900 Subject: [PATCH 15/37] fix RV_LAST_LOGID --- src/transaction/recovery.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/transaction/recovery.h b/src/transaction/recovery.h index 245697e6317..2cc26b0fc1c 100644 --- a/src/transaction/recovery.h +++ b/src/transaction/recovery.h @@ -188,7 +188,7 @@ typedef enum RVOOS_DELETE = 130, RVREPL_OOS_INSERT = 131, RVREPL_OOS_DELETE = 132, - RV_LAST_LOGID = RVREPL_DATA_DELETE, + RV_LAST_LOGID = RVREPL_OOS_DELETE, RV_NOT_DEFINED = 999 } LOG_RCVINDEX; From 8eb3e5464bf8bf7fe884b9d38576f65c05a76772 Mon Sep 17 00:00:00 2001 From: KIM HUISU Date: Tue, 3 Feb 2026 15:00:14 +0900 Subject: [PATCH 16/37] add oos_oid_queue_push() --- src/storage/oos_oid_queue.cpp | 7 +++++++ src/storage/oos_oid_queue.hpp | 1 + src/transaction/locator_sr.c | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/storage/oos_oid_queue.cpp b/src/storage/oos_oid_queue.cpp index aadbf6f87b2..78e5583071c 100644 --- a/src/storage/oos_oid_queue.cpp +++ b/src/storage/oos_oid_queue.cpp @@ -40,4 +40,11 @@ bool oos_oid_queue_pop (OID *out) *out = q.front (); q.pop_front (); return true; +} + +bool oos_oid_queue_push (const OID &oid) +{ + auto &q = oos_oid_queue (); + q.push_back (oid); + return true; } \ No newline at end of file diff --git a/src/storage/oos_oid_queue.hpp b/src/storage/oos_oid_queue.hpp index 3dfad7c03ce..538150173fd 100644 --- a/src/storage/oos_oid_queue.hpp +++ b/src/storage/oos_oid_queue.hpp @@ -26,3 +26,4 @@ std::deque &oos_oid_queue (); bool oos_oid_queue_pop (OID *out); +bool oos_oid_queue_push (const OID &oid); diff --git a/src/transaction/locator_sr.c b/src/transaction/locator_sr.c index ee410a0a203..1f488b9b685 100644 --- a/src/transaction/locator_sr.c +++ b/src/transaction/locator_sr.c @@ -5300,7 +5300,7 @@ locator_oos_insert_force (THREAD_ENTRY * thread_p, OID * class_oid, RECDES * rec goto err; } - oos_oid_queue ().push_back (oos_oid); + error_code = oos_oid_queue_push (oos_oid); err: return error_code; From 3ec48b9a1bd3ac1888fcc9d80f43d8dbebf7e102 Mon Sep 17 00:00:00 2001 From: KIM HUISU Date: Thu, 5 Feb 2026 18:39:51 +0900 Subject: [PATCH 17/37] remove OR_GET_INT in locator_fixup_oos_oids_in_recdes --- src/transaction/locator_sr.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/transaction/locator_sr.c b/src/transaction/locator_sr.c index 1f488b9b685..a6ef6a1766c 100644 --- a/src/transaction/locator_sr.c +++ b/src/transaction/locator_sr.c @@ -14033,11 +14033,6 @@ locator_fixup_oos_oids_in_recdes (THREAD_ENTRY * thread_p, const OID * class_oid attrepr->location, offset_size)); break; - case OR_INT_SIZE: - offset = OR_GET_INT (OR_VAR_TABLE_ELEMENT_PTR (OR_GET_OBJECT_VAR_TABLE (recdes->data), - attrepr->location, offset_size)); - break; - default: assert_release (false); error = ER_FAILED; @@ -14047,7 +14042,6 @@ locator_fixup_oos_oids_in_recdes (THREAD_ENTRY * thread_p, const OID * class_oid if (!OR_IS_OOS (offset)) { continue; - } oid_ptr = (char *) recdes->data + OR_VAR_OFFSET (recdes->data, attrepr->location); @@ -14059,12 +14053,12 @@ locator_fixup_oos_oids_in_recdes (THREAD_ENTRY * thread_p, const OID * class_oid goto end; } - OR_BUF b; - b.buffer = (char *) recdes->data; - b.ptr = oid_ptr; - b.endptr = (char *) recdes->data + recdes->length; + OR_BUF buf; + buf.buffer = (char *) recdes->data; + buf.ptr = oid_ptr; + buf.endptr = (char *) recdes->data + recdes->length; - or_put_oid (&b, &new_oid); + or_put_oid (&buf, &new_oid); } end: From 22eeece0a73a22a40aceb5b0a301904d49895bae Mon Sep 17 00:00:00 2001 From: KIM HUISU Date: Thu, 5 Feb 2026 18:43:55 +0900 Subject: [PATCH 18/37] remove is_repl param --- src/transaction/locator_sr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/transaction/locator_sr.c b/src/transaction/locator_sr.c index a6ef6a1766c..df8e98a29c5 100644 --- a/src/transaction/locator_sr.c +++ b/src/transaction/locator_sr.c @@ -5270,7 +5270,7 @@ locator_insert_force (THREAD_ENTRY * thread_p, HFID * hfid, OID * class_oid, OID } int -locator_oos_insert_force (THREAD_ENTRY * thread_p, OID * class_oid, RECDES * recdes, bool is_repl) +locator_oos_insert_force (THREAD_ENTRY * thread_p, OID * class_oid, RECDES * recdes) { int error_code = NO_ERROR; HFID oos_hfid = HFID_INITIALIZER; @@ -7056,7 +7056,7 @@ xlocator_repl_force (THREAD_ENTRY * thread_p, LC_COPYAREA * force_area, LC_COPYA switch (obj->operation) { case LC_FLUSH_INSERT_OOS: - error_code = locator_oos_insert_force (thread_p, &obj->class_oid, &recdes, true); + error_code = locator_oos_insert_force (thread_p, &obj->class_oid, &recdes); break; case LC_FLUSH_INSERT: case LC_FLUSH_INSERT_PRUNE: From b94ee64eb06fecfd1f626ae844b98369b90050dd Mon Sep 17 00:00:00 2001 From: KIM HUISU Date: Thu, 5 Feb 2026 18:52:14 +0900 Subject: [PATCH 19/37] fix codestyle --- src/transaction/log_manager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/transaction/log_manager.c b/src/transaction/log_manager.c index 1c2eab9186d..63ac74eb373 100644 --- a/src/transaction/log_manager.c +++ b/src/transaction/log_manager.c @@ -11844,7 +11844,7 @@ cdc_get_recdes (THREAD_ENTRY * thread_p, LOG_LSA * undo_lsa, RECDES * undo_recde 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. if (rcvindex == RVHF_INSERT || rcvindex == RVHF_INSERT_NEWHOME) { if (ZIP_CHECK (redo_length)) From 2f8672e4ff8d93909990b68262953af51744540c Mon Sep 17 00:00:00 2001 From: KIM HUISU Date: Wed, 11 Feb 2026 17:47:27 +0900 Subject: [PATCH 20/37] =?UTF-8?q?=EC=93=B0=EB=A0=88=EB=93=9C=20=EC=97=94?= =?UTF-8?q?=ED=8A=B8=EB=A6=AC=EC=97=90=20oos=5Foid=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/connection/server_support.c | 1 + src/thread/thread_entry.hpp | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/connection/server_support.c b/src/connection/server_support.c index a18adb528ce..40f88f24aec 100644 --- a/src/connection/server_support.c +++ b/src/connection/server_support.c @@ -2683,6 +2683,7 @@ css_set_thread_info (THREAD_ENTRY * thread_p, int client_id, int rid, int tran_i thread_p->lockwait_state = -1; thread_p->query_entry = NULL; thread_p->tran_next_wait = NULL; + thread_p->oos_oids.clear (); thread_p->end_resource_tracks (); thread_clear_recursion_depth (thread_p); diff --git a/src/thread/thread_entry.hpp b/src/thread/thread_entry.hpp index 3d8332ed2a2..8cdab676d77 100644 --- a/src/thread/thread_entry.hpp +++ b/src/thread/thread_entry.hpp @@ -37,6 +37,8 @@ #include +#include +#include "oid.h" // forward definitions // from connection_defs.h @@ -308,6 +310,8 @@ namespace cubthread bool m_skip_end_resource_tracks_in_recycle; + std::vector oos_oids; /* out-of-space OID list */ + thread_id_t get_id (); pthread_t get_posix_id (); void register_id (); From e01dd69e222c6d28536d5655c781c8f60f7baf3b Mon Sep 17 00:00:00 2001 From: KIM HUISU Date: Wed, 11 Feb 2026 17:48:36 +0900 Subject: [PATCH 21/37] =?UTF-8?q?oos=5Frec=5Fheader=20=EA=B5=AC=EC=A1=B0?= =?UTF-8?q?=EC=B2=B4=20hpp=EB=A1=9C=20=EC=9D=B4=EA=B4=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/storage/oos_file.cpp | 8 -------- src/storage/oos_file.hpp | 10 ++++++++++ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/storage/oos_file.cpp b/src/storage/oos_file.cpp index 47632323b61..f4e5ba23923 100644 --- a/src/storage/oos_file.cpp +++ b/src/storage/oos_file.cpp @@ -31,14 +31,6 @@ // XXX: SHOULD BE THE LAST INCLUDE HEADER #include "memory_wrapper.hpp" -struct oos_record_header -{ - int total_size; - int chunk_index; - OID next_chunk_oid; -}; -using OOS_RECORD_HEADER = struct oos_record_header; - // **************************************************************************** // static functions // **************************************************************************** diff --git a/src/storage/oos_file.hpp b/src/storage/oos_file.hpp index 198cc2e1794..a65015805ac 100644 --- a/src/storage/oos_file.hpp +++ b/src/storage/oos_file.hpp @@ -21,6 +21,16 @@ #include "storage_common.h" #include "thread_compat.hpp" +struct oos_record_header +{ + int total_size; + int chunk_index; + OID next_chunk_oid; +}; +using OOS_RECORD_HEADER = struct oos_record_header; + +#define OOS_RECORD_HEADER_SIZE ((int) sizeof (OOS_RECORD_HEADER)) + extern int oos_file_create (THREAD_ENTRY *thread_p, VFID &oos_vfid); extern int oos_file_destroy (THREAD_ENTRY *thread_p, const VFID &oos_vfid); extern int oos_insert (THREAD_ENTRY *thread_p, const VFID &oos_vfid, RECDES &recdes, OID &oid); From 44f36a92d294303923d8d3362f11f9c1c8fa1d0b Mon Sep 17 00:00:00 2001 From: KIM HUISU Date: Wed, 11 Feb 2026 17:49:11 +0900 Subject: [PATCH 22/37] =?UTF-8?q?OOS=5FREC=5FHEADER=5FSIZE=20=EC=82=AC?= =?UTF-8?q?=EC=9A=A9=ED=95=98=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/transaction/locator_sr.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/transaction/locator_sr.c b/src/transaction/locator_sr.c index df8e98a29c5..68d0c693370 100644 --- a/src/transaction/locator_sr.c +++ b/src/transaction/locator_sr.c @@ -5289,9 +5289,10 @@ locator_oos_insert_force (THREAD_ENTRY * thread_p, OID * class_oid, RECDES * rec goto err; } - //TODO : Later, change to a function or macro that returns the size of OOS_RECORD_HEADER. - recdes->data = recdes->data + 16; - recdes->length = recdes->length - 16; + /* The recdes data from the log includes the OOS record header. Since oos_insert adds its own header, + * we must skip the existing header to avoid duplication. */ + recdes->data = recdes->data + OOS_RECORD_HEADER_SIZE; + recdes->length = recdes->length - OOS_RECORD_HEADER_SIZE; recdes->type = REC_HOME; if (oos_insert (thread_p, oos_vfid, *recdes, oos_oid) != NO_ERROR) From 78f70caa061b7bd3963a2413da020c3a22f22962 Mon Sep 17 00:00:00 2001 From: KIM HUISU Date: Wed, 11 Feb 2026 17:50:07 +0900 Subject: [PATCH 23/37] =?UTF-8?q?oos=5Foid=EB=A5=BC=20thread=5Fp->oos=5Foi?= =?UTF-8?q?ds=EC=97=90=20=EC=A0=80=EC=9E=A5=ED=95=B4=EB=86=A8=EB=8B=A4?= =?UTF-8?q?=EA=B0=80=20=EC=82=AC=EC=9A=A9=ED=95=98=EB=8A=94=20=EB=B0=A9?= =?UTF-8?q?=EC=8B=9D=EC=9C=BC=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/storage/heap_file.c | 7 +----- src/storage/oos_file.cpp | 6 ++++++ src/storage/oos_file.hpp | 14 +++++++++++- src/transaction/locator_sr.c | 41 ++++++++++++++++++++++++------------ 4 files changed, 48 insertions(+), 20 deletions(-) diff --git a/src/storage/heap_file.c b/src/storage/heap_file.c index 396893473b2..817535f81cd 100644 --- a/src/storage/heap_file.c +++ b/src/storage/heap_file.c @@ -12297,12 +12297,7 @@ heap_attrinfo_insert_to_oos (THREAD_ENTRY * thread_p, HEAP_CACHE_ATTRINFO * attr return S_ERROR; } - // TODO : Add a way to determine whether it is a replication target - // 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); - + thread_p->oos_oids.push_back (oos_oid); // for replication log (*oos_oids)[i] = oos_oid; if (recdes.data != PTR_ALIGN (recbuf, MAX_ALIGNMENT)) { diff --git a/src/storage/oos_file.cpp b/src/storage/oos_file.cpp index f4e5ba23923..643f860a3a5 100644 --- a/src/storage/oos_file.cpp +++ b/src/storage/oos_file.cpp @@ -666,6 +666,12 @@ oos_rv_redo_insert (THREAD_ENTRY *thread_p, LOG_RCV *rcv) return NO_ERROR; } +void +oos_push_oos_oid (THREAD_ENTRY *thread_p, const OID *oid) +{ + thread_p->oos_oids.push_back (*oid); +} + #if defined(CUBRID_UNIT_TEST_ENABLED) int bridge_oos_get_max_chunk_size_within_page () diff --git a/src/storage/oos_file.hpp b/src/storage/oos_file.hpp index a65015805ac..e294da647db 100644 --- a/src/storage/oos_file.hpp +++ b/src/storage/oos_file.hpp @@ -37,4 +37,16 @@ extern int oos_insert (THREAD_ENTRY *thread_p, const VFID &oos_vfid, RECDES &rec extern int oos_read (THREAD_ENTRY *thread_p, const OID &oid, RECDES &recdes); extern int oos_rv_redo_delete (THREAD_ENTRY *thread_p, LOG_RCV *rcv); -extern int oos_rv_redo_insert (THREAD_ENTRY *thread_p, LOG_RCV *rcv); \ No newline at end of file +extern int oos_rv_redo_insert (THREAD_ENTRY *thread_p, LOG_RCV *rcv); + + +#ifdef __cplusplus +extern "C" +{ +#endif + +extern void oos_push_oos_oid (THREAD_ENTRY *thread_p, const OID *oid); + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/src/transaction/locator_sr.c b/src/transaction/locator_sr.c index 68d0c693370..9849ebfecfd 100644 --- a/src/transaction/locator_sr.c +++ b/src/transaction/locator_sr.c @@ -47,7 +47,6 @@ #include "filter_pred_cache.h" #include "heap_file.h" #include "oos_file.hpp" -#include "oos_oid_queue.hpp" #include "list_file.h" #include "log_lsa.hpp" #include "lock_manager.h" @@ -5301,7 +5300,7 @@ locator_oos_insert_force (THREAD_ENTRY * thread_p, OID * class_oid, RECDES * rec goto err; } - error_code = oos_oid_queue_push (oos_oid); + oos_push_oos_oid (thread_p, &oos_oid); err: return error_code; @@ -6982,6 +6981,7 @@ xlocator_repl_force (THREAD_ENTRY * thread_p, LC_COPYAREA * force_area, LC_COPYA HFID prev_hfid = HFID_INITIALIZER; int has_index; + assert (thread_p->oos_oids.size () == 0); //heexoo_test /* need to start a topop to ensure the atomic operation. */ error_code = xtran_server_start_topop (thread_p, &lsa); if (error_code != NO_ERROR) @@ -8088,6 +8088,17 @@ locator_add_or_remove_index_internal (THREAD_ENTRY * thread_p, RECDES * recdes, if (need_replication && index->type == BTREE_PRIMARY_KEY && error_code == NO_ERROR && !LOG_CHECK_LOG_APPLIER (thread_p) && log_does_allow_replication () == true) { + for (int i = 0; i < (int) thread_p->oos_oids.size (); i++) + { + error_code = repl_log_insert (thread_p, + class_oid, + &thread_p->oos_oids[i], + LOG_REPLICATION_DATA, + RVREPL_OOS_INSERT, key_dbvalue, REPL_INFO_TYPE_RBR_NORMAL); + } + + thread_p->oos_oids.clear (); + error_code = repl_log_insert (thread_p, class_oid, inst_oid, datayn ? LOG_REPLICATION_DATA : LOG_REPLICATION_STATEMENT, is_insert ? RVREPL_DATA_INSERT : RVREPL_DATA_DELETE, key_dbvalue, @@ -13992,11 +14003,16 @@ locator_fixup_oos_oids_in_recdes (THREAD_ENTRY * thread_p, const OID * class_oid HEAP_CACHE_ATTRINFO attr_info; OR_CLASSREP *classrep = NULL; OR_ATTRIBUTE *attrepr = NULL; + OID oos_oid = oid_Null_oid; + OR_BUF buf = { NULL, NULL, NULL, NULL }; char *oid_ptr = NULL; int offset_size = 0; int offset = 0; + int oos_oid_count = 0; int error = NO_ERROR; + assert (thread_p->oos_oids.size () > 0); + error = heap_attrinfo_start (thread_p, class_oid, -1, NULL, &attr_info); if (error != NO_ERROR) { @@ -14004,6 +14020,7 @@ locator_fixup_oos_oids_in_recdes (THREAD_ENTRY * thread_p, const OID * class_oid } classrep = attr_info.last_classrepr; + offset_size = OR_GET_OFFSET_SIZE (recdes->data); for (int i = 0; i < classrep->n_attributes; i++) { @@ -14019,7 +14036,6 @@ locator_fixup_oos_oids_in_recdes (THREAD_ENTRY * thread_p, const OID * class_oid continue; } - offset_size = OR_GET_OFFSET_SIZE (recdes->data); offset = 0; switch (offset_size) @@ -14045,21 +14061,20 @@ locator_fixup_oos_oids_in_recdes (THREAD_ENTRY * thread_p, const OID * class_oid continue; } + oos_oid = thread_p->oos_oids[oos_oid_count]; oid_ptr = (char *) recdes->data + OR_VAR_OFFSET (recdes->data, attrepr->location); - OID new_oid; - if (!oos_oid_queue_pop (&new_oid)) - { - error = ER_FAILED; - goto end; - } - - OR_BUF buf; - buf.buffer = (char *) recdes->data; buf.ptr = oid_ptr; buf.endptr = (char *) recdes->data + recdes->length; - or_put_oid (&buf, &new_oid); + or_put_oid (&buf, &oos_oid); + + oos_oid_count++; + + if (oos_oid_count >= (int) thread_p->oos_oids.size ()) + { + goto end; + } } end: From 5865abaca65a53dc38777f44e05b22ab3ded688c Mon Sep 17 00:00:00 2001 From: KIM HUISU Date: Wed, 11 Feb 2026 18:49:57 +0900 Subject: [PATCH 24/37] fix oos repl log insert --- src/transaction/locator_sr.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/transaction/locator_sr.c b/src/transaction/locator_sr.c index 9849ebfecfd..54884f20183 100644 --- a/src/transaction/locator_sr.c +++ b/src/transaction/locator_sr.c @@ -8088,16 +8088,20 @@ locator_add_or_remove_index_internal (THREAD_ENTRY * thread_p, RECDES * recdes, if (need_replication && index->type == BTREE_PRIMARY_KEY && error_code == NO_ERROR && !LOG_CHECK_LOG_APPLIER (thread_p) && log_does_allow_replication () == true) { - for (int i = 0; i < (int) thread_p->oos_oids.size (); i++) + if (heap_recdes_contains_oos (recdes)) { - error_code = repl_log_insert (thread_p, - class_oid, - &thread_p->oos_oids[i], - LOG_REPLICATION_DATA, - RVREPL_OOS_INSERT, key_dbvalue, REPL_INFO_TYPE_RBR_NORMAL); - } + // insert oos replication log + for (int i = 0; i < (int) thread_p->oos_oids.size (); i++) + { + error_code = repl_log_insert (thread_p, + class_oid, + &thread_p->oos_oids[i], + LOG_REPLICATION_DATA, + RVREPL_OOS_INSERT, key_dbvalue, REPL_INFO_TYPE_RBR_NORMAL); + } - thread_p->oos_oids.clear (); + thread_p->oos_oids.clear (); + } error_code = repl_log_insert (thread_p, class_oid, inst_oid, datayn ? LOG_REPLICATION_DATA : LOG_REPLICATION_STATEMENT, From edcee87b915b405b3eb6796c1fd3dcd6cde35076 Mon Sep 17 00:00:00 2001 From: KIM HUISU Date: Wed, 11 Feb 2026 18:57:11 +0900 Subject: [PATCH 25/37] debug code --- src/transaction/replication.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/transaction/replication.c b/src/transaction/replication.c index 13d4c987c5d..d4becc01c4a 100644 --- a/src/transaction/replication.c +++ b/src/transaction/replication.c @@ -458,6 +458,7 @@ repl_log_insert (THREAD_ENTRY * thread_p, const OID * class_oid, const OID * ins } break; default: + assert (false); break; } tdes->cur_repl_record++; From 31997fcccc7ee35a7e0e06719c5a90dc0e24567c Mon Sep 17 00:00:00 2001 From: KIM HUISU Date: Thu, 12 Feb 2026 12:58:46 +0900 Subject: [PATCH 26/37] add oos_insert_lsa_queue in tdes --- src/storage/heap_file.c | 17 ++++++++++++- src/transaction/log_impl.h | 1 + src/transaction/log_lsa.hpp | 43 ++++++++++++++++++++++++++++++++ src/transaction/log_manager.c | 28 ++++++++++++++++----- src/transaction/log_tran_table.c | 2 ++ src/transaction/replication.c | 12 ++++++++- 6 files changed, 95 insertions(+), 8 deletions(-) diff --git a/src/storage/heap_file.c b/src/storage/heap_file.c index 817535f81cd..e5d348e5de3 100644 --- a/src/storage/heap_file.c +++ b/src/storage/heap_file.c @@ -12263,6 +12263,8 @@ heap_attrinfo_insert_to_oos (THREAD_ENTRY * thread_p, HEAP_CACHE_ATTRINFO * attr VFID oos_vfid; OID oos_oid; RECDES recdes; + LOG_TDES *tdes; + int tran_index; int i; recdes.area_size = IO_MAX_PAGE_SIZE; @@ -12279,6 +12281,19 @@ heap_attrinfo_insert_to_oos (THREAD_ENTRY * thread_p, HEAP_CACHE_ATTRINFO * attr return S_ERROR; } + /* Find transaction descriptor for current logging transaction */ + tran_index = LOG_FIND_THREAD_TRAN_INDEX (thread_p); + tdes = LOG_FIND_TDES (tran_index); + if (tdes == NULL) + { + er_set (ER_FATAL_ERROR_SEVERITY, ARG_FILE_LINE, ER_LOG_UNKNOWN_TRANINDEX, 1, tran_index); + return S_ERROR; + } + + /* init oos tracking info */ + tdes->oos_insert_lsa_queue.clear (); + thread_p->oos_oids.clear (); + for (i = 0; i < attr_info->num_values; i++) { /* is this oos column ? */ @@ -12297,7 +12312,7 @@ heap_attrinfo_insert_to_oos (THREAD_ENTRY * thread_p, HEAP_CACHE_ATTRINFO * attr return S_ERROR; } - thread_p->oos_oids.push_back (oos_oid); // for replication log + thread_p->oos_oids.push_back (oos_oid); /* for replication log */ (*oos_oids)[i] = oos_oid; if (recdes.data != PTR_ALIGN (recbuf, MAX_ALIGNMENT)) { diff --git a/src/transaction/log_impl.h b/src/transaction/log_impl.h index 060d1b0c16c..7474f1f03a2 100644 --- a/src/transaction/log_impl.h +++ b/src/transaction/log_impl.h @@ -526,6 +526,7 @@ struct log_tdes struct log_repl *repl_records; /* replication records */ LOG_LSA repl_insert_lsa; /* insert or mvcc update target lsa */ LOG_LSA repl_update_lsa; /* in-place update target lsa */ + LOG_LSA_QUEUE oos_insert_lsa_queue; /* for oos replication log */ void *first_save_entry; /* first save entry for the transaction */ int suppress_replication; /* suppress writing replication logs when flag is set */ diff --git a/src/transaction/log_lsa.hpp b/src/transaction/log_lsa.hpp index 957f5b80966..7112c5b2213 100644 --- a/src/transaction/log_lsa.hpp +++ b/src/transaction/log_lsa.hpp @@ -27,6 +27,7 @@ #define Wrong module #endif +#include #include #include #include @@ -74,6 +75,48 @@ constexpr log_lsa MAX_LSA = { MAX_LOG_LSA_PAGEID, MAX_LOG_LSA_OFFSET }; // functions void lsa_to_string (char *buf, int buf_size, const log_lsa *lsa); +// log_lsa_queue +struct log_lsa_queue +{ + std::vector m_queue; + std::size_t m_head = 0; + + inline void push (const LOG_LSA &lsa) + { + m_queue.push_back (lsa); + } + + inline bool is_empty () const + { + return m_head >= m_queue.size (); + } + + inline LOG_LSA pop () + { + assert (!is_empty ()); + return m_queue[m_head++]; + } + + inline const LOG_LSA &front () const + { + assert (!is_empty ()); + return m_queue[m_head]; + } + + inline std::size_t size () const + { + return m_queue.size () - m_head; + } + + inline void clear () + { + m_queue.clear (); + m_head = 0; + } +}; + +using LOG_LSA_QUEUE = log_lsa_queue; + // // macro replacements // diff --git a/src/transaction/log_manager.c b/src/transaction/log_manager.c index 63ac74eb373..5cbf472711e 100644 --- a/src/transaction/log_manager.c +++ b/src/transaction/log_manager.c @@ -2198,13 +2198,21 @@ log_append_undoredo_crumbs (THREAD_ENTRY * thread_p, LOG_RCVINDEX rcvindex, LOG_ || rcvindex == RVHF_INSERT_NEWHOME) { LSA_COPY (&tdes->repl_update_lsa, &tdes->tail_lsa); - assert (tdes->is_active_worker_transaction ()); } - else if (rcvindex == RVHF_INSERT || rcvindex == RVHF_MVCC_INSERT || rcvindex == RVOOS_INSERT) + else if (rcvindex == RVHF_INSERT || rcvindex == RVHF_MVCC_INSERT) { LSA_COPY (&tdes->repl_insert_lsa, &tdes->tail_lsa); - assert (tdes->is_active_worker_transaction ()); } + else if (rcvindex == RVOOS_INSERT) + { + tdes->oos_insert_lsa_queue.push (tdes->tail_lsa); + } + else + { + assert (false); + } + + assert (tdes->is_active_worker_transaction ()); } } @@ -2462,13 +2470,21 @@ log_append_redo_crumbs (THREAD_ENTRY * thread_p, LOG_RCVINDEX rcvindex, LOG_DATA if (rcvindex == RVHF_UPDATE || rcvindex == RVOVF_CHANGE_LINK || rcvindex == RVHF_UPDATE_NOTIFY_VACUUM) { LSA_COPY (&tdes->repl_update_lsa, &tdes->tail_lsa); - assert (tdes->is_active_worker_transaction ()); } - else if (rcvindex == RVHF_INSERT || rcvindex == RVHF_MVCC_INSERT || rcvindex == RVOOS_INSERT) + else if (rcvindex == RVHF_INSERT || rcvindex == RVHF_MVCC_INSERT) { LSA_COPY (&tdes->repl_insert_lsa, &tdes->tail_lsa); - assert (tdes->is_active_worker_transaction ()); } + else if (rcvindex == RVOOS_INSERT) + { + tdes->oos_insert_lsa_queue.push (tdes->tail_lsa); + } + else + { + assert (false); + } + + assert (tdes->is_active_worker_transaction ()); } } diff --git a/src/transaction/log_tran_table.c b/src/transaction/log_tran_table.c index f0d0e61af68..982c004ea44 100644 --- a/src/transaction/log_tran_table.c +++ b/src/transaction/log_tran_table.c @@ -1559,6 +1559,7 @@ logtb_clear_tdes (THREAD_ENTRY * thread_p, LOG_TDES * tdes) tdes->fl_mark_repl_recidx = -1; LSA_SET_NULL (&tdes->repl_insert_lsa); LSA_SET_NULL (&tdes->repl_update_lsa); + tdes->oos_insert_lsa_queue.clear (); tdes->first_save_entry = NULL; tdes->query_timeout = 0; tdes->query_start_time = 0; @@ -1647,6 +1648,7 @@ logtb_initialize_tdes (LOG_TDES * tdes, int tran_index) tdes->repl_records = NULL; LSA_SET_NULL (&tdes->repl_insert_lsa); LSA_SET_NULL (&tdes->repl_update_lsa); + tdes->oos_insert_lsa_queue.clear (); tdes->first_save_entry = NULL; tdes->suppress_replication = 0; tdes->lob_locator_root.init (); diff --git a/src/transaction/replication.c b/src/transaction/replication.c index d4becc01c4a..0ecf43436d6 100644 --- a/src/transaction/replication.c +++ b/src/transaction/replication.c @@ -428,7 +428,6 @@ repl_log_insert (THREAD_ENTRY * thread_p, const OID * class_oid, const OID * ins switch (rcvindex) { case RVREPL_DATA_INSERT: - case RVREPL_OOS_INSERT: if (!LSA_ISNULL (&tdes->repl_insert_lsa)) { LSA_COPY (&repl_rec->lsa, &tdes->repl_insert_lsa); @@ -457,6 +456,17 @@ repl_log_insert (THREAD_ENTRY * thread_p, const OID * class_oid, const OID * ins LSA_COPY (&repl_rec->lsa, &tdes->tail_lsa); } break; + case RVREPL_OOS_INSERT: + if (!tdes->oos_insert_lsa_queue.is_empty ()) + { + LOG_LSA oos_lsa = tdes->oos_insert_lsa_queue.pop (); + LSA_COPY (&repl_rec->lsa, &oos_lsa); + } + else + { + assert (false); + } + break; default: assert (false); break; From 8268ad81c8c7d7409b70ff28c4df5bd038448681 Mon Sep 17 00:00:00 2001 From: KIM HUISU Date: Thu, 12 Feb 2026 12:59:06 +0900 Subject: [PATCH 27/37] fix oos_oids.clear code --- src/transaction/locator_sr.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/transaction/locator_sr.c b/src/transaction/locator_sr.c index 54884f20183..991b2cf56d9 100644 --- a/src/transaction/locator_sr.c +++ b/src/transaction/locator_sr.c @@ -6982,6 +6982,8 @@ xlocator_repl_force (THREAD_ENTRY * thread_p, LC_COPYAREA * force_area, LC_COPYA int has_index; assert (thread_p->oos_oids.size () == 0); //heexoo_test + thread_p->oos_oids.clear (); + /* need to start a topop to ensure the atomic operation. */ error_code = xtran_server_start_topop (thread_p, &lsa); if (error_code != NO_ERROR) @@ -7131,6 +7133,11 @@ xlocator_repl_force (THREAD_ENTRY * thread_p, LC_COPYAREA * force_area, LC_COPYA (void) xtran_server_end_topop (thread_p, LOG_RESULT_TOPOP_ATTACH_TO_OUTER, &oneobj_lsa); } pr_clear_value (&key_value); + + if (obj->operation != LC_FLUSH_INSERT_OOS) + { + thread_p->oos_oids.clear (); + } } if (force_scancache != NULL) @@ -8099,8 +8106,6 @@ locator_add_or_remove_index_internal (THREAD_ENTRY * thread_p, RECDES * recdes, LOG_REPLICATION_DATA, RVREPL_OOS_INSERT, key_dbvalue, REPL_INFO_TYPE_RBR_NORMAL); } - - thread_p->oos_oids.clear (); } error_code = From 4ea29951221c4a4817e8d62c1b437b825a1f2ade Mon Sep 17 00:00:00 2001 From: KIM HUISU Date: Thu, 12 Feb 2026 18:20:46 +0900 Subject: [PATCH 28/37] revert --- src/transaction/log_manager.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/transaction/log_manager.c b/src/transaction/log_manager.c index 5cbf472711e..636661396e4 100644 --- a/src/transaction/log_manager.c +++ b/src/transaction/log_manager.c @@ -2198,21 +2198,17 @@ log_append_undoredo_crumbs (THREAD_ENTRY * thread_p, LOG_RCVINDEX rcvindex, LOG_ || rcvindex == RVHF_INSERT_NEWHOME) { LSA_COPY (&tdes->repl_update_lsa, &tdes->tail_lsa); + assert (tdes->is_active_worker_transaction ()); } else if (rcvindex == RVHF_INSERT || rcvindex == RVHF_MVCC_INSERT) { LSA_COPY (&tdes->repl_insert_lsa, &tdes->tail_lsa); + assert (tdes->is_active_worker_transaction ()); } else if (rcvindex == RVOOS_INSERT) { tdes->oos_insert_lsa_queue.push (tdes->tail_lsa); } - else - { - assert (false); - } - - assert (tdes->is_active_worker_transaction ()); } } @@ -2470,21 +2466,18 @@ log_append_redo_crumbs (THREAD_ENTRY * thread_p, LOG_RCVINDEX rcvindex, LOG_DATA if (rcvindex == RVHF_UPDATE || rcvindex == RVOVF_CHANGE_LINK || rcvindex == RVHF_UPDATE_NOTIFY_VACUUM) { LSA_COPY (&tdes->repl_update_lsa, &tdes->tail_lsa); + assert (tdes->is_active_worker_transaction ()); } else if (rcvindex == RVHF_INSERT || rcvindex == RVHF_MVCC_INSERT) { LSA_COPY (&tdes->repl_insert_lsa, &tdes->tail_lsa); + assert (tdes->is_active_worker_transaction ()); } else if (rcvindex == RVOOS_INSERT) { tdes->oos_insert_lsa_queue.push (tdes->tail_lsa); + assert (tdes->is_active_worker_transaction ()); } - else - { - assert (false); - } - - assert (tdes->is_active_worker_transaction ()); } } From dc4016f8ca4a0f535a052b7d5eb386d33bf5dbd2 Mon Sep 17 00:00:00 2001 From: KIM HUISU Date: Thu, 12 Feb 2026 18:21:38 +0900 Subject: [PATCH 29/37] remove debug code --- src/transaction/replication.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/transaction/replication.c b/src/transaction/replication.c index 0ecf43436d6..0686b9bd3b6 100644 --- a/src/transaction/replication.c +++ b/src/transaction/replication.c @@ -468,7 +468,6 @@ repl_log_insert (THREAD_ENTRY * thread_p, const OID * class_oid, const OID * ins } break; default: - assert (false); break; } tdes->cur_repl_record++; From 28492b85fc25acce6b2c9636e43fd823ecc771e4 Mon Sep 17 00:00:00 2001 From: KIM HUISU Date: Thu, 12 Feb 2026 18:23:05 +0900 Subject: [PATCH 30/37] Revert "add oos_oid_queue.cpp in cmakelist" This reverts commit 01598854c2d34fd2ea4d432b90451e10e1c725e8. --- cubrid/CMakeLists.txt | 1 - sa/CMakeLists.txt | 1 - 2 files changed, 2 deletions(-) diff --git a/cubrid/CMakeLists.txt b/cubrid/CMakeLists.txt index bdd26c3db65..c4600ea9b81 100644 --- a/cubrid/CMakeLists.txt +++ b/cubrid/CMakeLists.txt @@ -454,7 +454,6 @@ set(STORAGE_SOURCES ${STORAGE_DIR}/heap_file.c ${STORAGE_DIR}/oid.c ${STORAGE_DIR}/oos_file.cpp - ${STORAGE_DIR}/oos_oid_queue.cpp ${STORAGE_DIR}/overflow_file.c ${STORAGE_DIR}/page_buffer.c ${STORAGE_DIR}/record_descriptor.cpp diff --git a/sa/CMakeLists.txt b/sa/CMakeLists.txt index da48cdf050b..76ece8ef113 100644 --- a/sa/CMakeLists.txt +++ b/sa/CMakeLists.txt @@ -504,7 +504,6 @@ set(STORAGE_SOURCES ${STORAGE_DIR}/heap_file.c ${STORAGE_DIR}/oid.c ${STORAGE_DIR}/oos_file.cpp - ${STORAGE_DIR}/oos_oid_queue.cpp ${STORAGE_DIR}/overflow_file.c ${STORAGE_DIR}/page_buffer.c ${STORAGE_DIR}/record_descriptor.cpp From b2b7bff31e2fb280638248bfb524c352c8deab63 Mon Sep 17 00:00:00 2001 From: KIM HUISU Date: Thu, 12 Feb 2026 18:23:43 +0900 Subject: [PATCH 31/37] delete oos_oid_queue file --- src/storage/oos_oid_queue.cpp | 50 ----------------------------------- src/storage/oos_oid_queue.hpp | 29 -------------------- 2 files changed, 79 deletions(-) delete mode 100644 src/storage/oos_oid_queue.cpp delete mode 100644 src/storage/oos_oid_queue.hpp diff --git a/src/storage/oos_oid_queue.cpp b/src/storage/oos_oid_queue.cpp deleted file mode 100644 index 78e5583071c..00000000000 --- a/src/storage/oos_oid_queue.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2008 Search Solution Corporation - * Copyright 2016 CUBRID Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -/* - * oos_oid_queue.cpp - */ -#include -#include "oid.h" -#include "oos_oid_queue.hpp" - -thread_local std::deque g_oos_oid_queue; - -std::deque &oos_oid_queue () -{ - return g_oos_oid_queue; -} - -bool oos_oid_queue_pop (OID *out) -{ - auto &q = oos_oid_queue (); - if (q.empty ()) - { - return false; - } - *out = q.front (); - q.pop_front (); - return true; -} - -bool oos_oid_queue_push (const OID &oid) -{ - auto &q = oos_oid_queue (); - q.push_back (oid); - return true; -} \ No newline at end of file diff --git a/src/storage/oos_oid_queue.hpp b/src/storage/oos_oid_queue.hpp deleted file mode 100644 index 538150173fd..00000000000 --- a/src/storage/oos_oid_queue.hpp +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2008 Search Solution Corporation - * Copyright 2016 CUBRID Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -/* - * oos_oid_queue.hpp - */ -#pragma once -#include -#include "oid.h" - -std::deque &oos_oid_queue (); - -bool oos_oid_queue_pop (OID *out); -bool oos_oid_queue_push (const OID &oid); From b9d391bdd43f9bfdd6164a4d9281a458f813e12c Mon Sep 17 00:00:00 2001 From: KIM HUISU Date: Thu, 12 Feb 2026 18:33:23 +0900 Subject: [PATCH 32/37] fix --- src/thread/thread_entry.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/thread/thread_entry.hpp b/src/thread/thread_entry.hpp index 8cdab676d77..8488e0ecf95 100644 --- a/src/thread/thread_entry.hpp +++ b/src/thread/thread_entry.hpp @@ -310,7 +310,7 @@ namespace cubthread bool m_skip_end_resource_tracks_in_recycle; - std::vector oos_oids; /* out-of-space OID list */ + std::vector oos_oids; thread_id_t get_id (); pthread_t get_posix_id (); From 035a0287db9f21a0e80d4a7bb4a094d091aa1c94 Mon Sep 17 00:00:00 2001 From: KIM HUISU Date: Fri, 13 Feb 2026 11:27:43 +0900 Subject: [PATCH 33/37] add TODO --- src/transaction/locator.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/transaction/locator.h b/src/transaction/locator.h index 7da6bef248c..6db0e91de03 100644 --- a/src/transaction/locator.h +++ b/src/transaction/locator.h @@ -119,6 +119,10 @@ typedef enum LC_FETCH_VERIFY_CHN } LC_COPYAREA_OPERATION; +/* TODO: + * Handle LC_FLUSH_INSERT_OOS in LC_IS_FLUSH_INSERT usage to prevent malfunctions. + * Post-POC, refactor by separating macros or implementing exception handling for OOS call sites. + */ #define LC_IS_FLUSH_INSERT(operation) \ (operation == LC_FLUSH_INSERT || operation == LC_FLUSH_INSERT_PRUNE \ || operation == LC_FLUSH_INSERT_PRUNE_VERIFY || operation == LC_FLUSH_INSERT_OOS) From 4946e7d38911e8f18b7417b979b81d68bc152f1c Mon Sep 17 00:00:00 2001 From: KIM HUISU Date: Fri, 13 Feb 2026 11:31:59 +0900 Subject: [PATCH 34/37] feedback --- src/transaction/locator_sr.c | 6 ++++++ src/transaction/locator_sr.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/transaction/locator_sr.c b/src/transaction/locator_sr.c index 991b2cf56d9..2e95d3f65b5 100644 --- a/src/transaction/locator_sr.c +++ b/src/transaction/locator_sr.c @@ -8105,6 +8105,11 @@ locator_add_or_remove_index_internal (THREAD_ENTRY * thread_p, RECDES * recdes, &thread_p->oos_oids[i], LOG_REPLICATION_DATA, RVREPL_OOS_INSERT, key_dbvalue, REPL_INFO_TYPE_RBR_NORMAL); + if (error_code != NO_ERROR) + { + assert (er_errid () != NO_ERROR); + goto error; + } } } @@ -14070,6 +14075,7 @@ locator_fixup_oos_oids_in_recdes (THREAD_ENTRY * thread_p, const OID * class_oid continue; } + assert (oos_oid_count < thread_p->oos_oids.size ()); oos_oid = thread_p->oos_oids[oos_oid_count]; oid_ptr = (char *) recdes->data + OR_VAR_OFFSET (recdes->data, attrepr->location); diff --git a/src/transaction/locator_sr.h b/src/transaction/locator_sr.h index ce7bad3825b..201ee667d13 100644 --- a/src/transaction/locator_sr.h +++ b/src/transaction/locator_sr.h @@ -133,7 +133,7 @@ extern int locator_insert_force (THREAD_ENTRY * thread_p, HFID * hfid, OID * cla UPDATE_INPLACE_STYLE force_in_place, PGBUF_WATCHER * home_hint_p, bool has_BU_lock, bool dont_check_fk, bool use_bulk_logging = false); -extern int locator_oos_insert_force (THREAD_ENTRY * thread_p, HFID * hfid, OID * class_oid, OID * oid, RECDES * recdes); +extern int locator_oos_insert_force (THREAD_ENTRY * thread_p, OID * class_oid, RECDES * recdes); // *INDENT-OFF* extern int locator_multi_insert_force (THREAD_ENTRY * thread_p, HFID * hfid, OID * class_oid, const std::vector &recdes, int has_index, int op_type, From 2d37482c8ebddc9d3ca90fb92a7a4e5a6ebbef8c Mon Sep 17 00:00:00 2001 From: KIM HUISU Date: Fri, 13 Feb 2026 12:27:42 +0900 Subject: [PATCH 35/37] remove debug code --- src/transaction/locator_sr.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/transaction/locator_sr.c b/src/transaction/locator_sr.c index 2e95d3f65b5..35cd7a9aef9 100644 --- a/src/transaction/locator_sr.c +++ b/src/transaction/locator_sr.c @@ -6981,7 +6981,6 @@ xlocator_repl_force (THREAD_ENTRY * thread_p, LC_COPYAREA * force_area, LC_COPYA HFID prev_hfid = HFID_INITIALIZER; int has_index; - assert (thread_p->oos_oids.size () == 0); //heexoo_test thread_p->oos_oids.clear (); /* need to start a topop to ensure the atomic operation. */ From 40eeaa8b9a6dcfae88a40caba926a936dd9a0574 Mon Sep 17 00:00:00 2001 From: KIM HUISU Date: Fri, 13 Feb 2026 13:19:58 +0900 Subject: [PATCH 36/37] add init oos tracking info in locator_oos_insert_force() --- src/transaction/locator_sr.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/transaction/locator_sr.c b/src/transaction/locator_sr.c index 35cd7a9aef9..938f40a47d1 100644 --- a/src/transaction/locator_sr.c +++ b/src/transaction/locator_sr.c @@ -5275,6 +5275,8 @@ locator_oos_insert_force (THREAD_ENTRY * thread_p, OID * class_oid, RECDES * rec HFID oos_hfid = HFID_INITIALIZER; VFID oos_vfid = VFID_INITIALIZER; OID oos_oid = OID_INITIALIZER; + LOG_TDES *tdes = NULL; + int tran_index = 0; if (heap_get_class_info (thread_p, class_oid, &oos_hfid, NULL, NULL) != NO_ERROR) { @@ -5288,6 +5290,19 @@ locator_oos_insert_force (THREAD_ENTRY * thread_p, OID * class_oid, RECDES * rec goto err; } + /* Find transaction descriptor for current logging transaction */ + tran_index = LOG_FIND_THREAD_TRAN_INDEX (thread_p); + tdes = LOG_FIND_TDES (tran_index); + if (tdes == NULL) + { + er_set (ER_FATAL_ERROR_SEVERITY, ARG_FILE_LINE, ER_LOG_UNKNOWN_TRANINDEX, 1, tran_index); + return S_ERROR; + } + + /* init oos tracking info */ + tdes->oos_insert_lsa_queue.clear (); + thread_p->oos_oids.clear (); + /* The recdes data from the log includes the OOS record header. Since oos_insert adds its own header, * we must skip the existing header to avoid duplication. */ recdes->data = recdes->data + OOS_RECORD_HEADER_SIZE; From bbc571246e1638aa9de42ae26360319d6876bbda Mon Sep 17 00:00:00 2001 From: KIM HUISU Date: Fri, 13 Feb 2026 16:41:16 +0900 Subject: [PATCH 37/37] fix --- src/transaction/locator_sr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/transaction/locator_sr.c b/src/transaction/locator_sr.c index 938f40a47d1..dd6473cda98 100644 --- a/src/transaction/locator_sr.c +++ b/src/transaction/locator_sr.c @@ -14089,7 +14089,7 @@ locator_fixup_oos_oids_in_recdes (THREAD_ENTRY * thread_p, const OID * class_oid continue; } - assert (oos_oid_count < thread_p->oos_oids.size ()); + assert (oos_oid_count < (int) thread_p->oos_oids.size ()); oos_oid = thread_p->oos_oids[oos_oid_count]; oid_ptr = (char *) recdes->data + OR_VAR_OFFSET (recdes->data, attrepr->location);