Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/core/compact_object.cc
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,9 @@ pair<void*, bool> DefragSet(unsigned encoding, void* ptr, float ratio) {
return DefragIntSet((intset*)ptr, ratio);
}

// StringMap supports re-allocation of it's internal nodes
case kEncodingStrMap2: {
return DefragStrMap2((StringMap*)ptr, ratio);
// Still not implemented
return {ptr, false};
}

default:
Expand Down
9 changes: 9 additions & 0 deletions src/core/compact_object_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "core/detail/bitpacking.h"
#include "core/flat_set.h"
#include "core/mi_memory_resource.h"
#include "core/string_set.h"

extern "C" {
#include "redis/intset.h"
Expand Down Expand Up @@ -575,6 +576,14 @@ TEST_F(CompactObjectTest, DefragHash) {
}
}

TEST_F(CompactObjectTest, DefragSet) {
// This is still not implemented
StringSet* s = new StringSet();
s->Add("str");
cobj_.InitRobj(OBJ_SET, kEncodingStrMap2, s);
ASSERT_FALSE(cobj_.DefragIfNeeded(0.8));
}

TEST_F(CompactObjectTest, RawInterface) {
string str(50, 'a'), tmp, owned;
cobj_.SetString(str);
Expand Down
Loading