Skip to content
Open
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
34 changes: 20 additions & 14 deletions client/src/com/aerospike/client/BatchDelete.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,25 +89,31 @@ public boolean equals(BatchRecord obj, ConfigurationProvider configProvider) {
public int size(Policy parentPolicy, ConfigurationProvider configProvider) {
int size = 2; // gen(2) = 2

if (policy != null) {
if (policy.filterExp != null) {
size += policy.filterExp.size();
}
// Cache frequently accessed values to minimize field dereferences.
BatchDeletePolicy p = this.policy;
boolean parentSendKey = parentPolicy.sendKey;

boolean sendkey;
sendkey = policy.sendKey;
if (configProvider != null) {
Configuration config = configProvider.fetchConfiguration();
if (config != null && config.hasDBDCsendKey()) {
sendkey = config.dynamicConfiguration.dynamicBatchDeleteConfig.sendKey.value;
}
if (p == null) {
if (parentSendKey) {
size += key.userKey.estimateSize() + Command.FIELD_HEADER_SIZE + 1;
}
return size;
}

if (sendkey || parentPolicy.sendKey) {
size += key.userKey.estimateSize() + Command.FIELD_HEADER_SIZE + 1;
if (p.filterExp != null) {
size += p.filterExp.size();
}

boolean sendKey = p.sendKey;

if (configProvider != null) {
Configuration config = configProvider.fetchConfiguration();
if (config != null && config.hasDBDCsendKey()) {
sendKey = config.dynamicConfiguration.dynamicBatchDeleteConfig.sendKey.value;
}
}
else if (parentPolicy.sendKey) {

if (sendKey || parentSendKey) {
size += key.userKey.estimateSize() + Command.FIELD_HEADER_SIZE + 1;
}
return size;
Expand Down