CUBRID Engine  latest
disk_manager.h File Reference
#include "config.h"
#include "error_manager.h"
#include "log_lsa.hpp"
#include "recovery.h"
#include "storage_common.h"
#include "thread_compat.hpp"
Include dependency graph for disk_manager.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  disk_volume_space_info
 
struct  disk_volmap_clone
 

Macros

#define DISK_VOLHEADER_PAGE   0 /* Page of the volume header */
 
#define VSID_SET_NULL(vsidp)   (vsidp)->sectid = NULL_SECTID; (vsidp)->volid = NULL_VOLID
 
#define VSID_IS_NULL(vsidp)   ((vsidp)->sectid == NULL_SECTID || (vsidp)->volid == NULL_VOLID)
 
#define VSID_COPY(dest, src)   *((VSID *) dest) = *((VSID *) src)
 
#define VSID_EQ(first, second)   ((first)->volid == (second)->volid && (first)->sectid == (second)->sectid)
 
#define DISK_VOLUME_SPACE_INFO_INITIALIZER   { 0, 0, 0 }
 
#define DISK_SECTS_SIZE(nsects)   ((INT64) (nsects) * IO_SECTORSIZE)
 
#define DISK_SECTS_NPAGES(nsects)   ((nsects) * DISK_SECTOR_NPAGES)
 
#define DISK_PAGES_TO_SECTS(npages)   (CEIL_PTVDIV (npages, DISK_SECTOR_NPAGES))
 

Typedefs

typedef struct disk_volume_space_info DISK_VOLUME_SPACE_INFO
 
typedef struct disk_volmap_clone DISK_VOLMAP_CLONE
 

Enumerations

enum  DISK_FLUSH_TYPE { DISK_DONT_FLUSH, DISK_FLUSH, DISK_FLUSH_AND_INVALIDATE }
 
enum  DISK_ISVALID { DISK_INVALID, DISK_VALID, DISK_ERROR }
 

Functions

int disk_manager_init (THREAD_ENTRY *thread_p, bool load_form_disk)
 
void disk_manager_final (void)
 
int disk_format_first_volume (THREAD_ENTRY *thread_p, const char *full_dbname, const char *dbcomments, DKNPAGES npages)
 
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)
 
void disk_lock_extend (void)
 
void disk_unlock_extend (void)
 
int disk_unformat (THREAD_ENTRY *thread_p, const char *vol_fullname)
 
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_page)
 
int disk_set_link (THREAD_ENTRY *thread_p, INT16 volid, INT16 next_volid, const char *next_volext_fullname, bool logchange, DISK_FLUSH_TYPE flush)
 
int disk_set_checkpoint (THREAD_ENTRY *thread_p, INT16 volid, const LOG_LSA *log_chkpt_lsa)
 
int disk_set_boot_hfid (THREAD_ENTRY *thread_p, INT16 volid, const HFID *hfid)
 
int disk_reserve_sectors (THREAD_ENTRY *thread_p, DB_VOLPURPOSE purpose, VOLID volid_hint, int n_sectors, VSID *reserved_sectors)
 
int disk_unreserve_ordered_sectors (THREAD_ENTRY *thread_p, DB_VOLPURPOSE purpose, int nsects, VSID *vsids)
 
DISK_ISVALID disk_is_page_sector_reserved (THREAD_ENTRY *thread_p, VOLID volid, PAGEID pageid)
 
DISK_ISVALID disk_is_page_sector_reserved_with_debug_crash (THREAD_ENTRY *thread_p, VOLID volid, PAGEID pageid, bool debug_crash)
 
DISK_ISVALID disk_check_sectors_are_reserved (THREAD_ENTRY *thread_p, VSID *vsids, int nsects)
 
INT16 xdisk_get_purpose_and_sys_lastpage (THREAD_ENTRY *thread_p, INT16 volid, DISK_VOLPURPOSE *vol_purpose, INT32 *sys_lastpage)
 
int disk_get_checkpoint (THREAD_ENTRY *thread_p, INT16 volid, LOG_LSA *vol_lsa)
 
