2007-08-20 16:25:08 +00:00
|
|
|
#ifndef _STASIS_FLAGS_H__
|
|
|
|
#define _STASIS_FLAGS_H__
|
2009-10-05 22:39:09 +00:00
|
|
|
#include <stasis/bufferManager.h>
|
|
|
|
#include <stasis/logger/logger2.h>
|
|
|
|
#include <stasis/dirtyPageTable.h>
|
2010-12-03 02:18:56 +00:00
|
|
|
#include <stasis/io/handle.h>
|
|
|
|
#include <stasis/pageHandle.h>
|
2010-11-05 18:53:10 +00:00
|
|
|
/**
|
|
|
|
This is the type of log that is being used.
|
|
|
|
|
|
|
|
*/
|
|
|
|
extern stasis_log_t* (*stasis_log_factory)(void);
|
2007-08-20 16:25:08 +00:00
|
|
|
/**
|
|
|
|
This is the type of buffer manager that is being used.
|
|
|
|
|
|
|
|
Before Stasis is intialized it will be set to a default value.
|
|
|
|
It may be changed before Tinit() is called, or overridden at
|
|
|
|
compile time by defining USE_BUFFER_MANAGER.
|
|
|
|
|
|
|
|
(eg: gcc ... -DUSE_BUFFER_MANAGER=BUFFER_MANAGER_FOO)
|
|
|
|
|
|
|
|
@see constants.h for a list of recognized buffer manager implementations.
|
|
|
|
(The constants are named BUFFER_MANAGER_*)
|
|
|
|
|
|
|
|
*/
|
2009-10-05 22:39:09 +00:00
|
|
|
extern stasis_buffer_manager_t* (*stasis_buffer_manager_factory)(stasis_log_t*, stasis_dirty_page_table_t*);
|
2010-07-16 16:52:08 +00:00
|
|
|
|
|
|
|
extern pageid_t stasis_buffer_manager_size;
|
2010-09-23 23:09:43 +00:00
|
|
|
/**
|
|
|
|
If this is true, then the only thread that will perform writeback is the
|
|
|
|
buffer manager writeback thread. It turns out that splitting sequential
|
|
|
|
writes across many threads leads to a 90-95% reduction in write throughput.
|
|
|
|
|
|
|
|
Otherwise (the default) application threads will help write back dirty pages
|
|
|
|
so that we can get good concurrency on our writes.
|
|
|
|
*/
|
|
|
|
extern int stasis_buffer_manager_hint_writes_are_sequential;
|
2010-09-28 23:50:07 +00:00
|
|
|
/**
|
|
|
|
If this is true, then disable some optimizations associated with sequential
|
|
|
|
write mode. This will needlessly burn CPU by inserting dirty pages into
|
|
|
|
the LRU. In sequential write mode, these dirty pages will cause populateTLS
|
|
|
|
to loop excessively, excercising all sorts of extremely rare thread
|
|
|
|
synchronization schedules.
|
|
|
|
*/
|
|
|
|
extern int stasis_buffer_manager_debug_stress_latching;
|
2007-08-20 16:25:08 +00:00
|
|
|
/**
|
2010-12-03 02:18:56 +00:00
|
|
|
This determines which page handle infrastructure buffer manager will use.
|
|
|
|
Page handles sit between the buffer manager and io handles. Their main
|
|
|
|
purpose is to observe the buffer manager's I/O operations, and coordinate
|
|
|
|
with the dirty page table, log, and per-page state machines as necessary.
|
2007-08-20 16:25:08 +00:00
|
|
|
|
2010-12-03 02:18:56 +00:00
|
|
|
It defaults to stasis_page_handle_default_factory. It can be overridden
|
|
|
|
at compile time by defining STASIS_PAGE_HANDLE_FACTORY.
|
2007-08-20 16:25:08 +00:00
|
|
|
*/
|
2010-12-03 02:18:56 +00:00
|
|
|
extern stasis_page_handle_t* (*stasis_page_handle_factory)(stasis_log_t*, stasis_dirty_page_table_t*);
|
|
|
|
/**
|
|
|
|
This determines which Stasis handle factory will be called by the default
|
|
|
|
page_handle_factory. It defaults to a method that simply calls a standard
|
|
|
|
open method exported by the file-based handles, and passes in sane defaults
|
|
|
|
for file permissions, file names and so on.
|
|
|
|
|
|
|
|
@see stasis_handle_file_factory to change which underlying file API will
|
|
|
|
back the handle.
|
|
|
|
*/
|
|
|
|
extern stasis_handle_t* (*stasis_handle_factory)();
|
2007-08-20 16:25:08 +00:00
|
|
|
/**
|
2010-12-03 02:18:56 +00:00
|
|
|
This factory is invoked by the default stasis_handle_factory, and takes
|
|
|
|
additional file system parameters as arguments.
|
|
|
|
|
|
|
|
Valid options: stasis_handle_open_file(), stasis_handle_open_pfile(), and stasis_handle_non_blocking_factory.
|
|
|
|
*/
|
|
|
|
extern stasis_handle_t* (*stasis_handle_file_factory)(lsn_t logical_offset, const char* filename, int open_mode, int creat_perms);
|
|
|
|
/**
|
|
|
|
The factory that non_blocking handles will use for slow handles. (Only
|
|
|
|
used if stasis_buffer_manager_io_handle_default_factory is set to
|
|
|
|
stasis_non_blocking_factory.)
|
2007-08-20 16:25:08 +00:00
|
|
|
|
|
|
|
*/
|
2010-12-03 02:18:56 +00:00
|
|
|
extern stasis_handle_t* (*stasis_non_blocking_handle_file_factory)(lsn_t logical_offset, const char* filename, int open_mode, int creat_perms);
|
|
|
|
|
2007-08-20 16:25:08 +00:00
|
|
|
/**
|
2010-12-03 02:18:56 +00:00
|
|
|
If true, the buffer manager will use O_DIRECT, O_SYNC and so on (Mandatory
|
|
|
|
flags such as O_RDWR will be set regardless). Set at compile time by
|
|
|
|
defining STASIS_BUFFER_MANAGER_IO_HANDLE_FLAGS.
|
2007-08-20 16:25:08 +00:00
|
|
|
*/
|
2010-12-03 02:18:56 +00:00
|
|
|
extern int stasis_buffer_manager_io_handle_flags;
|
2010-09-27 00:11:34 +00:00
|
|
|
/**
|
|
|
|
If true, then concurrent LRU will use exponential backoff when it
|
|
|
|
has trouble finding a page to evict. If false, it will perform a
|
|
|
|
busy wait.
|
|
|
|
|
|
|
|
This definitely should be set to true when
|
|
|
|
stasis_buffer_manager_hint_sequential_writes is true. Otherwise
|
|
|
|
the only way that page writeback will be able to apply backpressure
|
|
|
|
to application threads will be to cause busy waits in concurrent
|
|
|
|
LRU.
|
|
|
|
*/
|
|
|
|
extern int stasis_replacement_policy_concurrent_wrapper_exponential_backoff;
|
|
|
|
/**
|
|
|
|
If true, then concurrent LRU will round the number of buckets up to
|
|
|
|
the next power of two, and use bit masks instead of mod when
|
|
|
|
assigning pages to buckets.
|
|
|
|
*/
|
|
|
|
extern int stasis_replacement_policy_concurrent_wrapper_power_of_two_buckets;
|
2007-10-23 23:16:58 +00:00
|
|
|
/**
|
|
|
|
If true, Stasis will suppress warnings regarding unclean shutdowns.
|
|
|
|
This is use to prevent spurious warnings during unit testing, and
|
|
|
|
must be set after Tinit() is called. (Tinit() resets this value to
|
|
|
|
false).
|
|
|
|
|
|
|
|
(This should not be set by applications, or during compilation.)
|
|
|
|
*/
|
|
|
|
extern int stasis_suppress_unclean_shutdown_warnings;
|
|
|
|
|
|
|
|
/*
|
|
|
|
Truncation options
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
If true, Stasis will spawn a background thread that periodically
|
|
|
|
truncates the log.
|
|
|
|
*/
|
|
|
|
extern int stasis_truncation_automatic;
|
|
|
|
|
2009-04-11 17:17:42 +00:00
|
|
|
/**
|
|
|
|
This is the log implementation that is being used.
|
|
|
|
|
|
|
|
Before Stasis is initialized it will be set to a default value.
|
|
|
|
It may be changed before Tinit() is called by assigning to it.
|
|
|
|
The default can be overridden at compile time by defining
|
|
|
|
USE_LOGGER.
|
|
|
|
|
|
|
|
(eg: gcc ... -DSTASIS_LOG_TYPE=LOG_TO_FOO)
|
|
|
|
|
|
|
|
@see constants.h for a list of recognized log implementations.
|
|
|
|
(The constants are named LOG_TO_*)
|
|
|
|
@todo rename LOG_TO_* constants to STASIS_LOG_TYPE_*
|
|
|
|
|
|
|
|
*/
|
|
|
|
extern int stasis_log_type;
|
|
|
|
|
2009-10-08 22:48:58 +00:00
|
|
|
extern size_t stasis_log_in_memory_max_entries;
|
|
|
|
|
2008-12-01 22:45:32 +00:00
|
|
|
extern char * stasis_log_file_name;
|
|
|
|
extern int stasis_log_file_mode;
|
|
|
|
extern int stasis_log_file_permissions;
|
2009-09-12 16:20:13 +00:00
|
|
|
extern int stasis_log_softcommit;
|
2008-12-01 22:45:32 +00:00
|
|
|
|
|
|
|
extern char * stasis_store_file_name;
|
2010-12-03 03:51:24 +00:00
|
|
|
extern char * stasis_store_file_1_name;
|
|
|
|
extern char * stasis_store_file_2_name;
|
|
|
|
|
2008-12-01 22:45:32 +00:00
|
|
|
|
2010-03-29 22:29:30 +00:00
|
|
|
/**
|
|
|
|
* Number of prefetch threads to create at startup. Zero disables the threads,
|
|
|
|
* which currently causes the pages to be read synchronously.
|
|
|
|
*/
|
|
|
|
extern int stasis_buffer_manager_hash_prefetch_count;
|
|
|
|
|
2009-01-05 21:57:33 +00:00
|
|
|
extern const char * stasis_log_dir_name;
|
|
|
|
/**
|
|
|
|
Maximum number of log chunks that will be created by file pool.
|
|
|
|
This number is treated as a hint.
|
|
|
|
*/
|
|
|
|
extern int stasis_log_file_pool_chunk_count_target;
|
|
|
|
/**
|
|
|
|
Minimum size of each completed log chunk. This number is treated
|
|
|
|
as a hint.
|
|
|
|
*/
|
|
|
|
extern lsn_t stasis_log_file_pool_chunk_min_size;
|
|
|
|
/**
|
|
|
|
Number of characters in log file names devoted to storing the LSN.
|
|
|
|
*/
|
|
|
|
extern const int stasis_log_dir_name_lsn_chars;
|
|
|
|
/**
|
|
|
|
Number of bytes that stasis' log may buffer before writeback.
|
|
|
|
*/
|
2009-05-13 18:04:53 +00:00
|
|
|
extern lsn_t stasis_log_file_write_buffer_size;
|
2010-05-11 22:01:37 +00:00
|
|
|
/**
|
|
|
|
Set to 1 if segment based recovery is enabled. This disables some
|
|
|
|
optimizations that assume all operations are page based.
|
|
|
|
|
2010-07-16 16:52:08 +00:00
|
|
|
@todo Stasis' segment implementation is a work in progress; therefore this is set to zero by default.
|
2010-05-11 22:01:37 +00:00
|
|
|
*/
|
|
|
|
extern int stasis_segments_enabled;
|
2007-08-20 16:25:08 +00:00
|
|
|
#endif
|