Use a compressing blockstore for BigBlobsTest. This way, we don't need that much RAM for running it (the big blobs created by the test case are mostly just zero and some few non-zero data areas)

This commit is contained in:
Sebastian Messmer 2015-12-14 17:18:12 +01:00
parent 1cdaf8e08d
commit 7a43c41787
2 changed files with 7 additions and 1 deletions

View File

@ -158,6 +158,7 @@ uint32_t DataTree::_numLeaves(const DataNode &node) const {
}
void DataTree::traverseLeaves(uint32_t beginIndex, uint32_t endIndex, function<void (DataLeafNode*, uint32_t)> func) {
//TODO Can we traverse in parallel?
unique_lock<shared_mutex> lock(_mutex); //TODO Only lock when resizing. Otherwise parallel read/write to a blob is not possible!
ASSERT(beginIndex <= endIndex, "Invalid parameters");
if (0 == endIndex) {
@ -277,6 +278,7 @@ uint64_t DataTree::_numStoredBytes(const DataNode &root) const {
}
void DataTree::resizeNumBytes(uint64_t newNumBytes) {
//TODO Can we resize in parallel? Especially creating new blocks (i.e. encrypting them) is expensive and should be done in parallel.
boost::upgrade_lock<shared_mutex> lock(_mutex);
{
boost::upgrade_to_unique_lock<shared_mutex> exclusiveLock(lock);

View File

@ -1,4 +1,6 @@
#include <gtest/gtest.h>
#include <messmer/blockstore/implementations/compressing/CompressingBlockStore.h>
#include <messmer/blockstore/implementations/compressing/compressors/RunLengthEncoding.h>
#include <messmer/blockstore/implementations/inmemory/InMemoryBlockStore.h>
#include <messmer/blockstore/implementations/inmemory/InMemoryBlock.h>
#include <messmer/cpp-utils/data/DataFixture.h>
@ -13,6 +15,8 @@ using cpputils::make_unique_ref;
using cpputils::DataFixture;
using cpputils::Data;
using blockstore::inmemory::InMemoryBlockStore;
using blockstore::compressing::CompressingBlockStore;
using blockstore::compressing::RunLengthEncoding;
// Test cases, ensuring that big blobs (>4G) work (i.e. testing that we don't use any 32bit variables for blob size, etc.)
class BigBlobsTest : public ::testing::Test {
@ -25,7 +29,7 @@ public:
static_assert(SMALL_BLOB_SIZE < max_uint_32, "LARGE_BLOB_SIZE should need 64bit or the test case is mute");
static_assert(LARGE_BLOB_SIZE > max_uint_32, "LARGE_BLOB_SIZE should need 64bit or the test case is mute");
unique_ref<BlobStore> blobStore = make_unique_ref<BlobStoreOnBlocks>(make_unique_ref<InMemoryBlockStore>(), BLOCKSIZE);
unique_ref<BlobStore> blobStore = make_unique_ref<BlobStoreOnBlocks>(make_unique_ref<CompressingBlockStore<RunLengthEncoding>>(make_unique_ref<InMemoryBlockStore>()), BLOCKSIZE);
unique_ref<Blob> blob = blobStore->create();
};