mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 14:54:20 +01:00
closes [t:4906] Split ft-serialize.c. Added (hopefully temporary) ft-pwrite.c,h
git-svn-id: file:///svn/toku/tokudb@43725 c7de825b-a66e-492c-adef-691d508d4ae1
This commit is contained in:
parent
3719bf2c2f
commit
9162f7d0b6
7 changed files with 3180 additions and 3124 deletions
|
@ -32,7 +32,9 @@ set(FT_SOURCES
|
|||
ftloader.c
|
||||
ftloader-callback.c
|
||||
ft_msg.c
|
||||
ft_node-serialize.c
|
||||
ft-ops.c
|
||||
ft-pwrite.c
|
||||
ft-serialize.c
|
||||
ft-test-helpers.c
|
||||
ft-verify.c
|
||||
|
|
|
@ -377,4 +377,3 @@ block_allocator_get_unused_statistics(BLOCK_ALLOCATOR ba, TOKU_DB_FRAGMENTATION
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -923,4 +923,6 @@ toku_ft_node_put_cmd (
|
|||
|
||||
void toku_flusher_thread_set_callback(void (*callback_f)(int, void*), void* extra);
|
||||
|
||||
enum deserialize_error_code toku_upgrade_subtree_estimates_to_stat64info(int fd, FT h);
|
||||
|
||||
#endif
|
||||
|
|
43
ft/ft-pwrite.c
Normal file
43
ft/ft-pwrite.c
Normal file
|
@ -0,0 +1,43 @@
|
|||
/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
|
||||
// vim: expandtab:ts=8:sw=4:softtabstop=4:
|
||||
#ident "$Id: ft-serialize.c 43686 2012-05-18 23:21:00Z leifwalsh $"
|
||||
#ident "Copyright (c) 2007-2010 Tokutek Inc. All rights reserved."
|
||||
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
|
||||
|
||||
#include "includes.h"
|
||||
#include "sort.h"
|
||||
#include "threadpool.h"
|
||||
#include "ft-pwrite.h"
|
||||
#include <compress.h>
|
||||
|
||||
//TODO(fizzfaldt): determine if this is necessary AT ALL and try to delete
|
||||
// This mutex protects pwrite from running in parallel, and also protects modifications to the block allocator.
|
||||
static toku_mutex_t pwrite_mutex = { PTHREAD_MUTEX_INITIALIZER };
|
||||
static int pwrite_is_locked=0;
|
||||
|
||||
void
|
||||
toku_lock_for_pwrite(void) {
|
||||
// Locks the pwrite_mutex.
|
||||
toku_mutex_lock(&pwrite_mutex);
|
||||
pwrite_is_locked = 1;
|
||||
}
|
||||
|
||||
void
|
||||
toku_unlock_for_pwrite(void) {
|
||||
pwrite_is_locked = 0;
|
||||
toku_mutex_unlock(&pwrite_mutex);
|
||||
}
|
||||
|
||||
void
|
||||
toku_full_pwrite_extend(int fd, const void *buf, size_t count, toku_off_t offset)
|
||||
// requires that the pwrite has been locked
|
||||
// On failure, this does not return (an assertion fails or something).
|
||||
{
|
||||
invariant(pwrite_is_locked);
|
||||
{
|
||||
int r = maybe_preallocate_in_file(fd, offset+count);
|
||||
lazy_assert_zero(r);
|
||||
}
|
||||
toku_os_full_pwrite(fd, buf, count, offset);
|
||||
}
|
||||
|
16
ft/ft-pwrite.h
Normal file
16
ft/ft-pwrite.h
Normal file
|
@ -0,0 +1,16 @@
|
|||
/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
|
||||
// vim: expandtab:ts=8:sw=4:softtabstop=4:
|
||||
#ident "$Id: ft-serialize.c 43686 2012-05-18 23:21:00Z leifwalsh $"
|
||||
#ident "Copyright (c) 2007-2010 Tokutek Inc. All rights reserved."
|
||||
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
|
||||
|
||||
#ifndef FT_PWRITE_H
|
||||
#define FT_PWRITE_H
|
||||
|
||||
void toku_lock_for_pwrite(void);
|
||||
|
||||
void toku_unlock_for_pwrite(void);
|
||||
|
||||
void toku_full_pwrite_extend(int fd, const void *buf, size_t count, toku_off_t offset);
|
||||
|
||||
#endif
|
3274
ft/ft-serialize.c
3274
ft/ft-serialize.c
File diff suppressed because it is too large
Load diff
2966
ft/ft_node-serialize.c
Normal file
2966
ft/ft_node-serialize.c
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue