33 #if !defined (WINDOWS) 34 #include <sys/types.h> 114 char next_vol_fullname[1];
122 char vol_fullname[1];
167 #if !defined (NDEBUG) 201 #if !defined (NDEBUG) 222 #define DISK_STAB_UNIT_SIZE_OF sizeof (DISK_STAB_UNIT) 239 #define DISK_STAB_CURSOR_INITIALIZER { NULL, 0, 0, 0, 0, NULL, NULL } 243 #define DISK_STAB_UNIT_BIT_COUNT ((int) (DISK_STAB_UNIT_SIZE_OF * CHAR_BIT)) 245 #define DISK_STAB_PAGE_UNITS_COUNT ((int) (DB_PAGESIZE / DISK_STAB_UNIT_SIZE_OF)) 247 #define DISK_STAB_PAGE_BIT_COUNT ((int) (DISK_STAB_UNIT_BIT_COUNT * DISK_STAB_PAGE_UNITS_COUNT)) 250 #define DISK_ALLOCTBL_SECTOR_PAGE_OFFSET(sect) ((sect) / DISK_STAB_PAGE_BIT_COUNT) 252 #define DISK_ALLOCTBL_SECTOR_UNIT_OFFSET(sect) (((sect) % DISK_STAB_PAGE_BIT_COUNT) / DISK_STAB_UNIT_BIT_COUNT) 254 #define DISK_ALLOCTBL_SECTOR_BIT_OFFSET(sect) (((sect) % DISK_STAB_PAGE_BIT_COUNT) % DISK_STAB_UNIT_BIT_COUNT) 256 #define DISK_SECTS_ROUND_UP(nsects) (CEIL_PTVDIV (nsects, DISK_STAB_UNIT_BIT_COUNT) * DISK_STAB_UNIT_BIT_COUNT) 257 #define DISK_SECTS_ROUND_DOWN(nsects) ((nsects / DISK_STAB_UNIT_BIT_COUNT) * DISK_STAB_UNIT_BIT_COUNT) 258 #define DISK_SECTS_ASSERT_ROUNDED(nsects) assert (nsects == DISK_SECTS_ROUND_DOWN (nsects)) 260 #define DISK_STAB_NPAGES(nsect_max) (CEIL_PTVDIV (nsect_max, DISK_STAB_PAGE_BIT_COUNT)) 275 #define DISK_PRERESERVE_BUF_DEFAULT 16 297 #define DISK_MIN_VOLUME_SECTS DISK_STAB_UNIT_BIT_COUNT 300 #define DISK_SAFE_OSDISK_FREE_SPACE (64 * 1024 * 1024) 301 #define DISK_SAFE_OSDISK_FREE_SECTS (DISK_SAFE_OSDISK_FREE_SPACE / IO_SECTORSIZE) 309 #define disk_log(func, msg, ...) \ 311 _er_log_debug (ARG_FILE_LINE, "DISK " func " " LOG_THREAD_TRAN_MSG ": \n\t" msg "\n", \ 312 LOG_THREAD_TRAN_ARGS (thread_get_thread_entry_info ()), __VA_ARGS__) 314 #define DISK_VOLHEADER_MSG \ 315 "\t\tvolume header: \n" \ 316 "\t\t\tvolid = %d\n" \ 317 "\t\t\ttype = %s\n" \ 318 "\t\t\tpurpose = %s\n" \ 319 "\t\t\tsectors: total = %d, max = %d\n" \ 320 "\t\t\thint_allocset = %d\n" \ 321 "\t\t\tsector allocation table: start = %d, num pages = %d\n" \ 322 "\t\t\tchkpt_lsa = %lld|%d\n" \ 323 "\t\t\tnext_volid = %d\n" 324 #define DISK_VOLHEADER_AS_ARGS(arg_volh) \ 326 disk_type_to_string ((arg_volh)->type), \ 327 disk_purpose_to_string ((arg_volh)->purpose), \ 328 (arg_volh)->nsect_total, (arg_volh)->nsect_max, \ 329 (arg_volh)->hint_allocsect, \ 330 (arg_volh)->stab_first_page, (arg_volh)->stab_npages, \ 331 LSA_AS_ARGS (&(arg_volh)->chkpt_lsa), \ 332 (arg_volh)->next_volid 334 #define DISK_RESERVE_CONTEXT_MSG \ 336 "\t\t\tnsect_total = %d\n" \ 337 "\t\t\tn_cache_vol_reserve = %d, n_cache_reserve_remaining = %d\n" \ 339 #define DISK_RESERVE_CONTEXT_AS_ARGS(context) \ 340 (context)->nsect_total, (context)->n_cache_vol_reserve, (context)->n_cache_reserve_remaining, \ 341 disk_purpose_to_string ((context)->purpose) 343 #define DISK_SYS_NPAGE_SIZE(nsect_max) (1 + DISK_STAB_NPAGES (nsect_max)) 344 #define DISK_SYS_NSECT_SIZE(nsect_max) (CEIL_PTVDIV (DISK_SYS_NPAGE_SIZE (nsect_max), DISK_SECTOR_NPAGES)) 426 SECTID sectid,
bool debug_crash);
460 #
if !defined (NDEBUG)
461 ,
const char *file,
int line
465 #define disk_get_volheader disk_get_volheader_internal 467 #define disk_get_volheader(...) disk_get_volheader_internal (__VA_ARGS__, ARG_FILE_LINE) 513 #if !defined (NDEBUG) 515 #define fault_inject_random_crash() \ 516 if (vol_purpose == DB_PERMANENT_DATA_PURPOSE) FI_TEST (thread_p, FI_TEST_DISK_MANAGER_VOLUME_ADD, 0) 518 #define fault_inject_random_crash() 525 const char *vol_fullname = ext_info->
name;
574 false,
false,
IO_PAGESIZE, kbytes_to_be_written_per_sec,
false);
811 #undef fault_inject_random_crash 874 if (logchange !=
false)
876 int undo_size, redo_size;
880 if (undo_recv ==
NULL)
886 redo_size =
sizeof (*redo_recv) + (int)
strlen (new_vol_fullname);
888 if (redo_recv ==
NULL)
901 memcpy (&redo_recv->
db_creation, new_dbcreation, sizeof (*new_dbcreation));
902 memcpy (&redo_recv->
chkpt_lsa, new_chkptlsa, sizeof (*new_chkptlsa));
903 (void) strcpy (redo_recv->
vol_fullname, new_vol_fullname);
915 memcpy (&vhdr->
db_creation, new_dbcreation, sizeof (*new_dbcreation));
916 memcpy (&vhdr->
chkpt_lsa, new_chkptlsa, sizeof (*new_chkptlsa));
995 if (logchange ==
true)
997 int undo_size, redo_size;
1009 if (undo_recv ==
NULL)
1015 redo_size =
sizeof (*redo_recv) + (int)
strlen (next_volext_fullname);
1017 if (redo_recv ==
NULL)
1186 return next_volext_fullname;
1240 VPID vpid_volheader;
1259 else if (page_volheader ==
NULL)
1295 disk_log (
"disk_rv_undo_format",
"remove volume %d from cache (free = %d, total = %d, max = %d).",
1296 volid, free, total,
max);
1308 disk_log (
"disk_rv_undo_format",
"remove volume %d", volid);
1329 bool is_first_call = rcv->
offset == -1;
1346 disk_log (
"disk_rv_redo_format",
"first call for volume %d at lsa %lld|%d", volheader->
volid,
1382 if (nsect_diff != 0)
1391 disk_log (
"disk_rv_redo_format",
"second call for volume %d at lsa %lld|%d, free = %d, total = %d, max = %d",
1455 fprintf (fp,
"Nalloc_bits = %d\n", *(INT32 *) data);
1495 fprintf (fp,
"Label = %s, Db_creation = %lld, chkpt = %lld|%lld\n", change->
vol_fullname,
1571 hfid = (
HFID *) data;
1572 fprintf (fp,
"Heap: Volid = %d, Fileid = %d, Header_pageid = %d\n", hfid->
vfid.
volid, hfid->
vfid.
fileid, hfid->
hpgid);
1606 fprintf (fp,
"Volid = %d, volume new size in pages = %d\n", info->
volid, info->
npages);
1620 #if defined (SERVER_MODE) 1621 #define DISK_EXTEND_TEMP_REGISTER() \ 1624 if (voltype == DB_TEMPORARY_VOLTYPE) \ 1626 tsc_getticks (&end_tick); \ 1627 tsc_elapsed_time_usec (&tv_diff, end_tick, start_tick); \ 1628 TSC_ADD_TIMEVAL (thread_p->event_stats.temp_expand_time, tv_diff); \ 1629 thread_p->event_stats.temp_expand_pages += DISK_SECTS_NPAGES (nsect_temp_extended); \ 1633 #define DISK_EXTEND_TEMP_COLLECT(nsects) \ 1636 if (voltype == DB_TEMPORARY_VOLTYPE) \ 1638 nsect_temp_extended += (nsects); \ 1658 #if defined (SERVER_MODE) 1665 bool continue_check =
false;
1700 nsect_extend = MAX (target_free - free, 0) + intention;
1701 if (nsect_extend <= 0)
1709 #if defined (SERVER_MODE) 1723 to_expand = MIN (nsect_extend, max - total);
1738 assert (nsect_free_new >= to_expand);
1746 disk_log (
"disk_extend",
"expanded volume %d by %d sectors for %s.", extend_info->
volid_extend, nsect_free_new,
1750 nsect_extend -= nsect_free_new;
1764 #if defined (SERVER_MODE) 1765 DISK_EXTEND_TEMP_COLLECT (nsect_free_new);
1768 if (nsect_extend <= 0)
1771 #if defined (SERVER_MODE) 1772 DISK_EXTEND_TEMP_REGISTER ();
1778 assert (nsect_extend > 0);
1782 volext.
comments =
"Automatic Volume Extension";
1787 while (nsect_extend > 0)
1792 if (check_interrupt)
1812 error_code =
disk_add_volume (thread_p, &volext, &volid_new, &nsect_free_new);
1821 disk_log (
"disk_extend",
"added new volume %d with %d free sectors for %s.", volid_new, nsect_free_new,
1824 nsect_extend -= nsect_free_new;
1852 #if defined (SERVER_MODE) 1861 #if defined (SERVER_MODE) 1862 DISK_EXTEND_TEMP_REGISTER ();
1866 #if defined (SERVER_MODE) 1867 #undef DISK_EXTEND_TEMP_COLLECT 1868 #undef DISK_EXTEND_TEMP_REGISTER 1889 int volume_new_npages;
1894 assert (nsect_extend > 0);
1933 sizeof (nsect_extend),
sizeof (nsect_extend), &nsect_extend, &nsect_extend);
1954 log_data.
npages = volume_new_npages;
1975 error_code =
fileio_expand_to (thread_p, volid, volume_new_npages, voltype);
1986 *nsect_extended_out = nsect_extend;
2038 assert (nfree <= nsect_extend);
2045 disk_log (
"disk_rv_volhead_extend_redo",
"extended volume %d total sectors %d (out of which %d were free). " 2080 disk_log (
"disk_rv_volhead_extend_undo",
"undo volume %d extension - remove %d sectors. volume header lsa %lld|%d\n",
2098 char fullname[PATH_MAX];
2135 disk_log (
"disk_add_volume",
"add new %s volume with purpose %s:\n" "\tname=%s\n" "\tcomments=%s\n" "\tpath=%s\n" 2141 #if !defined (WINDOWS) 2144 char vol_realpath[PATH_MAX];
2145 char link_path[PATH_MAX];
2146 char link_fullname[PATH_MAX];
2147 struct stat stat_buf;
2149 if (stat (fullname, &stat_buf) == 0
2150 && S_ISCHR (stat_buf.st_mode))
2155 link_path[0] =
'\0';
2156 temp_extinfo.
path = link_path;
2161 if (realpath (fullname, vol_realpath) !=
NULL)
2163 strcpy (fullname, vol_realpath);
2165 (void) unlink (link_fullname);
2166 if (symlink (fullname, link_fullname) != 0)
2171 strcpy (fullname, link_fullname);
2185 if (nsect_part_max >= 0 && nsect_part_max < extinfo->
nsect_max)
2196 extinfo->
comments =
"Volume Extension";
2198 extinfo->
name = fullname;
2203 || can_overwrite ==
false)
2297 const char *name,
const char *comments,
int max_write_size_in_sec,
bool overwrite,
2303 char buf_realpath[PATH_MAX];
2315 if (path !=
NULL && realpath (path, buf_realpath) !=
NULL)
2317 ext_info.
path = buf_realpath;
2321 ext_info.
path = path;
2323 ext_info.
name = name;
2337 error_code =
disk_add_volume (thread_p, &ext_info, &volid_new, &nsect_free);
2371 *volid_out = volid_new;
2404 *purpose_out = volheader->
purpose;
2405 *voltype_out = volheader->
type;
2447 if (page_volheader !=
NULL)
2455 #if defined (SERVER_MODE) 2472 #if defined (SERVER_MODE) 2482 disk_auto_expand (&thread_ref);
2486 #if defined (SERVER_MODE) 2505 #if defined (SERVER_MODE) 2601 if (disk_Cache ==
NULL)
2619 #if !defined (NDEBUG) 2634 #if !defined (NDEBUG) 2639 #if !defined (NDEBUG) 2657 if (disk_Cache ==
NULL)
2727 disk_log (
"disk_cache_update_vol_free",
"updated cached free for volid %d to %d and perm_perm to %d; " 2738 disk_log (
"disk_cache_update_vol_free",
"updated cached free for volid %d to %d and perm_temp to %d; " 2747 disk_log (
"disk_cache_update_vol_free",
"updated cached free for volid %d to %d and temp_temp to %d; " 2760 #if defined (NDEBUG) 2786 #if defined (NDEBUG) 2844 #if defined (NDEBUG) 2870 #if defined (NDEBUG) 2973 snprintf (buf,
sizeof (buf),
"MAGIC SYMBOL = %s at disk location = %lld", vhdr->
magic,
3099 (void) fprintf (fp,
" MAGIC SYMBOL = %s at disk location = %lld\n", vhdr->
magic,
3101 (void) fprintf (fp,
" io_pagesize = %d,\n", vhdr->
iopagesize);
3102 (void) fprintf (fp,
" VID = %d, VOL_FULLNAME = %s\n VOL PURPOSE = %s\n VOL TYPE = %s VOL_REMARKS = %s\n",
3105 (void) fprintf (fp,
" NEXT_VID = %d, NEXT_VOL_FULLNAME = %s\n", vhdr->
next_volid,
3107 (void) fprintf (fp,
" LAST SYSTEM PAGE = %d\n", vhdr->
sys_lastpage);
3108 (void) fprintf (fp,
" SECTOR: SIZE IN PAGES = %10d, TOTAL = %10d,", vhdr->
sect_npgs, vhdr->
nsect_total);
3110 (void) fprintf (fp,
" %10s HINT_ALLOC = %10d\n",
" ", vhdr->
hint_allocsect);
3111 (void) fprintf (fp,
" SECTOR TABLE: SIZE IN PAGES = %10d, FIRST_PAGE = %5d\n", vhdr->
stab_npages,
3115 (
void) ctime_r (&tmp_time, time_val);
3116 (void) fprintf (fp,
" Database creation time = %s\n Lowest Checkpoint for recovery = %lld|%lld\n", time_val,
3118 (void) fprintf (fp,
"Boot_hfid: volid %d, fileid %d header_pageid %d\n", vhdr->
boot_hfid.
vfid.
volid,
3120 (void) fprintf (fp,
" db_charset = %d\n", vhdr->
db_charset);
3145 #if !defined (NDEBUG) 3185 #
if !defined (NDEBUG)
3186 ,
const char *file,
int line
3190 VPID vpid_volheader;
3197 if (*page_volheader_out ==
NULL)
3531 if (*cursor->
unit == 0)
3548 log_unit = *cursor->
unit;
3560 disk_log (
"disk_stab_unit_reserve",
"reserved sectid %d in volume %d.", sectid, cursor->
volheader->
volid);
3589 disk_log (
"disk_stab_unit_reserve",
"reserved sectid %d in volume %d.", cursor->
sectid,
3598 assert ((log_unit & *cursor->
unit) == log_unit);
3603 sizeof (log_unit),
sizeof (log_unit), &log_unit, &log_unit);
3665 for (; cursor.
unit < end_unit;
3672 error_code = f_unit (thread_p, &cursor, &stop, f_unit_args);
3775 FILE *fp = (FILE *) args;
3778 fprintf (fp,
"\n%10d", cursor->
sectid);
3782 if (bit % CHAR_BIT == 0)
3809 fprintf (fp,
"SECTOR TABLE BITMAP:\n\n");
3810 fprintf (fp,
" 01234567 01234567 01234567 01234567 01234567 01234567 01234567 01234567");
3853 else if (error_code == ETIMEDOUT)
3884 assert (((*stab_unit) & rv_unit) == 0);
3885 *stab_unit |= rv_unit;
3934 else if (error_code == ETIMEDOUT)
3965 assert (((*stab_unit) & rv_unit) == rv_unit);
3966 *stab_unit &= ~rv_unit;
4045 end_cursor = start_cursor;
4084 if (page_volheader !=
NULL)
4121 bool old_check_interrupt;
4222 VSID * reserved_sectors)
4227 bool retried =
false;
4228 bool did_extend =
false;
4233 if (n_sectors <= 0 || reserved_sectors ==
NULL)
4264 context.
vsidp = reserved_sectors;
4286 assert ((context.
vsidp - reserved_sectors) == n_sectors);
4292 #if !defined (NDEBUG) 4303 nreserved = (int) (context.
vsidp - reserved_sectors);
4324 for (iter_vsid = 0; iter_vsid < nreserved; iter_vsid++)
4400 if (disk_Cache ==
NULL)
4466 disk_log (
"disk_reserve_from_cache",
"existing free space could not satisfy reserve. " 4483 disk_log (
"disk_reserve_from_cache",
"somebody else extended disk. try reserve from cache again. " 4498 disk_log (
"disk_reserve_from_cache",
"could not reserve enough from cache. need to do extend. " 4508 error_code =
disk_extend (thread_p, extend_info, context);
4513 disk_log (
"disk_reserve_from_cache",
"extend done. decrement intention by %d to %d for %s. \n",
4546 VOLID start_iter, end_iter, incr;
4569 min_free = MAX (min_free, 1);
4668 int start_index = 0;
4679 context.
vsidp = vsids;
4683 for (start_index = 0; start_index < nsects; start_index = end_index)
4685 assert (volid < vsids[start_index].volid);
4686 volid = vsids[start_index].
volid;
4687 for (end_index = start_index + 1; end_index < nsects && vsids[end_index].
volid ==
volid; end_index++)
4689 assert (vsids[end_index].sectid > vsids[end_index - 1].sectid);
4695 assert (end_index == nsects);
4729 SECTID sectid_start_cursor;
4735 disk_log (
"disk_unreserve_sectors_from_volume",
"unreserve %d sectors in volume %d.",
4791 disk_log (
"disk_stab_unit_unreserve",
"unreserve sectid %d from volume %d.", context->
vsidp->
sectid,
4799 assert ((unreserve_bits & (*cursor->
unit)) == unreserve_bits);
4800 if (unreserve_bits != 0)
4812 (*cursor->
unit) &= ~unreserve_bits;
4857 if (page_stab ==
NULL)
4875 nsect_copy = nsects_sys;
4902 DKNSECTS nsects_set = nsects_sys - nsect_copy;
4918 nsects_sys = nsect_copy;
4949 if (disk_Cache !=
NULL)
4951 disk_log (
"disk_manager_init",
"%s",
"reload disk cache");
4969 #if defined (SERVER_MODE) 4982 #if defined (SERVER_MODE) 5015 ext_info.
name = full_dbname;
5069 int start_index = 0;
5080 context.
vsidp = vsids;
5085 for (start_index = 0; start_index < nsects; start_index = end_index)
5087 assert (volid < vsids[start_index].volid);
5088 volid = vsids[start_index].
volid;
5089 for (end_index = start_index + 1; end_index < nsects && vsids[end_index].
volid ==
volid; end_index++)
5091 assert (vsids[end_index].sectid > vsids[end_index - 1].sectid);
5097 assert (end_index == nsects);
5133 SECTID sectid_start_cursor;
5182 disk_log (
"disk_stab_unit_unreserve",
"unreserve sectid %d from volume %d.", context->
vsidp->
sectid,
5189 if ((bits_check_reserved & (*cursor->
unit)) != bits_check_reserved)
5215 switch (vol_purpose)
5218 return "Permanent data purpose";
5220 return "Temporary data purpose";
5225 return "Unknown purpose";
5255 length_to_move = (length_diff + (int)
strlen (vhdr->
var_fields + length_diff) + 1
5259 length_diff = (((int)
strlen (vol_fullname) + 1)
5262 if (length_diff != 0)
5288 int next_vol_fullname_size;
5290 if (next_vol_fullname ==
NULL)
5292 next_vol_fullname =
"";
5293 next_vol_fullname_size = 1;
5297 next_vol_fullname_size = (int)
strlen (next_vol_fullname) + 1;
5298 if (next_vol_fullname_size > PATH_MAX)
5300 next_vol_fullname_size = PATH_MAX;
5311 if (length_diff != 0)
5335 if (vol_remarks !=
NULL)
5339 if ((
int)
strlen (vol_remarks) > maxsize)
5501 memcpy (db_creation, &vhdr->
db_creation, sizeof (*db_creation));
5518 if (disk_Cache ==
NULL)
5561 if (space_info !=
NULL)
5567 memset (space_info, 0,
sizeof (*space_info));
5583 if (vol_purpose !=
NULL)
5728 if (vol_fullname ==
NULL)
5737 *vol_fullname =
'\0';
5747 return vol_fullname;
5771 if (remarks !=
NULL)
5840 (void) fprintf (fp,
"\n\n");
5932 int nvols_total = 0;
5933 bool is_extend_locked =
false;
5943 is_extend_locked =
true;
5947 for (iter_vol = 0; iter_vol < disk_Cache->
nvols_perm; iter_vol++)
5973 if (spacevols !=
NULL)
5979 if (*spacevols ==
NULL)
5986 for (iter_vol = 0; iter_vol < disk_Cache->
nvols_perm; iter_vol++)
5988 (*spacevols)[iter_spacevols].volid = iter_vol;
5990 (*spacevols)[iter_spacevols].purpose = disk_Cache->
vols[iter_vol].
purpose;
5996 (*spacevols)[iter_spacevols].volid = iter_vol;
5998 (*spacevols)[iter_spacevols].purpose = disk_Cache->
vols[iter_vol].
purpose;
6002 assert (iter_spacevols == nvols_total);
6007 is_extend_locked =
false;
6018 if (spacevols !=
NULL)
6027 for (iter_spacevols = 0; iter_spacevols < nvols_total; iter_spacevols++)
6037 (*spacevols)[iter_spacevols].npage_used =
6049 if (is_extend_locked)
6074 VSID *second_vsid = (
VSID *) second;
6080 else if (first_vsid->
volid < second_vsid->
volid)
6084 return (
int) (first_vsid->
sectid - second_vsid->
sectid);
6104 if (volid == vol_infop->
volid)
6106 vol_infop->
exists =
true;
6126 size_t page_reserver_area;
6128 struct stat stat_buffer;
6132 *can_overwrite =
false;
6134 #if !defined(CS_MODE) 6145 page_reserver_area = offsetof (
FILEIO_PAGE, page);
6153 *can_overwrite =
true;
6160 read_size += page_reserver_area;
6162 if (fstat (vol_fd, &stat_buffer) != 0)
6170 if (stat_buffer.st_size == 0)
6173 *can_overwrite =
true;
6176 else if (stat_buffer.st_size < read_size)
6194 *can_overwrite =
true;
6326 if (page_volheader !=
NULL)
6331 disk_log (
"disk_check_volume",
"check volume %d is %s", volid, valid ==
DISK_VALID ?
"valid" :
"not valid");
6353 VOLID volid_perm_last;
6354 VOLID volid_temp_last;
6373 if (nvols_perm != volid_perm_last + 1)
6381 if (nvols_temp > 0 && (nvols_temp != (
LOG_MAX_DBVOLID - volid_temp_last + 1)))
6404 if (nvols_temp > 0 && nvols_temp != disk_Cache->
nvols_temp)
6419 disk_log (
"disk_check",
"first check step is %s", valid ==
DISK_VALID ?
"valid" :
"not valid");
6426 for (volid_iter = 0; volid_iter < disk_Cache->
nvols_perm; volid_iter++)
6457 for (perm_free = 0, temp_free = 0, volid_iter = 0; volid_iter < disk_Cache->
nvols_perm; volid_iter++)
6520 disk_log (
"disk_check",
"full check is %s",
"valid");
6528 #if defined (SA_MODE) 6548 char *ptr_map =
NULL;
6553 if (*disk_map_clone ==
NULL)
6560 for (iter = 0; iter < disk_Cache->
nvols_perm; iter++)
6575 (*disk_map_clone)[iter].size_map = volheader->
nsect_total / CHAR_BIT;
6576 (*disk_map_clone)[iter].map = (
char *) malloc ((*disk_map_clone)[iter].size_map);
6577 if ((*disk_map_clone)[iter].map ==
NULL)
6585 vpid_stab.
volid = iter;
6587 ptr_map = (*disk_map_clone)[iter].map;
6593 if (page_stab ==
NULL)
6599 memcpy (ptr_map, page_stab, memsize);
6606 assert (ptr_map == (*disk_map_clone)[iter].map + (*disk_map_clone)[iter].size_map);
6610 ptr_map = (*disk_map_clone)[iter].map;
6630 disk_map_clone_free (disk_map_clone);
6632 if (page_stab !=
NULL)
6636 if (page_volheader !=
NULL)
6654 for (iter = 0; iter < disk_Cache->
nvols_perm; iter++)
6656 free ((*disk_map_clone)[iter].map);
6706 for (volid = 0; volid < disk_Cache->
nvols_perm; volid++)
6709 (
char *) unit < disk_map_clone[volid].map + disk_map_clone[volid].size_map; unit++)
6724 #if !defined (NDEBUG)
int disk_reserve_sectors(THREAD_ENTRY *thread_p, DB_VOLPURPOSE purpose, VOLID volid_hint, int n_sectors, VSID *reserved_sectors)
void fileio_make_volume_ext_name(char *vol_ext_full_name_p, const char *ext_path_p, const char *ext_name_p, VOLID vol_id)
#define DISK_ALLOCTBL_SECTOR_BIT_OFFSET(sect)
void disk_volheader_check_magic(THREAD_ENTRY *thread_p, const PAGE_PTR page_volheader)
static int disk_can_overwrite_data_volume(THREAD_ENTRY *thread_p, const char *vol_label_p, bool *can_overwrite)
STATIC_INLINE void disk_stab_cursor_set_at_sectid(const DISK_VOLUME_HEADER *volheader, SECTID sectid, DISK_STAB_CURSOR *cursor) __attribute__((ALWAYS_INLINE))
int db_make_datetime(DB_VALUE *value, const DB_DATETIME *datetime)
int n_cache_reserve_remaining
STATIC_INLINE void disk_stab_cursor_unfix(THREAD_ENTRY *thread_p, DISK_STAB_CURSOR *cursor) __attribute__((ALWAYS_INLINE))
void log_append_redo_data(THREAD_ENTRY *thread_p, LOG_RCVINDEX rcvindex, LOG_DATA_ADDR *addr, int length, const void *data)
int disk_get_boot_db_charset(THREAD_ENTRY *thread_p, INT16 volid, INTL_CODESET *db_charset)
void log_append_undoredo_data2(THREAD_ENTRY *thread_p, LOG_RCVINDEX rcvindex, const VFID *vfid, PAGE_PTR pgptr, PGLENGTH offset, int undo_length, int redo_length, const void *undo_data, const void *redo_data)
static int disk_unreserve_sectors_from_volume(THREAD_ENTRY *thread_p, VOLID volid, DISK_RESERVE_CONTEXT *context)
static void disk_cache_final(void)
static bool disk_check_volume_exist(THREAD_ENTRY *thread_p, VOLID volid, void *arg)
#define BO_IS_SERVER_RESTARTED()
#define DISK_VOLHEADER_MSG
DISK_PERM_PURPOSE_INFO perm_purpose_info
DISK_TEMP_PURPOSE_INFO temp_purpose_info
#define DISK_STAB_CURSOR_INITIALIZER
#define pthread_mutex_init(a, b)
int bit64_count_trailing_ones(UINT64 i)
#define LOG_DATA_ADDR_INITIALIZER
STATIC_INLINE bool disk_stab_cursor_is_bit_set(const DISK_STAB_CURSOR *cursor) __attribute__((ALWAYS_INLINE))
int fileio_reset_volume(THREAD_ENTRY *thread_p, int vol_fd, const char *vlabel, DKNPAGES npages, const LOG_LSA *reset_lsa_p)
void log_append_dboutside_redo(THREAD_ENTRY *thread_p, LOG_RCVINDEX rcvindex, int length, const void *data)
STATIC_INLINE SECTID disk_stab_cursor_get_sectid(const DISK_STAB_CURSOR *cursor) __attribute__((ALWAYS_INLINE))
STATIC_INLINE void disk_reserve_from_cache_vols(DB_VOLTYPE type, DISK_RESERVE_CONTEXT *context) __attribute__((ALWAYS_INLINE))
void * fileio_read(THREAD_ENTRY *thread_p, int vol_fd, void *io_page_p, PAGEID page_id, size_t page_size)
int db_get_int(const DB_VALUE *value)
#define DISK_SECTS_SIZE(nsects)
static bool disk_cache_load_all_volumes(THREAD_ENTRY *thread_p)
#define disk_log(func, msg,...)
#define disk_get_volheader(...)
static int disk_stab_unit_check_reserved(THREAD_ENTRY *thread_p, DISK_STAB_CURSOR *cursor, bool *stop, void *args)
#define ER_IO_FORMAT_OUT_OF_SPACE
#define csect_enter(a, b, c)
VOLID fileio_find_volume_id_with_label(THREAD_ENTRY *thread_p, const char *vol_label_p)
#define pthread_mutex_unlock(a)
void fileio_unformat(THREAD_ENTRY *thread_p, const char *vol_label_p)
#define pgbuf_unfix(thread_p, pgptr)
int disk_dump_all(THREAD_ENTRY *thread_p, FILE *fp)
int disk_set_link(THREAD_ENTRY *thread_p, INT16 volid, INT16 next_volid, const char *next_volext_fullname, bool logchange, DISK_FLUSH_TYPE flush)
#define pgbuf_invalidate(thread_p, pgptr)
void disk_rv_dump_hdr(FILE *fp, int length_ignore, void *data)
void logpb_force_flush_pages(THREAD_ENTRY *thread_p)
static int disk_volume_expand(THREAD_ENTRY *thread_p, VOLID volid, DB_VOLTYPE voltype, DKNSECTS nsect_extend, DKNSECTS *nsect_extended_out)
int disk_set_checkpoint(THREAD_ENTRY *thread_p, INT16 volid, const LOG_LSA *log_chkpt_lsa)
#define ASSERT_ERROR_AND_SET(error_code)
#define DISK_MIN_VOLUME_SECTS
#define assert_release(e)
void pgbuf_set_dirty(THREAD_ENTRY *thread_p, PAGE_PTR pgptr, bool free_page)
static int disk_format(THREAD_ENTRY *thread_p, const char *dbname, INT16 volid, DBDEF_VOL_EXT_INFO *ext_info, DKNSECTS *nsect_free_out)
int thread_get_current_entry_index(void)
VOLID logpb_add_volume(const char *db_fullname, VOLID new_volid, const char *new_volfullname, DISK_VOLPURPOSE new_volpurpose)
void log_append_undo_data2(THREAD_ENTRY *thread_p, LOG_RCVINDEX rcvindex, const VFID *vfid, PAGE_PTR pgptr, PGLENGTH offset, int length, const void *data)
void log_sysop_start(THREAD_ENTRY *thread_p)
VOLID xboot_find_last_permanent(THREAD_ENTRY *thread_p)
int disk_rv_undoredo_link(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
#define ER_BO_FULL_DATABASE_NAME_IS_TOO_LONG
struct timeval TSCTIMEVAL
char * xdisk_get_remarks(THREAD_ENTRY *thread_p, INT16 volid)
int disk_compare_vsids(const void *first, const void *second)
static int disk_vhdr_set_vol_fullname(DISK_VOLUME_HEADER *vhdr, const char *vol_fullname)
bool fileio_is_volume_exist(const char *vol_label_p)
volatile DKNSECTS nsect_free
const VOLID LOG_MAX_DBVOLID
#define DISK_RESERVE_CONTEXT_MSG
static int disk_stab_dump_unit(THREAD_ENTRY *thread_p, DISK_STAB_CURSOR *cursor, bool *stop, void *args)
void disk_rv_dump_set_boot_hfid(FILE *fp, int length_ignore, void *data)
static void disk_vhdr_dump(FILE *fp, const DISK_VOLUME_HEADER *vhdr)
#define ER_IO_FORMAT_BAD_NPAGES
static int disk_stab_init(THREAD_ENTRY *thread_p, DISK_VOLUME_HEADER *volheader)
bool xdisk_is_volume_exist(THREAD_ENTRY *thread_p, VOLID volid)
DKNSECTS fileio_get_number_of_partition_free_sectors(const char *path_p)
STATIC_INLINE void disk_stab_cursor_clear_bit(DISK_STAB_CURSOR *cursor) __attribute__((ALWAYS_INLINE))
#define PTR_ALIGN(addr, boundary)
bool logtb_get_check_interrupt(THREAD_ENTRY *thread_p)
int disk_format_first_volume(THREAD_ENTRY *thread_p, const char *full_dbname, const char *dbcomments, DKNPAGES npages)
#define ER_BO_MAXTEMP_SPACE_HAS_BEEN_EXCEEDED
int disk_unreserve_ordered_sectors(THREAD_ENTRY *thread_p, DB_VOLPURPOSE purpose, int nsects, VSID *vsids)
#define VOL_MAX_NSECTS(page_size)
#define ER_BO_CANNOT_CREATE_LINK
char * fileio_get_directory_path(char *path_p, const char *full_name_p)
#define pgbuf_invalidate_all(thread_p, volid)
void _er_log_debug(const char *file_name, const int line_no, const char *fmt,...)
int disk_rv_volhead_extend_redo(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
static void disk_auto_volume_expansion_daemon_init()
int disk_rv_reserve_sectors(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
int xboot_find_number_temp_volumes(THREAD_ENTRY *thread_p)
int xlogtb_reset_wait_msecs(THREAD_ENTRY *thread_p, int wait_msecs)
#define ER_BO_CANNOT_CREATE_VOL
#define pgbuf_unfix_and_init(thread_p, pgptr)
int disk_add_volume_extension(THREAD_ENTRY *thread_p, DB_VOLPURPOSE purpose, DKNPAGES npages, const char *path, const char *name, const char *comments, int max_write_size_in_sec, bool overwrite, VOLID *volid_out)
static int disk_vhdr_set_next_vol_fullname(DISK_VOLUME_HEADER *vhdr, const char *next_vol_fullname)
STATIC_INLINE int disk_stab_cursor_get_bit_index_in_page(const DISK_STAB_CURSOR *cursor) __attribute__((ALWAYS_INLINE))
DISK_ISVALID disk_check_sectors_are_reserved(THREAD_ENTRY *thread_p, VSID *vsids, int nsects)
#define ER_BO_VOLUME_EXISTS
int disk_volume_header_end_scan(THREAD_ENTRY *thread_p, void **ptr)
int disk_rv_unreserve_sectors(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
int thread_get_entry_index(cubthread::entry *thread_p)
void log_append_redo_data2(THREAD_ENTRY *thread_p, LOG_RCVINDEX rcvindex, const VFID *vfid, PAGE_PTR pgptr, PGLENGTH offset, int length, const void *data)
int db_make_string(DB_VALUE *value, DB_CONST_C_CHAR str)
STATIC_INLINE void disk_check_own_reserve_for_purpose(DB_VOLPURPOSE purpose) __attribute__((ALWAYS_INLINE))
#define DISK_SECTS_ROUND_UP(nsects)
UINT64 prm_get_bigint_value(PARAM_ID prm_id)
INTL_CODESET lang_charset(void)
int disk_set_creation(THREAD_ENTRY *thread_p, INT16 volid, const char *new_vol_fullname, const INT64 *new_dbcreation, const LOG_LSA *new_chkptlsa, bool logchange, DISK_FLUSH_TYPE flush)
static int disk_stab_dump(THREAD_ENTRY *thread_p, FILE *fp, const DISK_VOLUME_HEADER *volheader)
const char * boot_db_full_name()
int disk_rv_undo_format(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
#define SECTOR_FROM_PAGEID(pageid)
void er_set(int severity, const char *file_name, const int line_no, int err_id, int num_args,...)
int fileio_find_volume_descriptor_with_label(const char *vol_label_p)
int xboot_find_number_permanent_volumes(THREAD_ENTRY *thread_p)
char * fileio_get_volume_label(VOLID vol_id, bool is_peek)
SCAN_CODE disk_volume_header_next_scan(THREAD_ENTRY *thread_p, int cursor, DB_VALUE **out_values, int out_cnt, void *ptr)
int log_rv_copy_char(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
const char * fileio_get_base_file_name(const char *full_name_p)
void log_skip_logging(THREAD_ENTRY *thread_p, LOG_DATA_ADDR *addr)
STATIC_INLINE void disk_stab_cursor_check_valid(const DISK_STAB_CURSOR *cursor) __attribute__((ALWAYS_INLINE))
const VOLID LOG_DBFIRST_VOLID
STATIC_INLINE void disk_volume_header_set_stab(DB_VOLPURPOSE vol_purpose, DISK_VOLUME_HEADER *volheader) __attribute__((ALWAYS_INLINE))
char * disk_get_link(THREAD_ENTRY *thread_p, INT16 volid, INT16 *next_volid, char *next_volext_fullname)
bool pgbuf_check_page_ptype(THREAD_ENTRY *thread_p, PAGE_PTR pgptr, PAGE_TYPE ptype)
INT32 xdisk_get_free_numpages(THREAD_ENTRY *thread_p, INT16 volid)
DISK_ISVALID disk_is_page_sector_reserved_with_debug_crash(THREAD_ENTRY *thread_p, VOLID volid, PAGEID pageid, bool debug_crash)
volatile DKNSECTS nsect_max
int prm_get_integer_value(PARAM_ID prm_id)
#define pgbuf_set_dirty_and_free(thread_p, pgptr)
UINT64 bit64_set_trailing_bits(UINT64 i, int n)
int disk_rv_redo_format(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
LOG_LSA * pgbuf_get_lsa(PAGE_PTR pgptr)
const log_lsa PGBUF_TEMP_LSA
void fileio_close(int vol_fd)
STATIC_INLINE void disk_cache_lock_reserve_for_purpose(DB_VOLPURPOSE purpose) __attribute__((ALWAYS_INLINE))
int(* DISK_STAB_UNIT_FUNC)(THREAD_ENTRY *thread_p, DISK_STAB_CURSOR *cursor, bool *stop, void *args)
#define CUBRID_MAGIC_MAX_LENGTH
#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)
STATIC_INLINE bool disk_compatible_type_and_purpose(DB_VOLTYPE type, DB_VOLPURPOSE purpose) __attribute__((ALWAYS_INLINE))
DISK_EXTEND_INFO extend_info
int logpb_recreate_volume_info(THREAD_ENTRY *thread_p)
int disk_volume_header_start_scan(THREAD_ENTRY *thread_p, int type, DB_VALUE **arg_values, int arg_cnt, void **ptr)
STATIC_INLINE void disk_verify_volume_header(THREAD_ENTRY *thread_p, PAGE_PTR pgptr) __attribute__((ALWAYS_INLINE))
void lsa_to_string(char *buf, int buf_size, const log_lsa *lsa)
const DISK_VOLUME_HEADER * volheader
HFID * disk_get_boot_hfid(THREAD_ENTRY *thread_p, INT16 volid, HFID *hfid)
int disk_rv_undoredo_set_boot_hfid(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
#define DISK_SECTS_NPAGES(nsects)
UINT64 bit64_clear(UINT64 i, int off)
#define DISK_SYS_NSECT_SIZE(nsect_max)
STATIC_INLINE DB_VOLPURPOSE disk_get_volpurpose(VOLID volid) __attribute__((ALWAYS_INLINE))
static bool disk_cache_load_volume(THREAD_ENTRY *thread_p, INT16 volid, void *ignore)
int disk_manager_init(THREAD_ENTRY *thread_p, bool load_from_disk)
void db_localdatetime(time_t *epoch_time, DB_DATETIME *datetime)
static int disk_stab_iterate_units(THREAD_ENTRY *thread_p, const DISK_VOLUME_HEADER *volheader, PGBUF_LATCH_MODE mode, DISK_STAB_CURSOR *start, DISK_STAB_CURSOR *end, DISK_STAB_UNIT_FUNC f_unit, void *f_unit_args)
static enum scanner_mode mode
static int disk_unreserve_ordered_sectors_without_csect(THREAD_ENTRY *thread_p, DB_VOLPURPOSE purpose, int nsects, VSID *vsids)
int disk_set_boot_hfid(THREAD_ENTRY *thread_p, INT16 volid, const HFID *hfid)
int disk_unformat(THREAD_ENTRY *thread_p, const char *vol_fullname)
static int disk_dump_volume_system_info(THREAD_ENTRY *thread_p, FILE *fp, INT16 volid)
static int disk_reserve_from_cache(THREAD_ENTRY *thread_p, DISK_RESERVE_CONTEXT *context, bool *did_extend)
volatile DKNSECTS nsect_total
#define DISK_SECTS_ASSERT_ROUNDED(nsects)
int boot_dbparm_save_volume(THREAD_ENTRY *thread_p, DB_VOLTYPE voltype, VOLID volid)
#define DB_MAX_PATH_LENGTH
INT32 disk_get_total_numsectors(THREAD_ENTRY *thread_p, INT16 volid)
#define DISK_STAB_PAGE_UNITS_COUNT
#define DISK_VOLHEADER_AS_ARGS(arg_volh)
static const char * disk_purpose_to_string(DISK_VOLPURPOSE purpose)
STATIC_INLINE void disk_reserve_from_cache_volume(VOLID volid, DISK_RESERVE_CONTEXT *context) __attribute__((ALWAYS_INLINE))
STATIC_INLINE void disk_cache_free_reserved(DISK_RESERVE_CONTEXT *context) __attribute__((ALWAYS_INLINE))
#define PGBUF_PAGE_MODIFY_MSG(name)
#define ER_DISK_UNKNOWN_PURPOSE
char * xdisk_get_fullname(THREAD_ENTRY *thread_p, INT16 volid, char *vol_fullname)
DISK_CACHE_VOL_RESERVE cache_vol_reserve[VOLID_MAX]
void disk_manager_final(void)
UINT64 bit64_set(UINT64 i, int off)
void tsc_getticks(TSC_TICKS *tck)
INT32 xdisk_get_total_numpages(THREAD_ENTRY *thread_p, INT16 volid)
#define PGBUF_PAGE_MODIFY_ARGS(pg, prev_lsa)
char * hfid_to_string(char *buf, int buf_size, HFID *hfid)
#define db_private_free_and_init(thrd, ptr)
int disk_sectors_to_extend_npages(const int num_pages)
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)
STATIC_INLINE DB_VOLTYPE disk_get_voltype(VOLID volid) __attribute__((ALWAYS_INLINE))
#define pgbuf_fix(thread_p, vpid, fetch_mode, requestmode, condition)
void disk_rv_dump_set_creation_time(FILE *fp, int length_ignore, void *data)
static int disk_stab_count_free(THREAD_ENTRY *thread_p, DISK_STAB_CURSOR *cursor, bool *stop, void *args)
void disk_rv_dump_volume_expand(FILE *fp, int length_ignore, void *data)
static int disk_extend(THREAD_ENTRY *thread_p, DISK_EXTEND_INFO *expand_info, DISK_RESERVE_CONTEXT *reserve_context)
DISK_ISVALID disk_is_page_sector_reserved(THREAD_ENTRY *thread_p, VOLID volid, PAGEID pageid)
#define db_private_free(thrd, ptr)
int xdisk_get_purpose_and_space_info(THREAD_ENTRY *thread_p, VOLID volid, DISK_VOLPURPOSE *vol_purpose, DISK_VOLUME_SPACE_INFO *space_info)
#define db_private_alloc(thrd, size)
int disk_rv_redo_volume_expand(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
static void disk_auto_volume_expansion_daemon_destroy()
int disk_get_checkpoint(THREAD_ENTRY *thread_p, INT16 volid, LOG_LSA *vol_lsa)
#define ER_DISK_INCONSISTENT_NFREE_SECTS
#define CEIL_PTVDIV(dividend, divisor)
bool logtb_set_check_interrupt(THREAD_ENTRY *thread_p, bool flag)
STATIC_INLINE void disk_cache_lock_reserve(DISK_EXTEND_INFO *expand_info) __attribute__((ALWAYS_INLINE))
#define ER_BO_MAXNUM_VOLS_HAS_BEEN_EXCEEDED
#define DISK_VOLUME_SPACE_INFO_INITIALIZER
int pgbuf_flush_all(THREAD_ENTRY *thread_p, VOLID volid)
static DISK_ISVALID disk_is_sector_reserved(THREAD_ENTRY *thread_p, const DISK_VOLUME_HEADER *volheader, SECTID sectid, bool debug_crash)
STATIC_INLINE int disk_get_volheader_internal(THREAD_ENTRY *thread_p, VOLID volid, PGBUF_LATCH_MODE latch_mode, PAGE_PTR *page_volheader_out, DISK_VOLUME_HEADER **volheader_out, const char *file, int line) __attribute__((ALWAYS_INLINE))
void pgbuf_get_vpid(PAGE_PTR pgptr, VPID *vpid)
void disk_rv_dump_link(FILE *fp, int length_ignore, void *data)
void log_sysop_abort(THREAD_ENTRY *thread_p)
DKNSECTS nsect_perm_total
STATIC_INLINE void disk_cache_update_vol_free(VOLID volid, DKNSECTS delta_free) __attribute__((ALWAYS_INLINE))
STATIC_INLINE int disk_stab_cursor_compare(const DISK_STAB_CURSOR *first_cursor, const DISK_STAB_CURSOR *second_cursor) __attribute__((ALWAYS_INLINE))
int disk_rv_redo_dboutside_newvol(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
STATIC_INLINE char * disk_vhdr_get_next_vol_fullname(const DISK_VOLUME_HEADER *vhdr) __attribute__((ALWAYS_INLINE))
static int disk_volume_boot(THREAD_ENTRY *thread_p, VOLID volid, DB_VOLPURPOSE *purpose_out, DB_VOLTYPE *voltype_out, DISK_VOLUME_SPACE_INFO *space_out)
STATIC_INLINE int disk_stab_cursor_fix(THREAD_ENTRY *thread_p, DISK_STAB_CURSOR *cursor, PGBUF_LATCH_MODE latch_mode) __attribute__((ALWAYS_INLINE))
STATIC_INLINE void disk_stab_cursor_set_at_start(const DISK_VOLUME_HEADER *volheader, DISK_STAB_CURSOR *cursor) __attribute__((ALWAYS_INLINE))
volatile int owner_extend
DISK_VOLPURPOSE xdisk_get_purpose(THREAD_ENTRY *thread_p, INT16 volid)
bool logtb_is_interrupted(THREAD_ENTRY *thread_p, bool clear, bool *continue_checking)
static void error(const char *msg)
void log_append_postpone(THREAD_ENTRY *thread_p, LOG_RCVINDEX rcvindex, LOG_DATA_ADDR *addr, int length, const void *data)
#define FI_TEST(th, code, state)
bool log_check_system_op_is_started(THREAD_ENTRY *thread_p)
#define pgbuf_fix_if_not_deallocated(thread_p, vpid, latch_mode, latch_condition, page)
#define HFID_IS_NULL(hfid)
int fileio_expand_to(THREAD_ENTRY *thread_p, VOLID vol_id, DKNPAGES size_npages, DB_VOLTYPE voltype)
#define ER_DIAG_VOLID_NOT_EXIST
VOLID pgbuf_get_volume_id(PAGE_PTR pgptr)
int disk_rv_undoredo_set_creation_time(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
static int disk_cache_init(void)
static int disk_vhdr_set_vol_remarks(DISK_VOLUME_HEADER *vhdr, const char *vol_remarks)
STATIC_INLINE void disk_stab_cursor_set_at_end(const DISK_VOLUME_HEADER *volheader, DISK_STAB_CURSOR *cursor) __attribute__((ALWAYS_INLINE))
static bool disk_dump_goodvol_all(THREAD_ENTRY *thread_p, INT16 volid, void *ignore)
int fileio_synchronize(THREAD_ENTRY *thread_p, int vol_fd, const char *vlabel, FILEIO_SYNC_OPTION sync_dwb)
#define DISK_VOLHEADER_PAGE
void disk_unlock_extend(void)
STATIC_INLINE char * disk_vhdr_get_vol_fullname(const DISK_VOLUME_HEADER *vhdr) __attribute__((ALWAYS_INLINE))
#define csect_enter_as_reader(a, b, c)
#define free_and_init(ptr)
#define LOG_ISRESTARTED()
void pgbuf_flush(THREAD_ENTRY *thread_p, PAGE_PTR pgptr, bool free_page)
VOLID fileio_find_previous_perm_volume(THREAD_ENTRY *thread_p, VOLID volid)
#define DISK_PAGES_TO_SECTS(npages)
int bit64_count_zeros(UINT64 i)
#define ER_OBJ_INVALID_ARGUMENTS
#define DISK_SECTS_ROUND_DOWN(nsects)
static int disk_stab_set_bits_contiguous(THREAD_ENTRY *thread_p, DISK_STAB_CURSOR *cursor, bool *stop, void *args)
#define fault_inject_random_crash()
int db_make_string_copy(DB_VALUE *value, DB_CONST_C_CHAR str)
void disk_rv_dump_init_map(FILE *fp, int length_ignore, void *data)
int disk_spacedb(THREAD_ENTRY *thread_p, SPACEDB_ALL *spaceall, SPACEDB_ONEVOL **spacevols)
enum intl_codeset INTL_CODESET
DISK_CACHE_VOLINFO vols[LOG_MAX_DBVOLID+1]
#define BIT64_HEXA_PRINT_FORMAT
void pgbuf_set_page_ptype(THREAD_ENTRY *thread_p, PAGE_PTR pgptr, PAGE_TYPE ptype)
bool prm_get_bool_value(PARAM_ID prm_id)
static int disk_reserve_sectors_in_volume(THREAD_ENTRY *thread_p, int vol_index, DISK_RESERVE_CONTEXT *context)
volatile DKNSECTS nsect_intention
int boot_get_new_volume_name_and_id(THREAD_ENTRY *thread_p, DB_VOLTYPE voltype, const char *given_path, const char *given_name, char *fullname_newvol_out, VOLID *volid_newvol_out)
void log_sysop_attach_to_outer(THREAD_ENTRY *thread_p)
void log_sysop_commit(THREAD_ENTRY *thread_p)
STATIC_INLINE void disk_cache_unlock_reserve(DISK_EXTEND_INFO *expand_info) __attribute__((ALWAYS_INLINE))
int fileio_format(THREAD_ENTRY *thread_p, const char *db_full_name_p, const char *vol_label_p, VOLID vol_id, DKNPAGES npages, bool is_sweep_clean, bool is_do_lock, bool is_do_sync, size_t page_size, int kbytes_to_be_written_per_sec, bool reuse_file)
#define DISK_ALLOCTBL_SECTOR_PAGE_OFFSET(sect)
#define DB_VALUE_TYPE(value)
int dwb_flush_force(THREAD_ENTRY *thread_p, bool *all_sync)
int disk_rv_volhead_extend_undo(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
STATIC_INLINE int disk_vhdr_length_of_varfields(const DISK_VOLUME_HEADER *vhdr) __attribute__((ALWAYS_INLINE))
#define DISK_RESERVE_CONTEXT_AS_ARGS(context)
#define ER_DISK_INCONSISTENT_VOL_HEADER
pthread_mutex_t mutex_extend
int bit64_count_ones(UINT64 i)
#define pthread_mutex_lock(a)
#define DISK_STAB_UNIT_SIZE_OF
INT16 xdisk_get_purpose_and_sys_lastpage(THREAD_ENTRY *thread_p, INT16 volid, DISK_VOLPURPOSE *vol_purpose, INT32 *sys_lastpage)
static const char * disk_type_to_string(DB_VOLTYPE voltype)
static cubthread::daemon * disk_Auto_volume_expansion_daemon
static int disk_stab_unit_unreserve(THREAD_ENTRY *thread_p, DISK_STAB_CURSOR *cursor, bool *stop, void *args)
static int disk_add_volume(THREAD_ENTRY *thread_p, DBDEF_VOL_EXT_INFO *extinfo, VOLID *volid_out, DKNSECTS *nsects_free_out)
int db_make_int(DB_VALUE *value, const int num)
pthread_mutex_t mutex_reserve
DISK_ISVALID disk_check(THREAD_ENTRY *thread_p, bool repair)
STATIC_INLINE void disk_stab_cursor_set_bit(DISK_STAB_CURSOR *cursor) __attribute__((ALWAYS_INLINE))
#define PGBUF_PAGE_LSA_AS_ARGS(pg)
int disk_get_creation_time(THREAD_ENTRY *thread_p, INT16 volid, INT64 *db_creation)
STATIC_INLINE void disk_cache_unlock_reserve_for_purpose(DB_VOLPURPOSE purpose) __attribute__((ALWAYS_INLINE))
#define PGBUF_PAGE_STATE_MSG(name)
STATIC_INLINE char * disk_vhdr_get_vol_remarks(const DISK_VOLUME_HEADER *vhdr) __attribute__((ALWAYS_INLINE))
void disk_lock_extend(void)
int disk_rv_redo_init_map(THREAD_ENTRY *thread_p, LOG_RCV *rcv)
#define DISK_STAB_UNIT_BIT_COUNT
DKNSECTS nsects_lastvol_remaining
static int disk_stab_unit_reserve(THREAD_ENTRY *thread_p, DISK_STAB_CURSOR *cursor, bool *stop, void *args)
volatile int owner_reserve
int log_get_db_start_parameters(INT64 *db_creation, LOG_LSA *chkpt_lsa)
void pgbuf_set_lsa_as_temporary(THREAD_ENTRY *thread_p, PAGE_PTR pgptr)
static DISK_CACHE * disk_Cache
int fileio_open(const char *vol_label_p, int flags, int mode)
static DKNSECTS disk_Temp_max_sects
static DISK_ISVALID disk_check_volume(THREAD_ENTRY *thread_p, INT16 volid, bool repair)
#define CUBRID_MAGIC_DATABASE_VOLUME
#define PGBUF_PAGE_STATE_ARGS(pg)
#define HFID_COPY(hfid_ptr1, hfid_ptr2)
STATIC_INLINE bool disk_is_valid_volid(VOLID volid) __attribute__((ALWAYS_INLINE))
#define DISK_ALLOCTBL_SECTOR_UNIT_OFFSET(sect)
static DISK_ISVALID disk_check_sectors_are_reserved_in_volume(THREAD_ENTRY *thread_p, VOLID volid, DISK_RESERVE_CONTEXT *context)
#define DISK_SECTOR_NPAGES
bool fileio_map_mounted(THREAD_ENTRY *thread_p, bool(*fun)(THREAD_ENTRY *thread_p, VOLID vol_id, void *args), void *args)
VOLID xboot_find_last_temp(THREAD_ENTRY *thread_p)
DISK_EXTEND_INFO extend_info
bool bit64_is_set(UINT64 i, int off)
char next_vol_fullname[1]
#define DISK_STAB_PAGE_BIT_COUNT
static int disk_stab_iterate_units_all(THREAD_ENTRY *thread_p, const DISK_VOLUME_HEADER *volheader, PGBUF_LATCH_MODE mode, DISK_STAB_UNIT_FUNC f_unit, void *f_unit_args)
#define pthread_mutex_destroy(a)
int fileio_get_volume_descriptor(VOLID vol_id)