mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-29 09:42:25 +00:00
Speed up dynamodb List() by only getting keys (#21159)
* Speed up ddb list by only getting keys * Add same optimization to has_children * Add changeling --------- Co-authored-by: Violet Hynes <violet.hynes@hashicorp.com>
This commit is contained in:
4
changelog/21159.txt
Normal file
4
changelog/21159.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
```release-note:improvement
|
||||
storage/dynamodb: Speed up list and delete of large directories by only requesting keys from DynamoDB
|
||||
```
|
||||
|
||||
@@ -410,6 +410,11 @@ func (d *DynamoDBBackend) List(ctx context.Context, prefix string) ([]string, er
|
||||
}},
|
||||
},
|
||||
},
|
||||
ProjectionExpression: aws.String("#key, #path"),
|
||||
ExpressionAttributeNames: map[string]*string{
|
||||
"#key": aws.String("Key"),
|
||||
"#path": aws.String("Path"),
|
||||
},
|
||||
}
|
||||
|
||||
d.permitPool.Acquire()
|
||||
@@ -453,6 +458,11 @@ func (d *DynamoDBBackend) hasChildren(prefix string, exclude []string) (bool, er
|
||||
}},
|
||||
},
|
||||
},
|
||||
ProjectionExpression: aws.String("#key, #path"),
|
||||
ExpressionAttributeNames: map[string]*string{
|
||||
"#key": aws.String("Key"),
|
||||
"#path": aws.String("Path"),
|
||||
},
|
||||
// Avoid fetching too many items from DynamoDB for performance reasons.
|
||||
// We want to know if there are any children we don't expect to see.
|
||||
// Answering that question requires fetching a minimum of one more item
|
||||
|
||||
Reference in New Issue
Block a user