int disk_get_creation_time (THREAD_ENTRY *thread_p, INT16 volid, INT64 *db_creation)
 
INT32 disk_get_total_numsectors (THREAD_ENTRY *thread_p, INT16 volid)
 
HFIDdisk_get_boot_hfid (THREAD_ENTRY *thread_p, INT16 volid, HFID *hfid)
 
char * disk_get_link (THREAD_ENTRY *thread_p, INT16 volid, INT16 *next_volid, char *next_volext_fullname)
 
DISK_ISVALID disk_check (THREAD_ENTRY *thread_p, bool repair)
 
int disk_dump_all (THREAD_ENTRY *thread_p, FILE *fp)
 
int disk_spacedb (THREAD_ENTRY *thread_p, SPACEDB_ALL *spaceall, SPACEDB_ONEVOL **spacevols)
 
int disk_volume_header_start_scan (THREAD_ENTRY *thread_p, int type, DB_VALUE **arg_values, int arg_cnt, void **ctx)
 
int disk_volume_header_end_scan (THREAD_ENTRY *thread_p, void **ctx)
 
SCAN_CODE disk_volume_header_next_scan (THREAD_ENTRY *thread_p, int cursor, DB_VALUE **out_values, int out_cnt, void *ctx)
 
int disk_compare_vsids (const void *a, const void *b)
 
int disk_rv_redo_dboutside_newvol (THREAD_ENTRY *thread_p, LOG_RCV *rcv)
 
int disk_rv_undo_format (THREAD_ENTRY *thread_p, LOG_RCV *rcv)
 
int disk_rv_redo_format (THREAD_ENTRY *thread_p, LOG_RCV *rcv)
 
void disk_rv_dump_hdr (FILE *fp, int length_ignore, void *data)
 
int disk_rv_redo_init_map (THREAD_ENTRY *thread_p, LOG_RCV *rcv)
 
void disk_rv_dump_init_map (FILE *fp, int length_ignore, void *data)
 
int disk_rv_undoredo_set_creation_time (THREAD_ENTRY *thread_p, LOG_RCV *rcv)
 
void disk_rv_dump_set_creation_time (FILE *fp, int length_ignore, void *data)
 
int disk_rv_undoredo_set_boot_hfid (THREAD_ENTRY *thread_p, LOG_RCV *rcv)
 
void disk_rv_dump_set_boot_hfid (FILE *fp, int length_ignore, void *data)
 
int disk_rv_undoredo_link (THREAD_ENTRY *thread_p, LOG_RCV *rcv)
 
void disk_rv_dump_link (FILE *fp, int length_ignore, void *data)
 
int disk_rv_redo_volume_expand (THREAD_ENTRY *thread_p, LOG_RCV *rcv)
 
void disk_rv_dump_volume_expand (FILE *fp, int length_ignore, void *data)
 
int disk_rv_reserve_sectors (THREAD_ENTRY *thread_p, LOG_RCV *rcv)
 
int disk_rv_unreserve_sectors (THREAD_ENTRY *thread_p, LOG_RCV *rcv)
 
int disk_rv_volhead_extend_redo (THREAD_ENTRY *thread_p, LOG_RCV *rcv)
 
int disk_rv_volhead_extend_undo (THREAD_ENTRY *thread_p, LOG_RCV *rcv)
 
void disk_volheader_check_magic (THREAD_ENTRY *thread_p, const PAGE_PTR page_volheader)
 
int disk_sectors_to_extend_npages (const int num_pages)
 

Macro Definition Documentation

#define DISK_PAGES_TO_SECTS (   npages)    (CEIL_PTVDIV (npages, DISK_SECTOR_NPAGES))

Definition at line 71 of file disk_manager.h.

Referenced by disk_sectors_to_extend_npages().

#define DISK_SECTS_SIZE (   nsects)    ((INT64) (nsects) * IO_SECTORSIZE)

Definition at line 69 of file disk_manager.h.

Referenced by disk_add_volume().

#define DISK_VOLUME_SPACE_INFO_INITIALIZER   { 0, 0, 0 }

