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

Consolidate Ivarator Config #2655

Open
wants to merge 32 commits into
base: integration
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
dd97c1e
Add IvaratorConfig class
SethSmucker Nov 25, 2024
94ce5ee
Add to QueryOptions
SethSmucker Nov 26, 2024
16516a9
GitHub Actions: Fix Formatting
Nov 26, 2024
a775c2a
Fix type conversion issues
SethSmucker Nov 27, 2024
079cbd1
Add serialization and QueryOption option
SethSmucker Nov 27, 2024
cd78978
Fix formatting issues
SethSmucker Nov 29, 2024
0bef499
Merge branch 'integration' into task/consolidate-ivaratorconfig
SethSmucker Dec 3, 2024
0acf575
Add tests
SethSmucker Dec 3, 2024
2e1917f
Finish tests
SethSmucker Dec 4, 2024
b59258d
merge
SethSmucker Dec 4, 2024
f8499ee
GitHub Actions: Fix Formatting
Dec 4, 2024
8e9e0ad
Merge branch 'integration' into task/consolidate-ivaratorconfig
SethSmucker Dec 4, 2024
b8a57be
Fix ShardQueryConfigurationTest issue
SethSmucker Dec 5, 2024
252e9f2
merge
SethSmucker Dec 5, 2024
b7cc60c
trivial commit
SethSmucker Dec 9, 2024
9273e65
merge
SethSmucker Dec 9, 2024
dcdf3ae
GitHub Actions: Fix Formatting
Dec 9, 2024
bb7ceb9
Added lazy initialization
SethSmucker Jan 17, 2025
59b1ce6
Merge cardinality
SethSmucker Jan 21, 2025
fea3168
Cardinality
SethSmucker Jan 21, 2025
6abfef7
Cardinality
SethSmucker Jan 21, 2025
20cc7bd
Merge branch 'integration' into task/consolidate-ivaratorconfig
SethSmucker Jan 21, 2025
e9da6db
GitHub Actions: Fix Formatting
Jan 21, 2025
1f02164
Merge branch 'integration' into task/consolidate-ivaratorconfig
SethSmucker Jan 22, 2025
ddd5466
Merge branch 'integration' into task/consolidate-ivaratorconfig
SethSmucker Jan 23, 2025
21c54dd
Copy IvaratorConfig files over
SethSmucker Jan 24, 2025
429797c
Apply wanted changes
SethSmucker Jan 24, 2025
d3e64cb
Merge from fix branch
SethSmucker Jan 24, 2025
7127169
GitHub Actions: Fix Formatting
Jan 24, 2025
ef2c835
Add resultTimeout
SethSmucker Jan 24, 2025
785feb0
Add resultTimeout
SethSmucker Jan 24, 2025
1de49d1
GitHub Actions: Fix Formatting
Jan 24, 2025
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
package datawave.query.config;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;

import datawave.query.iterator.ivarator.IvaratorCacheDirConfig;
import datawave.query.util.sortedset.FileSortedSet;

