@ -42,14 +42,10 @@
# include "util/mutexlock.h"
# include "util/mutexlock.h"
# include "util/string_util.h"
# include "util/string_util.h"
# ifdef OS_LINUX
static const size_t kPageSize = sysconf ( _SC_PAGESIZE ) ;
# else
static const size_t kPageSize = 4 * 1024 ;
# endif
namespace ROCKSDB_NAMESPACE {
namespace ROCKSDB_NAMESPACE {
using port : : kPageSize ;
static const int kDelayMicros = 100000 ;
static const int kDelayMicros = 100000 ;
struct Deleter {
struct Deleter {
@ -881,9 +877,10 @@ TEST_F(EnvPosixTest, PositionedAppend) {
// Verify the above
// Verify the above
std : : unique_ptr < SequentialFile > seq_file ;
std : : unique_ptr < SequentialFile > seq_file ;
ASSERT_OK ( env_ - > NewSequentialFile ( ift . name ( ) + " /f " , & seq_file , options ) ) ;
ASSERT_OK ( env_ - > NewSequentialFile ( ift . name ( ) + " /f " , & seq_file , options ) ) ;
char scratch [ kPageSize * 2 ] ;
size_t scratch_len = kPageSize * 2 ;
std : : unique_ptr < char [ ] > scratch ( new char [ scratch_len ] ) ;
Slice result ;
Slice result ;
ASSERT_OK ( seq_file - > Read ( sizeof ( scratch ) , & result , scratch ) ) ;
ASSERT_OK ( seq_file - > Read ( scratch_len , & result , scratch . get ( ) ) ) ;
ASSERT_EQ ( kPageSize + kBlockSize , result . size ( ) ) ;
ASSERT_EQ ( kPageSize + kBlockSize , result . size ( ) ) ;
ASSERT_EQ ( ' a ' , result [ kBlockSize - 1 ] ) ;
ASSERT_EQ ( ' a ' , result [ kBlockSize - 1 ] ) ;
ASSERT_EQ ( ' b ' , result [ kBlockSize ] ) ;
ASSERT_EQ ( ' b ' , result [ kBlockSize ] ) ;
@ -977,7 +974,6 @@ TEST_P(EnvPosixTestWithParam, AllocateTest) {
// allocate 100 MB
// allocate 100 MB
size_t kPreallocateSize = 100 * 1024 * 1024 ;
size_t kPreallocateSize = 100 * 1024 * 1024 ;
size_t kBlockSize = 512 ;
size_t kBlockSize = 512 ;
size_t kPageSize = 4096 ;
size_t kDataSize = 1024 * 1024 ;
size_t kDataSize = 1024 * 1024 ;
auto data_ptr = NewAligned ( kDataSize , ' A ' ) ;
auto data_ptr = NewAligned ( kDataSize , ' A ' ) ;
Slice data ( data_ptr . get ( ) , kDataSize ) ;
Slice data ( data_ptr . get ( ) , kDataSize ) ;