8000 prototype for forceOneShardAttributeValue by jsteemann · Pull Request #14701 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content
8000

prototype for forceOneShardAttributeValue #14701

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

Merged
merged 15 commits into from
Sep 7, 2021
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fixed getResponsibleShards usage
  • Loading branch information
hkernbach committed Sep 6, 2021
commit a198e5fb7b0b8ac6a2da18e7f28c42107caf8b63
20 changes: 18 additions & 2 deletions arangod/Aql/ShardLocking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,24 @@ void ShardLocking::addNode(ExecutionNode const* baseNode, size_t snippetId,
errorCode = col->getCollection()->getResponsibleShard(
forceOneShardAttributeValue + ":test:" + forceOneShardAttributeValue, shardId);
} else {
errorCode =
col->getCollection()->getResponsibleShard(forceOneShardAttributeValue, shardId);
auto const& shardKeys = col->getCollection().get()->shardKeys();
TRI_ASSERT(shardKeys.size());
auto const& shardKey = shardKeys.at(0);
if (shardKey == "_key:") {
errorCode =
col->getCollection()->getResponsibleShard(forceOneShardAttributeValue + ":test", shardId);
} else if (shardKey == ":_key") {
errorCode =
col->getCollection()->getResponsibleShard("test:" + forceOneShardAttributeValue, shardId);
} else {
VPackBuilder builder;
{
VPackObjectBuilder guard(&builder);
builder.add(shardKey, VPackValue(forceOneShardAttributeValue));
}
errorCode =
col->getCollection()->getResponsibleShard(builder.slice(), false, shardId);
}
}
if (errorCode != TRI_ERROR_NO_ERROR) {
THROW_ARANGO_EXCEPTION(errorCode);
Expand Down
0