Commit 92eea2f4 authored by John Esmet's avatar John Esmet Committed by Yoni Fogel

close[t:3751] compression now switchable via makefile, via make COMPRESS=0....

close[t:3751] compression now switchable via makefile, via make COMPRESS=0. also, tokudb can installed into a local prefix, via make install

git-svn-id: file:///svn/toku/tokudb@35780 c7de825b-a66e-492c-adef-691d508d4ae1
parent 92766ad6
...@@ -84,8 +84,27 @@ clean: $(patsubst %,%.dir.clean,$(SRCDIRS)) cleanlib ...@@ -84,8 +84,27 @@ clean: $(patsubst %,%.dir.clean,$(SRCDIRS)) cleanlib
cleanlib: cleanlib:
rm -rf lib/*.$(SOEXT) lib/*.$(AEXT) lib/*.bundle rm -rf lib/*.$(SOEXT) lib/*.$(AEXT) lib/*.bundle
install: # This does not work, and probably hasn't worked since revision ~2000
./install.bash # install:
# ./install.bash
# Default to building locally in one's home directory
PREFIX = $(HOME)/local
# This is a quick hack for an install rule
install: release
mkdir -p $(PREFIX)/lib $(PREFIX)/include
/bin/cp release/lib/libtokudb.so $(PREFIX)/lib
/bin/cp release/lib/libtokuportability.so $(PREFIX)/lib
/bin/cp release/include/db.h $(PREFIX)/include/tokudb.h
/bin/cp release/include/tdb-internal.h $(PREFIX)/include
/bin/cp release/include/toku_list.h $(PREFIX)/include
uninstall:
/bin/rm -f $(PREFIX)/lib/libtokudb.so $(PREFIX)/lib/libtokuportability.so
/bin/rm -f $(PREFIX)/lib/libtokuportability.so
/bin/rm -f $(PREFIX)/include/tokudb.h $(PREFIX)/include/tdb-internal.h
/bin/rm -f $(PREFIX)/include/toku_list.h
# maybe we should have a coverage target in each makefile # maybe we should have a coverage target in each makefile
build-coverage: build-coverage:
......
...@@ -7,6 +7,11 @@ ifneq ($(COMBINE),0) ...@@ -7,6 +7,11 @@ ifneq ($(COMBINE),0)
COMBINE=1 COMBINE=1
endif endif
COMPRESS = 1
ifneq ($(COMPRESS), 1)
CFLAGS += -DTOKU_CONFIG_NO_COMPRESSION
endif
#TODO: Replace DEPEND_COMPILE with auto-dependancy generation. #TODO: Replace DEPEND_COMPILE with auto-dependancy generation.
DEPEND_COMPILE += \ DEPEND_COMPILE += \
$(wildcard *.h) \ $(wildcard *.h) \
......
...@@ -13,6 +13,8 @@ size_t toku_compress_bound (enum toku_compression_method a, size_t size) ...@@ -13,6 +13,8 @@ size_t toku_compress_bound (enum toku_compression_method a, size_t size)
// See compress.h for the specification of this function. // See compress.h for the specification of this function.
{ {
switch (a) { switch (a) {
case TOKU_NO_COMPRESSION:
return size + 1;
case TOKU_QUICKLZ_METHOD: case TOKU_QUICKLZ_METHOD:
return size+400 + 1; // quicklz manual says 400 bytes is enough. We need one more byte for the rfc1950-style header byte. bits 0-3 are 9, bits 4-7 are the QLZ_COMPRESSION_LEVEL. return size+400 + 1; // quicklz manual says 400 bytes is enough. We need one more byte for the rfc1950-style header byte. bits 0-3 are 9, bits 4-7 are the QLZ_COMPRESSION_LEVEL.
case TOKU_ZLIB_METHOD: case TOKU_ZLIB_METHOD:
...@@ -32,6 +34,11 @@ void toku_compress (enum toku_compression_method a, ...@@ -32,6 +34,11 @@ void toku_compress (enum toku_compression_method a,
{ {
assert(sourceLen < (1LL << 32)); assert(sourceLen < (1LL << 32));
switch (a) { switch (a) {
case TOKU_NO_COMPRESSION:
dest[0] = TOKU_NO_COMPRESSION;
memcpy(dest + 1, source, sourceLen);
*destLen = sourceLen + 1;
return;
case TOKU_ZLIB_METHOD: { case TOKU_ZLIB_METHOD: {
int r = compress2(dest, destLen, source, sourceLen, zlib_compression_level); int r = compress2(dest, destLen, source, sourceLen, zlib_compression_level);
assert(r == Z_OK); assert(r == Z_OK);
...@@ -64,6 +71,9 @@ void toku_decompress (Bytef *dest, uLongf destLen, ...@@ -64,6 +71,9 @@ void toku_decompress (Bytef *dest, uLongf destLen,
{ {
assert(sourceLen>=1); // need at least one byte for the RFC header. assert(sourceLen>=1); // need at least one byte for the RFC header.
switch (source[0] & 0xF) { switch (source[0] & 0xF) {
case TOKU_NO_COMPRESSION:
memcpy(dest, source + 1, sourceLen - 1);
return;
case TOKU_ZLIB_METHOD: { case TOKU_ZLIB_METHOD: {
uLongf actual_destlen = destLen; uLongf actual_destlen = destLen;
int r = uncompress(dest, &actual_destlen, source, sourceLen); int r = uncompress(dest, &actual_destlen, source, sourceLen);
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
// The resulting byte string includes enough information for us to decompress it. That is, we can tell whether it's z-compressed or qz-compressed. // The resulting byte string includes enough information for us to decompress it. That is, we can tell whether it's z-compressed or qz-compressed.
enum toku_compression_method { enum toku_compression_method {
TOKU_NO_COMPRESSION = 0, // "identity" compression
TOKU_ZLIB_METHOD = 8, // RFC 1950 says use 8 for zlib. It reserves 15 to allow more bytes. TOKU_ZLIB_METHOD = 8, // RFC 1950 says use 8 for zlib. It reserves 15 to allow more bytes.
TOKU_QUICKLZ_METHOD = 9 // We use 9 for QUICKLZ with compression level = 3. I couldn't find any standard for any other numbers, so I just use 9. -Bradley TOKU_QUICKLZ_METHOD = 9 // We use 9 for QUICKLZ with compression level = 3. I couldn't find any standard for any other numbers, so I just use 9. -Bradley
}; };
......
...@@ -144,9 +144,16 @@ compress_work_init(struct compress_work *w, struct sub_block *sub_block) { ...@@ -144,9 +144,16 @@ compress_work_init(struct compress_work *w, struct sub_block *sub_block) {
w->sub_block = sub_block; w->sub_block = sub_block;
} }
// Allow the makefile to optionally configure for no compression
#ifdef TOKU_CONFIG_NO_COMPRESSION
static enum toku_compression_method toku_compress_method = TOKU_NO_COMPRESSION;
#else
static enum toku_compression_method toku_compress_method = TOKU_QUICKLZ_METHOD; static enum toku_compression_method toku_compress_method = TOKU_QUICKLZ_METHOD;
#endif
void toku_set_default_compression_method (enum toku_compression_method a) { void toku_set_default_compression_method (enum toku_compression_method a) {
switch (a) { switch (a) {
case TOKU_NO_COMPRESSION:
case TOKU_ZLIB_METHOD: case TOKU_ZLIB_METHOD:
case TOKU_QUICKLZ_METHOD: case TOKU_QUICKLZ_METHOD:
toku_compress_method = a; toku_compress_method = a;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment