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

Vector tests improvements #2229

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion java/drivers/driver-hazelcast4plus/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</parent>

<properties>
<hazelcast.version>5.5.0</hazelcast.version>
<hazelcast.version>6.0.0-SNAPSHOT</hazelcast.version>
<main.basedir>${project.parent.basedir}</main.basedir>
<netty.version>4.1.94.Final</netty.version>
<netty-tcnative.version>2.0.34.Final</netty-tcnative.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public class VectorCollectionSearchDatasetTest extends HazelcastTest {
public String workingDirectory;

// common parameters

public int numberOfSearchIterations = Integer.MAX_VALUE;

public int loadFirst = Integer.MAX_VALUE;
Expand All @@ -55,6 +56,12 @@ public class VectorCollectionSearchDatasetTest extends HazelcastTest {

public boolean normalize = false;

// collection parameters
public String collectionName;

// by default do not use backups to get faster upload
public int backupCount = 0;

// search parameters

public int limit;
Expand All @@ -68,7 +75,6 @@ public class VectorCollectionSearchDatasetTest extends HazelcastTest {
private VectorCollection<Integer, Integer> collection;

private DatasetReader reader;
private DatasetReader testReader;

private TestDataset testDataset;

Expand All @@ -84,25 +90,27 @@ public class VectorCollectionSearchDatasetTest extends HazelcastTest {

@Setup
public void setup() {
if (collectionName == null) {
collectionName = name;
}
scoreMetrics.setName(name);
reader = DatasetReader.create(datasetUrl, workingDirectory, normalize);
if (testDatasetUrl != null) {
testReader = DatasetReader.create(testDatasetUrl, workingDirectory, normalize, true);
}

int dimension = reader.getDimension();
assert dimension == reader.getTestDatasetDimension() : "dataset dimension does not correspond to query vector dimension";
if (testDatasetUrl != null) {
var testReader = DatasetReader.create(testDatasetUrl, workingDirectory, normalize, true);
testDataset = testReader.getTestDataset();
} else {
testDataset = reader.getTestDataset();
}

logger.info("Vector collection name: {}", name);
logger.info("Vector collection name: {}", collectionName);
logger.info("Use normalize: {}", normalize);
collection = VectorCollection.getCollection(
targetInstance,
new VectorCollectionConfig(name)
new VectorCollectionConfig(collectionName)
.setBackupCount(backupCount)
.addVectorIndexConfig(
new VectorIndexConfig()
.setMetric(Metric.valueOf(metric))
Expand All @@ -123,6 +131,11 @@ public void setup() {
public void prepare() {
var size = Math.min(reader.getSize(), loadFirst);

if (collection.size() == size) {
logger.info("Collection seems to be already filled - reusing existing data.");
return;
}

var indexBuildTimeStart = System.currentTimeMillis();

Map<Integer, VectorDocument<Integer>> buffer = new HashMap<>();
Expand Down Expand Up @@ -163,8 +176,11 @@ public void prepare() {

logger.info("Collection size: {}", size);
logger.info("Collection dimension: {}", reader.getDimension());
logger.info("Cleanup time (min): {}", MILLISECONDS.toMinutes(cleanupTimer));
logger.info("Index build time (min): {}", MILLISECONDS.toMinutes(indexBuildTime));
logger.info("Cleanup time: {}s", MILLISECONDS.toSeconds(cleanupTimer));
logger.info("Index build time: {}s", MILLISECONDS.toSeconds(indexBuildTime));

// reader will no longer be needed
reader = null;
}

@TimeStep
Expand Down Expand Up @@ -204,6 +220,10 @@ public void afterRun() {
logger.info("10pt: {}", scoreMetrics.getPercentile(10));
logger.info("The percentage of results with precision lower than 98%: {}", scoreMetrics.getPercentLowerThen(98));
logger.info("The percentage of results with precision lower than 99%: {}", scoreMetrics.getPercentLowerThen(99));

// test dataset will no longer be needed
testDataset = null;
searchResults.clear();
}

public record TestSearchResult(int index, float[] searchVector, SearchResults<?, ?> results) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@

public final class BuildInfoUtils {

static final int DEFAULT_MAJOR_VERSION = 5;
static final int DEFAULT_MINOR_VERSION = 5;
static final int DEFAULT_MAJOR_VERSION = 6;
static final int DEFAULT_MINOR_VERSION = 0;

static final int DEFAULT_FALLBACK_MAJOR_VERSION = 5;
static final int DEFAULT_FALLBACK_MINOR_VERSION = 3;
Expand Down
14 changes: 10 additions & 4 deletions java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@
<url>https://repo1.maven.org/maven2</url>
</repository>
<repository>
<id>backup-repo</id>
<name>Backup Repository</name>
<url>https://repo2.maven.org/maven2/</url>
<id>snapshot-private</id>
<name>Hazelcast Private Snapshot Repository</name>
<url>https://repository.hazelcast.com/snapshot/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>snapshot-internal</id>
Expand All @@ -33,7 +39,7 @@
</snapshots>
</repository>
<repository>
<id>releaese-internal</id>
<id>release-internal</id>
<name>Hazelcast Internal</name>
<url>https://repository.hazelcast.com/release</url>
<releases>
Expand Down
9 changes: 9 additions & 0 deletions java/settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<settings>
<servers>
<server>
<id>snapshot-internal</id>
<username>${env.HZ_SNAPSHOT_INTERNAL_USERNAME}</username>
<password>${env.HZ_SNAPSHOT_INTERNAL_PASSWORD}</password>
</server>
</servers>
</settings>