public class IvaratorConfig implements Serializable {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! Add a class level comment that this class encapsulates all ivarator configs in a single object to simplify serialization of configs between the webservice and tablet servers


private List<IvaratorCacheDirConfig> ivaratorCacheDirConfigs = Collections.emptyList();
private String ivaratorFstHdfsBaseURIs = null;
private int ivaratorCacheBufferSize = 10000;
private long ivaratorCacheScanPersistThreshold = 100000L;
private long ivaratorCacheScanTimeout = 1000L * 60 * 60;
private int maxFieldIndexRangeSplit = 11;
private int ivaratorMaxOpenFiles = 100;
private int ivaratorNumRetries = 2;
private boolean ivaratorPersistVerify = true;
private int ivaratorPersistVerifyCount = 100;
private long maxIvaratorSources = 33;
private long maxIvaratorSourceWait = 1000L * 60 * 30;
private long maxIvaratorResults = -1;

private static final ObjectMapper objectMapper = new ObjectMapper();

static {
objectMapper.configure(SerializationFeature.WRITE_SINGLE_ELEM_ARRAYS_UNWRAPPED, true);
objectMapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
}

public IvaratorConfig() {}

public IvaratorConfig(IvaratorConfig other) {
copyFrom(other);
}

public void copyFrom(IvaratorConfig other) {
this.setIvaratorCacheDirConfigs((other.getIvaratorCacheDirConfigs() == null) ? null : new ArrayList<>(other.getIvaratorCacheDirConfigs()));
this.setIvaratorFstHdfsBaseURIs(other.getIvaratorFstHdfsBaseURIs());
this.setIvaratorCacheBufferSize(other.getIvaratorCacheBufferSize());
this.setIvaratorCacheScanPersistThreshold(other.getIvaratorCacheScanPersistThreshold());
this.setIvaratorCacheScanTimeout(other.getIvaratorCacheScanTimeout());
this.setMaxFieldIndexRangeSplit(other.getMaxFieldIndexRangeSplit());
this.setIvaratorMaxOpenFiles(other.getIvaratorMaxOpenFiles());
this.setIvaratorNumRetries(other.getIvaratorNumRetries());
this.setIvaratorPersistVerify(other.isIvaratorPersistVerify());
this.setIvaratorPersistVerifyCount(other.getIvaratorPersistVerifyCount());
this.setMaxIvaratorSources(other.getMaxIvaratorSources());

}

public static String toJson(IvaratorConfig IvaratorConfig) throws JsonProcessingException {
return objectMapper.writeValueAsString(IvaratorConfig);
}

public static IvaratorConfig fromJson(String jsonArray) throws JsonProcessingException {
return objectMapper.readValue(jsonArray, IvaratorConfig.class);
}

public List<IvaratorCacheDirConfig> getIvaratorCacheDirConfigs() {
return ivaratorCacheDirConfigs;
}

public IvaratorConfig setIvaratorCacheDirConfigs(List<IvaratorCacheDirConfig> ivaratorCacheDirConfigs) {
this.ivaratorCacheDirConfigs = ivaratorCacheDirConfigs;
return this;
}

public String getIvaratorFstHdfsBaseURIs() {
return ivaratorFstHdfsBaseURIs;
}

public IvaratorConfig setIvaratorFstHdfsBaseURIs(String ivaratorFstHdfsBaseURIs) {
this.ivaratorFstHdfsBaseURIs = ivaratorFstHdfsBaseURIs;
return this;
}

public int getIvaratorCacheBufferSize() {
return ivaratorCacheBufferSize;
}

public IvaratorConfig setIvaratorCacheBufferSize(int ivaratorCacheBufferSize) {
this.ivaratorCacheBufferSize = ivaratorCacheBufferSize;
return this;
}

public long getIvaratorCacheScanPersistThreshold() {
return ivaratorCacheScanPersistThreshold;
}

public IvaratorConfig setIvaratorCacheScanPersistThreshold(long ivaratorCacheScanPersistThreshold) {
this.ivaratorCacheScanPersistThreshold = ivaratorCacheScanPersistThreshold;
return this;
}

public long getIvaratorCacheScanTimeout() {
return ivaratorCacheScanTimeout;
}

public IvaratorConfig setIvaratorCacheScanTimeout(long ivaratorCacheScanTimeout) {
this.ivaratorCacheScanTimeout = ivaratorCacheScanTimeout;
return this;
}

public int getMaxFieldIndexRangeSplit() {
return maxFieldIndexRangeSplit;
}

public IvaratorConfig setMaxFieldIndexRangeSplit(int maxFieldIndexRangeSplit) {
this.maxFieldIndexRangeSplit = maxFieldIndexRangeSplit;
return this;
}

public int getIvaratorMaxOpenFiles() {
return ivaratorMaxOpenFiles;
}

public IvaratorConfig setIvaratorMaxOpenFiles(int ivaratorMaxOpenFiles) {
this.ivaratorMaxOpenFiles = ivaratorMaxOpenFiles;
return this;
}

public int getIvaratorNumRetries() {
return ivaratorNumRetries;
}

public IvaratorConfig setIvaratorNumRetries(int ivaratorNumRetries) {
this.ivaratorNumRetries = ivaratorNumRetries;
return this;
}

public boolean isIvaratorPersistVerify() {
return ivaratorPersistVerify;
}

public IvaratorConfig setIvaratorPersistVerify(boolean ivaratorPersistVerify) {
this.ivaratorPersistVerify = ivaratorPersistVerify;
return this;
}

public int getIvaratorPersistVerifyCount() {
return ivaratorPersistVerifyCount;
}

public IvaratorConfig setIvaratorPersistVerifyCount(int ivaratorPersistVerifyCount) {
this.ivaratorPersistVerifyCount = ivaratorPersistVerifyCount;
return this;
}

public long getMaxIvaratorSources() {
return maxIvaratorSources;
}

public IvaratorConfig setMaxIvaratorSources(long maxIvaratorSources) {
this.maxIvaratorSources = maxIvaratorSources;
return this;
}

public long getMaxIvaratorSourceWait() {
return maxIvaratorSourceWait;
}

public IvaratorConfig setMaxIvaratorSourceWait(long maxIvaratorSourceWait) {
this.maxIvaratorSourceWait = maxIvaratorSourceWait;
return this;
}

public long getMaxIvaratorResults() {
return maxIvaratorResults;
}

public IvaratorConfig setMaxIvaratorResults(long maxIvaratorResults) {
this.maxIvaratorResults = maxIvaratorResults;
return this;
}

@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
IvaratorConfig other = (IvaratorConfig) obj;
return getIvaratorCacheBufferSize() == other.getIvaratorCacheBufferSize()
&& getIvaratorCacheScanPersistThreshold() == other.getIvaratorCacheScanPersistThreshold()
&& getIvaratorCacheScanTimeout() == other.getIvaratorCacheScanTimeout()
&& getMaxFieldIndexRangeSplit() == other.getMaxFieldIndexRangeSplit() && getIvaratorMaxOpenFiles() == other.getIvaratorMaxOpenFiles()
&& getIvaratorNumRetries() == other.getIvaratorNumRetries() && isIvaratorPersistVerify() == other.isIvaratorPersistVerify()
&& getIvaratorPersistVerifyCount() == other.getIvaratorPersistVerifyCount() && getMaxIvaratorSources() == other.getMaxIvaratorSources()
&& getMaxIvaratorSourceWait() == other.getMaxIvaratorSourceWait() && getMaxIvaratorResults() == other.getMaxIvaratorResults()
&& (getIvaratorCacheDirConfigs() == null ? other.getIvaratorCacheDirConfigs() == null
: getIvaratorCacheDirConfigs().equals(other.getIvaratorCacheDirConfigs()))
&& (getIvaratorFstHdfsBaseURIs() == null ? other.getIvaratorFstHdfsBaseURIs() == null
: getIvaratorFstHdfsBaseURIs().equals(other.getIvaratorFstHdfsBaseURIs()));
}

@Override
public int hashCode() {
return Objects.hash(getIvaratorCacheDirConfigs(), getIvaratorFstHdfsBaseURIs(), getIvaratorCacheBufferSize(), getIvaratorCacheScanPersistThreshold(),
getIvaratorCacheScanTimeout(), getMaxFieldIndexRangeSplit(), getIvaratorMaxOpenFiles(), getIvaratorNumRetries(),
isIvaratorPersistVerify(), getIvaratorPersistVerifyCount(), getMaxIvaratorSources(), getMaxIvaratorSourceWait(),
getMaxIvaratorResults());
}

}
Loading