mariadb/src-bdbwrap/noticecall.c
Bradley C. Kuszmaul 0a13028a99 More test cases
git-svn-id: file:///svn/tokudb@30 c7de825b-a66e-492c-adef-691d508d4ae1
2007-07-23 15:11:54 +00:00

43 lines
1.2 KiB
C

#include <db.h>
#include <pthread.h>
#include <stdlib.h>
#define MANAGER_BERKELEY_LOG_CLEANUP (1L << 0)
ulong volatile manager_status;
pthread_mutex_t LOCK_manager;
pthread_cond_t COND_manager;
void berkeley_noticecall(DB_ENV *db_env, db_notices notice)
{
switch (notice)
{
case DB_NOTICE_LOGFILE_CHANGED: /* purecov: tested */
pthread_mutex_lock(&LOCK_manager);
manager_status |= MANAGER_BERKELEY_LOG_CLEANUP;
pthread_mutex_unlock(&LOCK_manager);
pthread_cond_signal(&COND_manager);
break;
}
}
#define uint5korr(A) ((unsigned long long)(((unsigned long long) ((unsigned char) (A)[0])) +\
(((unsigned long long) ((unsigned char) (A)[1])) << 8) +\
(((unsigned long long) ((unsigned char) (A)[2])) << 16) +\
(((unsigned long long) ((unsigned char) (A)[3])) << 24)) +\
(((unsigned long long) ((unsigned char) (A)[4])) << 32))
int
berkeley_cmp_hidden_key(DB* file, const DBT *new_key, const DBT *saved_key)
{
unsigned long long a=uint5korr((char*) new_key->data);
unsigned long long b=uint5korr((char*) saved_key->data);
return a < b ? -1 : (a > b ? 1 : 0);
}
int
berkeley_cmp_packed_key(DB* file, const DBT *new_key, const DBT *saved_key)
{
printf("Whoops\n");
abort();
}