41 #define OVERFLOW_ALLOCVPID_ARRAY_SIZE 64 107 bool is_sysop_started =
false;
119 addr.
vfid = ovf_vfid;
138 vpids = (
VPID *) malloc ((npages + 1) *
sizeof (
VPID));
147 vpids = vpids_buffer;
151 for (i = 0; i < npages; i++)
160 is_sysop_started =
true;
171 for (i = 0; i < npages; i++)
177 *ovf_vpid = vpids[0];
184 for (i = 0; i < npages; i++)
201 first_part->
length = length;
202 copyto = (
char *) first_part->
data;
205 if (length < copy_length)
221 copyto = (
char *) rest_parts->
data;
224 if (length < copy_length)
230 memcpy (copyto, data, copy_length);
232 if (file_type !=
FILE_TEMP && thread_p->no_logging !=
true)
239 length -= copy_length;
245 #if defined (CUBRID_DEBUG) 250 "ovf_insert: ** SYSTEM ERROR calculation of number of pages needed to store overflow data seems" 251 " incorrect. Need no more than %d pages", npages);
259 if (vpids != vpids_buffer)
267 if (is_sysop_started)
272 if (vpids != vpids_buffer)
320 next_vpid = *ovf_vpid;
338 if (ovf_vfid ==
NULL)
398 bool isnewpage =
false;
409 addr.
vfid = ovf_vfid;
411 next_vpid = *ovf_vpid;
433 if (
VPID_EQ (addr_vpid_ptr, ovf_vpid))
437 old_length = first_part->
length;
439 copyto = (
char *) first_part->
data;
473 copyto = (
char *) rest_parts->
data;
474 if (isnewpage ==
true)
509 memcpy (copyto, data, copy_length);
511 length -= copy_length;
513 if (thread_p->no_logging !=
true)
537 if (rest_parts ==
NULL)
556 &next_vpid, &tmp_vpid);
558 if (rest_parts ==
NULL)
587 error_code =
file_dealloc (thread_p, ovf_vfid, &tmp_vpid, file_type);
759 next_vpid = *ovf_vpid;
770 if (mvcc_snapshot !=
NULL)
783 *remaining_length = first_part->
length;
788 max_nbytes = *remaining_length - start_offset;
793 if (max_nbytes > (*remaining_length - start_offset))
795 max_nbytes = *remaining_length - start_offset;
803 *remaining_length = 0;
807 *remaining_length -= max_nbytes;
816 recdes->
length = -max_nbytes;
819 else if (max_nbytes == 0)
827 recdes->
length = max_nbytes;
831 copyfrom = (
char *) first_part->
data;
834 while (max_nbytes > 0)
837 if (start_offset > 0)
840 copy_length = (int) ((copyfrom + start_offset) > ((
char *) pgptr +
DB_PAGESIZE)
841 ?
DB_PAGESIZE - (copyfrom - (
char *) pgptr) : start_offset);
842 start_offset -= copy_length;
843 copyfrom += copy_length;
851 if (start_offset == 0)
853 if (copyfrom + max_nbytes > (
char *) pgptr +
DB_PAGESIZE)
859 copy_length = max_nbytes;
865 memcpy (data, copyfrom, copy_length);
867 max_nbytes -= copy_length;
891 copyfrom = (
char *) rest_parts->
data;
918 int remaining_length;
920 return overflow_get_nbytes (thread_p, ovf_vpid, recdes, 0, -1, &remaining_length, mvcc_snapshot);
935 int *ovf_overhead,
int *ovf_free_space)
951 next_vpid = *ovf_vpid;
962 remain_length = first_part->
length;
964 *ovf_size = first_part->
length;
973 while (remain_length > 0)
986 *ovf_overhead += hdr_length;
988 if (remain_length > 0)
1022 *ovf_free_space = 0;
1027 #if defined (CUBRID_DEBUG) 1040 int remain_length, dump_length;
1051 next_vpid = *ovf_vpid;
1059 remain_length = first_part->
length;
1060 dumpfrom = (
char *) first_part->
data;
1063 while (remain_length > 0)
1065 dump_length = (int) ((dumpfrom + remain_length > (
char *) pgptr +
DB_PAGESIZE)
1066 ?
DB_PAGESIZE - (dumpfrom - (
char *) pgptr) : remain_length);
1067 for (i = 0; i < dump_length; i++)
1069 (void) fputc (*dumpfrom++, fp);
1072 remain_length -= dump_length;
1074 if (remain_length > 0)
1091 dumpfrom = (
char *) rest_parts->
data;
1164 vpid = (
VPID *) data;
1165 fprintf (fp,
"Overflow Reference to Volid = %d|Pageid = %d\n", vpid->
volid, vpid->
pageid);
1196 dumpfrom = (
char *) data;
1199 length -= hdr_length;
1200 dumpfrom += hdr_length;
int overflow_rv_newpage_link_undo(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
int overflow_rv_link(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
int overflow_rv_newpage_insert_redo(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
void log_append_redo_data(THREAD_ENTRY *thread_p, LOG_RCVINDEX rcvindex, LOG_DATA_ADDR *addr, int length, const void *data)
int file_init_temp_page_type(THREAD_ENTRY *thread_p, PAGE_PTR page, void *args)
static int overflow_delete_internal(THREAD_ENTRY *thread_p, const VFID *ovf_vfid, VPID *vpid, PAGE_PTR pgptr)
int file_dealloc(THREAD_ENTRY *thread_p, const VFID *vfid, const VPID *vpid, FILE_TYPE file_type_hint)
int file_alloc_multiple(THREAD_ENTRY *thread_p, const VFID *vfid, FILE_INIT_PAGE_FUNC f_init, void *f_init_args, int npages, VPID *vpids_out)
#define ASSERT_ERROR_AND_SET(error_code)
void pgbuf_set_dirty(THREAD_ENTRY *thread_p, PAGE_PTR pgptr, bool free_page)
char * overflow_get_first_page_data(char *page_ptr)
SCAN_CODE overflow_get(THREAD_ENTRY *thread_p, const VPID *ovf_vpid, RECDES *recdes, MVCC_SNAPSHOT *mvcc_snapshot)
void log_sysop_start(THREAD_ENTRY *thread_p)
void overflow_rv_link_dump(FILE *fp, int length_ignore, void *data)
PAGE_PTR pgbuf_flush_with_wal(THREAD_ENTRY *thread_p, PAGE_PTR pgptr)
#define OVERFLOW_ALLOCVPID_ARRAY_SIZE
#define er_log_debug(...)
#define VFID_ISNULL(vfid_ptr)
int overflow_update(THREAD_ENTRY *thread_p, const VFID *ovf_vfid, const VPID *ovf_vpid, RECDES *recdes, FILE_TYPE file_type)
#define pgbuf_unfix_and_init(thread_p, pgptr)
void er_set(int severity, const char *file_name, const int line_no, int err_id, int num_args,...)
int log_rv_copy_char(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
int heap_get_mvcc_rec_header_from_overflow(PAGE_PTR ovf_page, MVCC_REC_HEADER *mvcc_header, RECDES *peek_recdes)
bool pgbuf_check_page_ptype(THREAD_ENTRY *thread_p, PAGE_PTR pgptr, PAGE_TYPE ptype)
#define pgbuf_set_dirty_and_free(thread_p, pgptr)
#define ER_OUT_OF_VIRTUAL_MEMORY
void log_append_undo_data(THREAD_ENTRY *thread_p, LOG_RCVINDEX rcvindex, LOG_DATA_ADDR *addr, int length, const void *data)
#define ER_HEAP_OVFADDRESS_CORRUPTED
#define VPID_EQ(vpid_ptr1, vpid_ptr2)
int overflow_get_capacity(THREAD_ENTRY *thread_p, const VPID *ovf_vpid, int *ovf_size, int *ovf_num_pages, int *ovf_overhead, int *ovf_free_space)
int file_alloc(THREAD_ENTRY *thread_p, const VFID *vfid, FILE_INIT_PAGE_FUNC f_init, void *f_init_args, VPID *vpid_out, PAGE_PTR *page_out)
void log_append_undoredo_data(THREAD_ENTRY *thread_p, LOG_RCVINDEX rcvindex, LOG_DATA_ADDR *addr, int undo_length, int redo_length, const void *undo_data, const void *redo_data)
#define pgbuf_fix(thread_p, vpid, fetch_mode, requestmode, condition)
#define CEIL_PTVDIV(dividend, divisor)
void log_sysop_abort(THREAD_ENTRY *thread_p)
int file_init_page_type(THREAD_ENTRY *thread_p, PAGE_PTR page, void *args)
#define VPID_ISNULL(vpid_ptr)
void overflow_flush(THREAD_ENTRY *thread_p, const VPID *ovf_vpid)
static const VPID * overflow_traverse(THREAD_ENTRY *thread_p, const VFID *ovf_vfid, const VPID *ovf_vpid, OVERFLOW_DO_FUNC func)
static void overflow_next_vpid(const VPID *ovf_vpid, VPID *vpid, PAGE_PTR pgptr)
#define free_and_init(ptr)
void log_append_empty_record(THREAD_ENTRY *thread_p, LOG_RECTYPE logrec_type, LOG_DATA_ADDR *addr)
void log_rv_dump_char(FILE *fp, int length, void *data)
void pgbuf_set_page_ptype(THREAD_ENTRY *thread_p, PAGE_PTR pgptr, PAGE_TYPE ptype)
void log_sysop_attach_to_outer(THREAD_ENTRY *thread_p)
int overflow_rv_page_update_redo(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
MVCC_SNAPSHOT_FUNC snapshot_fnc
void overflow_rv_page_dump(FILE *fp, int length, void *data)
int overflow_get_length(THREAD_ENTRY *thread_p, const VPID *ovf_vpid)
int overflow_insert(THREAD_ENTRY *thread_p, const VFID *ovf_vfid, VPID *ovf_vpid, RECDES *recdes, FILE_TYPE file_type)
#define VPID_SET_NULL(vpid_ptr)
static int overflow_flush_internal(THREAD_ENTRY *thread_p, PAGE_PTR pgptr)
VPID * pgbuf_get_vpid_ptr(PAGE_PTR pgptr)
const VPID * overflow_delete(THREAD_ENTRY *thread_p, const VFID *ovf_vfid, const VPID *ovf_vpid)
SCAN_CODE overflow_get_nbytes(THREAD_ENTRY *thread_p, const VPID *ovf_vpid, RECDES *recdes, int start_offset, int max_nbytes, int *remaining_length, MVCC_SNAPSHOT *mvcc_snapshot)