more include cleaning on alloc, begin cleaning of bufferHash
This commit is contained in:
parent
1ce1496226
commit
c4e80b41b5
6 changed files with 34 additions and 13 deletions
|
@ -27,6 +27,20 @@
|
|||
|
||||
//#define LATCH_SANITY_CHECKING
|
||||
|
||||
struct stasis_buffer_hash_t {
|
||||
struct LH_ENTRY(table) * cachedPages;
|
||||
pthread_t worker;
|
||||
pthread_mutex_t mut;
|
||||
pthread_cond_t readComplete;
|
||||
pthread_cond_t needFree;
|
||||
pageid_t pageCount;
|
||||
replacementPolicy *lru;
|
||||
stasis_buffer_pool_t *buffer_pool;
|
||||
stasis_page_handle_t *page_handler;
|
||||
int flushing;
|
||||
int running;
|
||||
};
|
||||
|
||||
static struct LH_ENTRY(table) * cachedPages;
|
||||
|
||||
static pthread_t worker;
|
||||
|
|
|
@ -5,9 +5,10 @@
|
|||
* Author: sears
|
||||
*/
|
||||
#include <stasis/logger/logger2.h>
|
||||
|
||||
#include <stasis/transactional.h>
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
struct stasis_log_group_force_t {
|
||||
stasis_log_t * log;
|
||||
|
|
|
@ -204,18 +204,17 @@ stasis_operation_impl stasis_op_impl_realloc() {
|
|||
}
|
||||
|
||||
static void stasis_alloc_register_old_regions();
|
||||
stasis_alloc_t* TallocInit() {
|
||||
stasis_alloc_t* stasis_alloc_init(stasis_allocation_policy_t * allocPolicy) {
|
||||
stasis_alloc_t * alloc = malloc(sizeof(*alloc));
|
||||
alloc->lastFreepage = PAGEID_T_MAX;
|
||||
alloc->allocPolicy = stasis_allocation_policy_init();
|
||||
alloc->allocPolicy = allocPolicy;
|
||||
pthread_mutex_init(&alloc->mut, 0);
|
||||
return alloc;
|
||||
}
|
||||
void TallocPostInit(stasis_alloc_t * alloc) {
|
||||
void stasis_alloc_post_init(stasis_alloc_t * alloc) {
|
||||
stasis_alloc_register_old_regions(alloc);
|
||||
}
|
||||
void TallocDeinit(stasis_alloc_t * alloc) {
|
||||
stasis_allocation_policy_deinit(alloc->allocPolicy);
|
||||
void stasis_alloc_deinit(stasis_alloc_t * alloc) {
|
||||
pthread_mutex_destroy(&alloc->mut);
|
||||
free(alloc);
|
||||
}
|
||||
|
|
|
@ -364,7 +364,7 @@ void stasis_recovery_initiate(stasis_log_t* log, stasis_alloc_t * alloc) {
|
|||
stasis_recovery_redo(log);
|
||||
DEBUG("Undo started\n");
|
||||
stasis_recovery_undo(log,1);
|
||||
TallocPostInit(alloc);
|
||||
stasis_alloc_post_init(alloc);
|
||||
DEBUG("Recovery complete.\n");
|
||||
|
||||
for(void * it = pblHtFirst(transactionLSN); it; it = pblHtNext(transactionLSN)) {
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <stasis/bufferManager/legacy/pageFile.h>
|
||||
|
||||
|
||||
|
||||
#include <stasis/logger/logger2.h>
|
||||
#include <stasis/logger/safeWrites.h>
|
||||
#include <stasis/logger/inMemoryLog.h>
|
||||
|
@ -32,6 +33,7 @@ static stasis_log_t* stasis_log_file = 0;
|
|||
stasis_dirty_page_table_t * stasis_dirty_page_table = 0;
|
||||
static stasis_truncation_t * stasis_truncation = 0;
|
||||
static stasis_alloc_t * stasis_alloc = 0;
|
||||
static stasis_allocation_policy_t * stasis_allocation_policy = 0;
|
||||
|
||||
/**
|
||||
This mutex protects stasis_transaction_table, numActiveXactions and
|
||||
|
@ -99,7 +101,8 @@ int Tinit() {
|
|||
stasis_buffer_manager_open(bufferManagerType, page_handle);
|
||||
DEBUG("Buffer manager type = %d\n", bufferManagerType);
|
||||
pageOperationsInit();
|
||||
stasis_alloc = TallocInit();
|
||||
stasis_allocation_policy = stasis_allocation_policy_init();
|
||||
stasis_alloc = stasis_alloc_init(stasis_allocation_policy);
|
||||
TnaiveHashInit();
|
||||
LinearHashNTAInit();
|
||||
BtreeInit();
|
||||
|
@ -359,7 +362,8 @@ int Tdeinit() {
|
|||
assert( stasis_transaction_table_num_active == 0 );
|
||||
stasis_truncation_deinit(stasis_truncation);
|
||||
TnaiveHashDeinit();
|
||||
TallocDeinit(stasis_alloc);
|
||||
stasis_alloc_deinit(stasis_alloc);
|
||||
stasis_allocation_policy_deinit(stasis_allocation_policy);
|
||||
stasis_buffer_manager_close();
|
||||
DEBUG("Closing page file tdeinit\n");
|
||||
stasis_page_deinit();
|
||||
|
@ -379,6 +383,9 @@ int TuncleanShutdown() {
|
|||
stasis_suppress_unclean_shutdown_warnings = 1;
|
||||
stasis_truncation_deinit(stasis_truncation);
|
||||
TnaiveHashDeinit();
|
||||
stasis_alloc_deinit(stasis_alloc);
|
||||
stasis_allocation_policy_deinit(stasis_allocation_policy);
|
||||
|
||||
stasis_buffer_manager_simulate_crash();
|
||||
// XXX: close_file?
|
||||
stasis_page_deinit();
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#define __ALLOC_H 1
|
||||
|
||||
#include <stasis/operations.h>
|
||||
|
||||
#include <stasis/allocationPolicy.h>
|
||||
stasis_operation_impl stasis_op_impl_alloc();
|
||||
stasis_operation_impl stasis_op_impl_dealloc();
|
||||
stasis_operation_impl stasis_op_impl_realloc();
|
||||
|
@ -23,9 +23,9 @@ typedef struct stasis_alloc_t stasis_alloc_t;
|
|||
void stasis_alloc_aborted(stasis_alloc_t* alloc, int xid);
|
||||
void stasis_alloc_committed(stasis_alloc_t* alloc, int xid);
|
||||
|
||||
stasis_alloc_t* TallocInit();
|
||||
void TallocPostInit(stasis_alloc_t* alloc);
|
||||
void TallocDeinit(stasis_alloc_t* alloc);
|
||||
stasis_alloc_t* stasis_alloc_init(stasis_allocation_policy_t * allocPolicy);
|
||||
void stasis_alloc_post_init(stasis_alloc_t* alloc);
|
||||
void stasis_alloc_deinit(stasis_alloc_t* alloc);
|
||||
/**
|
||||
Allocate a record.
|
||||
|
||||
|
|
Loading…
Reference in a new issue