Definition at line 67 of file disk_manager.h.

Referenced by disk_cache_load_volume().

#define VSID_COPY (   dest,
  src 
)    *((VSID *) dest) = *((VSID *) src)

Definition at line 43 of file disk_manager.h.

#define VSID_EQ (   first,
  second 
)    ((first)->volid == (second)->volid && (first)->sectid == (second)->sectid)

Definition at line 44 of file disk_manager.h.

Referenced by file_table_collector_has_page().

#define VSID_IS_NULL (   vsidp)    ((vsidp)->sectid == NULL_SECTID || (vsidp)->volid == NULL_VOLID)

Definition at line 42 of file disk_manager.h.

#define VSID_SET_NULL (   vsidp)    (vsidp)->sectid = NULL_SECTID; (vsidp)->volid = NULL_VOLID

Definition at line 41 of file disk_manager.h.

Typedef Documentation

Definition at line 74 of file disk_manager.h.

Definition at line 60 of file disk_manager.h.

Enumeration Type Documentation

Enumerator
DISK_DONT_FLUSH 
DISK_FLUSH 
DISK_FLUSH_AND_INVALIDATE 

Definition at line 46 of file disk_manager.h.

Enumerator
DISK_INVALID 
DISK_VALID 
DISK_ERROR 

Definition at line 53 of file disk_manager.h.

Function Documentation

DISK_ISVALID disk_check ( THREAD_ENTRY thread_p,
bool  repair 
)

Definition at line 6348 of file disk_manager.c.

References ARG_FILE_LINE, assert, ASSERT_ERROR, ASSERT_ERROR_AND_SET, assert_release, bit64_clear(), bit64_is_set(), bit64_set_trailing_bits(), CSECT_DISK_CHECK, csect_enter, csect_exit, DB_PAGESIZE, DB_PERMANENT_DATA_PURPOSE, DB_TEMPORARY_DATA_PURPOSE, disk_check_volume(), DISK_ERROR, disk_get_volheader, DISK_INVALID, disk_log, DISK_STAB_PAGE_BIT_COUNT, DISK_STAB_UNIT_BIT_COUNT, DISK_STAB_UNIT_SIZE_OF, DISK_VALID, ER_ERROR_SEVERITY, ER_GENERIC_ERROR, ER_OUT_OF_VIRTUAL_MEMORY, er_set(), disk_perm_info::extend_info, disk_temp_info::extend_info, free_and_init, INF_WAIT, LOG_MAX_DBVOLID, disk_volmap_clone::map, NO_ERROR, disk_cache_volinfo::nsect_free, disk_extend_info::nsect_free, disk_temp_info::nsect_perm_free, disk_volume_header::nsect_total, NULL, disk_cache::nvols_perm, disk_cache::nvols_temp, OLD_PAGE, vpid::pageid, disk_cache::perm_purpose_info, pgbuf_fix, PGBUF_LATCH_READ, PGBUF_UNCONDITIONAL_LATCH, pgbuf_unfix, pgbuf_unfix_and_init, disk_cache_volinfo::purpose, vsid::sectid, SECTOR_FROM_PAGEID, disk_volmap_clone::size_map, disk_volume_header::stab_first_page, disk_volume_header::stab_npages, disk_volume_header::sys_lastpage, disk_cache::temp_purpose_info, disk_volume_header::volid, vpid::volid, vsid::volid, disk_cache::vols, xboot_find_last_permanent(), xboot_find_last_temp(), xboot_find_number_permanent_volumes(), and xboot_find_number_temp_volumes().

Referenced by disk_reserve_sectors(), and xboot_check_db_consistency().

Here is the caller graph for this function:

int disk_dump_all ( THREAD_ENTRY thread_p,
FILE *  fp 
)

Definition at line 5853 of file disk_manager.c.

References disk_dump_goodvol_all(), ER_FAILED, fileio_map_mounted(), NO_ERROR, and NULL.

Referenced by diagdb().

Here is the caller graph for this function:

