CUBRID Engine  latest
double_write_buffer.h
Go to the documentation of this file.
1 /*
2  * Copyright 2008 Search Solution Corporation
3  * Copyright 2016 CUBRID Corporation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 /*
20  * double_write_buffer.h
21  */
22 
23 #ifndef _DOUBLE_WRITE_BUFFER_H_
24 #define _DOUBLE_WRITE_BUFFER_H_
25 
26 #ident "$Id$"
27 
28 #include "file_io.h"
29 #include "log_lsa.hpp"
30 
31 /* The double write slot type */
32 typedef struct double_write_slot DWB_SLOT;
34 {
35  FILEIO_PAGE *io_page; /* The contained page or NULL. */
36  VPID vpid; /* The page identifier. */
37  LOG_LSA lsa; /* The page LSA */
38  unsigned int position_in_block; /* The position in block. */
39  unsigned int block_no; /* The number of the block where the slot reside. */
40 };
41 
42 /* double write buffer interface */
43 extern bool dwb_is_created (void);
44 extern int dwb_create (THREAD_ENTRY * thread_p, const char *dwb_path_p, const char *db_name_p);
45 extern int dwb_recreate (THREAD_ENTRY * thread_p);
46 extern int dwb_load_and_recover_pages (THREAD_ENTRY * thread_p, const char *dwb_path_p, const char *db_name_p);
47 extern int dwb_destroy (THREAD_ENTRY * thread_p);
48 extern char *dwb_get_volume_name (void);
49 extern int dwb_flush_force (THREAD_ENTRY * thread_p, bool * all_sync);
50 extern int dwb_read_page (THREAD_ENTRY * thread_p, const VPID * vpid, void *io_page, bool * success);
51 extern int dwb_set_data_on_next_slot (THREAD_ENTRY * thread_p, FILEIO_PAGE * io_page_p, bool can_wait,
52  DWB_SLOT ** p_dwb_slot);
53 extern int dwb_add_page (THREAD_ENTRY * thread_p, FILEIO_PAGE * io_page_p, VPID * vpid, DWB_SLOT ** p_dwb_slot);
54 
55 #if defined (SERVER_MODE)
56 extern void dwb_daemons_init ();
57 extern void dwb_daemons_destroy ();
58 #endif /* SERVER_MODE */
59 
60 #endif /* _DOUBLE_WRITE_BUFFER_H_ */
bool dwb_is_created(void)
int dwb_flush_force(THREAD_ENTRY *thread_p, bool *all_sync)
int dwb_create(THREAD_ENTRY *thread_p, const char *dwb_path_p, const char *db_name_p)
int dwb_recreate(THREAD_ENTRY *thread_p)
void THREAD_ENTRY
char * dwb_get_volume_name(void)
static int success()
int dwb_destroy(THREAD_ENTRY *thread_p)
int dwb_load_and_recover_pages(THREAD_ENTRY *thread_p, const char *dwb_path_p, const char *db_name_p)
int dwb_add_page(THREAD_ENTRY *thread_p, FILEIO_PAGE *io_page_p, VPID *vpid, DWB_SLOT **p_dwb_slot)
unsigned int position_in_block
int dwb_read_page(THREAD_ENTRY *thread_p, const VPID *vpid, void *io_page, bool *success)
int dwb_set_data_on_next_slot(THREAD_ENTRY *thread_p, FILEIO_PAGE *io_page_p, bool can_wait, DWB_SLOT **p_dwb_slot)