Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug in BlobID node assignment #172

Merged
merged 1 commit into from
Apr 16, 2021
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
3 changes: 2 additions & 1 deletion src/metadata_management.cc
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,8 @@ void AttachBlobToBucket(SharedMemoryContext *context, RpcContext *rpc,
bool is_swap_blob) {
MetadataManager *mdm = GetMetadataManagerFromContext(context);

int target_node = HashString(mdm, rpc, blob_name);
std::string internal_name = MakeInternalBlobName(blob_name, bucket_id);
int target_node = HashString(mdm, rpc, internal_name.c_str());
BlobID blob_id = {};
// NOTE(chogan): A negative node_id indicates a swap blob
blob_id.bits.node_id = is_swap_blob ? -target_node : target_node;
Expand Down
2 changes: 1 addition & 1 deletion src/metadata_storage_stb_ds.cc
Original file line number Diff line number Diff line change
Expand Up @@ -546,8 +546,8 @@ u64 GetFromStorage(MetadataManager *mdm, const char *key, MapType map_type) {
std::string ReverseGetFromStorage(MetadataManager *mdm, u64 id,
MapType map_type) {
std::string result;
size_t map_size = GetStoredMapSize(mdm, map_type);
IdMap *map = GetMap(mdm, map_type);
size_t map_size = shlen(map);

// TODO(chogan): @optimization This could be more efficient if necessary
for (size_t i = 0; i < map_size; ++i) {
Expand Down