mirror of
https://github.com/ceph/ceph
synced 2024-12-30 07:23:11 +00:00
Merge pull request #33584 from liewegas/fix-39525
compressor/lz4: work around bug in liblz4 versions <1.8.2 Reviewed-by: Neha Ojha <nojha@redhat.com>
This commit is contained in:
commit
63f5528930
@ -13,6 +13,7 @@ overrides:
|
||||
debug rocksdb: 10
|
||||
bluestore compression mode: aggressive
|
||||
bluestore fsck on mount: true
|
||||
bluestore compression algorithm: lz4
|
||||
# lower the full ratios since we can fill up a 100gb osd so quickly
|
||||
mon osd full ratio: .9
|
||||
mon osd backfillfull_ratio: .85
|
24
qa/objectstore/bluestore-comp-snappy.yaml
Normal file
24
qa/objectstore/bluestore-comp-snappy.yaml
Normal file
@ -0,0 +1,24 @@
|
||||
overrides:
|
||||
thrashosds:
|
||||
bdev_inject_crash: 2
|
||||
bdev_inject_crash_probability: .5
|
||||
ceph:
|
||||
fs: xfs
|
||||
conf:
|
||||
osd:
|
||||
osd objectstore: bluestore
|
||||
bluestore block size: 96636764160
|
||||
debug bluestore: 20
|
||||
debug bluefs: 20
|
||||
debug rocksdb: 10
|
||||
bluestore compression mode: aggressive
|
||||
bluestore fsck on mount: true
|
||||
bluestore compression algorithm: snappy
|
||||
# lower the full ratios since we can fill up a 100gb osd so quickly
|
||||
mon osd full ratio: .9
|
||||
mon osd backfillfull_ratio: .85
|
||||
mon osd nearfull ratio: .8
|
||||
osd failsafe full ratio: .95
|
||||
|
||||
# this doesn't work with failures bc the log writes are not atomic across the two backends
|
||||
# bluestore bluefs env mirror: true
|
24
qa/objectstore/bluestore-comp-zlib.yaml
Normal file
24
qa/objectstore/bluestore-comp-zlib.yaml
Normal file
@ -0,0 +1,24 @@
|
||||
overrides:
|
||||
thrashosds:
|
||||
bdev_inject_crash: 2
|
||||
bdev_inject_crash_probability: .5
|
||||
ceph:
|
||||
fs: xfs
|
||||
conf:
|
||||
osd:
|
||||
osd objectstore: bluestore
|
||||
bluestore block size: 96636764160
|
||||
debug bluestore: 20
|
||||
debug bluefs: 20
|
||||
debug rocksdb: 10
|
||||
bluestore compression mode: aggressive
|
||||
bluestore fsck on mount: true
|
||||
bluestore compression algorithm: zlib
|
||||
# lower the full ratios since we can fill up a 100gb osd so quickly
|
||||
mon osd full ratio: .9
|
||||
mon osd backfillfull_ratio: .85
|
||||
mon osd nearfull ratio: .8
|
||||
osd failsafe full ratio: .95
|
||||
|
||||
# this doesn't work with failures bc the log writes are not atomic across the two backends
|
||||
# bluestore bluefs env mirror: true
|
24
qa/objectstore/bluestore-comp-zstd.yaml
Normal file
24
qa/objectstore/bluestore-comp-zstd.yaml
Normal file
@ -0,0 +1,24 @@
|
||||
overrides:
|
||||
thrashosds:
|
||||
bdev_inject_crash: 2
|
||||
bdev_inject_crash_probability: .5
|
||||
ceph:
|
||||
fs: xfs
|
||||
conf:
|
||||
osd:
|
||||
osd objectstore: bluestore
|
||||
bluestore block size: 96636764160
|
||||
debug bluestore: 20
|
||||
debug bluefs: 20
|
||||
debug rocksdb: 10
|
||||
bluestore compression mode: aggressive
|
||||
bluestore fsck on mount: true
|
||||
bluestore compression algorithm: zstd
|
||||
# lower the full ratios since we can fill up a 100gb osd so quickly
|
||||
mon osd full ratio: .9
|
||||
mon osd backfillfull_ratio: .85
|
||||
mon osd nearfull ratio: .8
|
||||
osd failsafe full ratio: .95
|
||||
|
||||
# this doesn't work with failures bc the log writes are not atomic across the two backends
|
||||
# bluestore bluefs env mirror: true
|
@ -0,0 +1 @@
|
||||
.qa/objectstore/bluestore-comp-lz4.yaml
|
@ -0,0 +1 @@
|
||||
.qa/objectstore/bluestore-comp-snappy.yaml
|
@ -1 +0,0 @@
|
||||
.qa/objectstore/bluestore-comp.yaml
|
@ -0,0 +1 @@
|
||||
.qa/objectstore/bluestore-comp-snappy.yaml
|
@ -1 +0,0 @@
|
||||
.qa/objectstore/bluestore-comp.yaml
|
@ -36,6 +36,18 @@ class LZ4Compressor : public Compressor {
|
||||
}
|
||||
|
||||
int compress(const bufferlist &src, bufferlist &dst) override {
|
||||
// older versions of liblz4 introduce bit errors when compressing
|
||||
// fragmented buffers. this was fixed in lz4 commit
|
||||
// af127334670a5e7b710bbd6adb71aa7c3ef0cd72, which first
|
||||
// appeared in v1.8.2.
|
||||
//
|
||||
// workaround: rebuild if not contiguous.
|
||||
if (!src.is_contiguous()) {
|
||||
bufferlist new_src = src;
|
||||
new_src.rebuild();
|
||||
return compress(new_src, dst);
|
||||
}
|
||||
|
||||
#ifdef HAVE_QATZIP
|
||||
if (qat_enabled)
|
||||
return qat_accel.compress(src, dst);
|
||||
|
BIN
src/test/compressor/osdmaps/osdmap.2982809
Normal file
BIN
src/test/compressor/osdmaps/osdmap.2982809
Normal file
Binary file not shown.
38257
src/test/compressor/osdmaps/osdmap.2982809.h
Normal file
38257
src/test/compressor/osdmaps/osdmap.2982809.h
Normal file
File diff suppressed because it is too large
Load Diff
@ -23,6 +23,7 @@
|
||||
#include "compressor/Compressor.h"
|
||||
#include "compressor/CompressionPlugin.h"
|
||||
#include "global/global_context.h"
|
||||
#include "osd/OSDMap.h"
|
||||
|
||||
class CompressorTest : public ::testing::Test,
|
||||
public ::testing::WithParamInterface<const char*> {
|
||||
@ -157,6 +158,44 @@ TEST_P(CompressorTest, big_round_trip_file)
|
||||
#endif
|
||||
|
||||
|
||||
TEST_P(CompressorTest, round_trip_osdmap)
|
||||
{
|
||||
#include "osdmaps/osdmap.2982809.h"
|
||||
|
||||
auto compressor = Compressor::create(g_ceph_context, plugin);
|
||||
bufferlist orig;
|
||||
orig.append((char*)osdmap_a, sizeof(osdmap_a));
|
||||
cout << "orig length " << orig.length() << std::endl;
|
||||
uint32_t size = 128*1024;
|
||||
OSDMap *o = new OSDMap;
|
||||
o->decode(orig);
|
||||
bufferlist fbl;
|
||||
o->encode(fbl, o->get_encoding_features() | CEPH_FEATURE_RESERVED);
|
||||
ASSERT_TRUE(fbl.contents_equal(orig));
|
||||
for (int j = 0; j < 3; j++) {
|
||||
bufferlist chunk;
|
||||
uint32_t l = std::min(size, fbl.length() - j*size);
|
||||
chunk.substr_of(fbl, j*size, l);
|
||||
//fbl.rebuild();
|
||||
bufferlist compressed;
|
||||
int r = compressor->compress(chunk, compressed);
|
||||
ASSERT_EQ(0, r);
|
||||
bufferlist decompressed;
|
||||
r = compressor->decompress(compressed, decompressed);
|
||||
ASSERT_EQ(0, r);
|
||||
ASSERT_EQ(decompressed.length(), chunk.length());
|
||||
if (!decompressed.contents_equal(chunk)) {
|
||||
cout << "FAILED, orig bl was\n" << fbl << std::endl;
|
||||
ASSERT_TRUE(decompressed.contents_equal(chunk));
|
||||
}
|
||||
cout << "chunk " << chunk.length()
|
||||
<< " compressed " << compressed.length()
|
||||
<< " decompressed " << decompressed.length()
|
||||
<< " with " << plugin << std::endl;
|
||||
}
|
||||
delete o;
|
||||
}
|
||||
|
||||
TEST_P(CompressorTest, compress_decompress)
|
||||
{
|
||||
const char* test = "This is test text";
|
||||
|
Loading…
Reference in New Issue
Block a user