HFID* disk_get_boot_hfid ( THREAD_ENTRY thread_p,
INT16  volid,
HFID hfid 
)
int disk_get_checkpoint ( THREAD_ENTRY thread_p,
INT16  volid,
LOG_LSA vol_lsa 
)
int disk_get_creation_time ( THREAD_ENTRY thread_p,
INT16  volid,
INT64 *  db_creation 
)
char* disk_get_link ( THREAD_ENTRY thread_p,
INT16  volid,
INT16 *  next_volid,
char *  next_volext_fullname 
)
INT32 disk_get_total_numsectors ( THREAD_ENTRY thread_p,
INT16  volid 
)
void disk_manager_final ( void  )

Definition at line 4980 of file disk_manager.c.

References disk_auto_volume_expansion_daemon_destroy(), and disk_cache_final().

Referenced by boot_server_all_finalize(), and disk_manager_init().

Here is the caller graph for this function:

void disk_rv_dump_hdr ( FILE *  fp,
int  length_ignore,
void *  data 
)

Definition at line 1405 of file disk_manager.c.

References disk_vhdr_dump().

void disk_rv_dump_init_map ( FILE *  fp,
int  length_ignore,
void *  data 
)

Definition at line 1453 of file disk_manager.c.

void disk_rv_dump_link ( FILE *  fp,
int  length_ignore,
void *  data 
)
void disk_rv_dump_set_boot_hfid ( FILE *  fp,
int  length_ignore,
void *  data 
)

Definition at line 1567 of file disk_manager.c.

References vfid::fileid, hfid::hpgid, hfid::vfid, and vfid::volid.

void disk_rv_dump_set_creation_time ( FILE *  fp,
int  length_ignore,
void *  data 
)
void disk_rv_dump_volume_expand ( FILE *  fp,
int  length_ignore,
void *  data 
)
int disk_rv_redo_volume_expand ( THREAD_ENTRY thread_p,
LOG_RCV rcv 
)
int disk_rv_undoredo_set_boot_hfid ( THREAD_ENTRY thread_p,
LOG_RCV rcv 
)
int disk_sectors_to_extend_npages ( const int  num_pages)

Definition at line 6744 of file disk_manager.c.

References DISK_PAGES_TO_SECTS, and DISK_SECTS_ROUND_UP.

Referenced by createdb(), disk_add_volume_extension(), and disk_format_first_volume().

Here is the caller graph for this function:

int disk_unformat ( THREAD_ENTRY thread_p,
const char *  vol_fullname 
)
int disk_unreserve_ordered_sectors ( THREAD_ENTRY thread_p,
DB_VOLPURPOSE  purpose,
int  nsects,
VSID vsids 
)

Definition at line 4634 of file disk_manager.c.

References ASSERT_ERROR, CSECT_DISK_CHECK, csect_enter_as_reader, csect_exit, disk_unreserve_ordered_sectors_without_csect(), INF_WAIT, and NO_ERROR.

Referenced by file_create(), and file_destroy().

Here is the caller graph for this function:

void disk_volheader_check_magic ( THREAD_ENTRY thread_p,
const PAGE_PTR  page_volheader 
)

Definition at line 6726 of file disk_manager.c.

References assert, CUBRID_MAGIC_DATABASE_VOLUME, CUBRID_MAGIC_MAX_LENGTH, disk_volume_header::magic, PAGE_VOLHEADER, and pgbuf_check_page_ptype().

Referenced by pgbuf_set_dirty().

Here is the caller graph for this function:

int disk_volume_header_end_scan ( THREAD_ENTRY thread_p,
void **  ctx 
)

Definition at line 3080 of file disk_manager.c.

References db_private_free_and_init, and NO_ERROR.

Referenced by showstmt_scan_init().

Here is the caller graph for this function:

int disk_volume_header_start_scan ( THREAD_ENTRY thread_p,
int  type,
DB_VALUE **  arg_values,
int  arg_cnt,
void **  ctx 
)
INT16 xdisk_get_purpose_and_sys_lastpage ( THREAD_ENTRY thread_p,
INT16  volid,
DISK_VOLPURPOSE vol_purpose,
INT32 *  sys_lastpage 
)