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

New Cottontail API, PolyphenyDB #224

Merged
merged 119 commits into from
Feb 7, 2022
Merged
Show file tree
Hide file tree
Changes from 117 commits
Commits
Show all changes
119 commits
Select commit Hold shift + click to select a range
6700870
Started implementation of Polypheny DB adapter.
Aug 25, 2021
bf301b2
Added missing library.
Aug 25, 2021
5b630a2
Started refactoring of data sources and configuration thereof.
Aug 25, 2021
201fa6d
Added Polypheny-DB dependency as actual Maven reference.
ppanopticon Aug 27, 2021
73ef482
Fixed PolyphenyEntityCreator
ppanopticon Aug 27, 2021
c2872da
Added missing comment.
ppanopticon Aug 27, 2021
aaed7c9
Added LOGGER field to PersistencyWriter
ppanopticon Aug 27, 2021
8223fd8
CottontailWriter no longer closes the CottontailWrapper.
ppanopticon Aug 27, 2021
211947d
Implemented first draft of PolyphenyWriter
ppanopticon Aug 27, 2021
60e86ff
Fixed few issues with regards to INSERTS into Polypheny DB.
ppanopticon Aug 27, 2021
d3e1236
Moved LOGGER field to DBSelector implementation.
ppanopticon Aug 27, 2021
15930cb
Fixed minor bugs.
ppanopticon Aug 27, 2021
e2ecbda
Simplified array construction in PolyphenyWriter.
ppanopticon Aug 27, 2021
58b65ed
Started implementation of PolyphenySelector.
ppanopticon Aug 27, 2021
023992b
Completed implementation of PolyphenySelector
ppanopticon Aug 27, 2021
ce2bb0e
CottontailWrapper now keeps its ManagedChannels in a pool.
Aug 30, 2021
46fdb04
Made necessary adjustments to Cottontail DB client (0.13.0)
ppanopticon Sep 22, 2021
de37311
Removed superfluous import.
ppanopticon Sep 22, 2021
ac2a29a
Merge remote-tracking branch 'origin/polyphenydb' into polyphenydb
ppanopticon Sep 22, 2021
1c294a9
Fixed tow minor issues.
Sep 22, 2021
a3b1340
Fixed an issue in CottontailSelector.getNearestNeighbourRows().
Sep 22, 2021
03d2af4
Added implementation for getNearestNeighborGeneric().
Sep 24, 2021
c76e494
Fixed issues in the way queries NNS queries were formed.
ppanopticon Sep 26, 2021
20fe4c5
Adjusted log levels.
ppanopticon Sep 27, 2021
30e0b83
Fixed and optimized PolyphenySelector
Sep 28, 2021
63b7b74
Made adjustments to support recent API changes.
ppanopticon Oct 3, 2021
cb11a15
Merged dev.
Oct 4, 2021
35d9490
Fixed LDC21TemporalUpdateCommand.
Oct 4, 2021
6f935eb
Fixed broken LSC Temporal Update
sauterl Oct 4, 2021
bf2bd49
Added simple CLI command to benchmark Polypheny DB.
ppanopticon Oct 7, 2021
19cef72
Renamed name of Cottontail DB based store.
ppanopticon Oct 7, 2021
f2b445a
Merge remote-tracking branch 'origin/polyphenydb' into polyphenydb
ppanopticon Oct 7, 2021
69a6cf6
Fixed semantic issue
ppanopticon Oct 7, 2021
3bc0834
Made some adjustments to PolyphenyBenchmarkCommand
ppanopticon Oct 13, 2021
a158e1b
Connections are now properly cleaned after execution.
ppanopticon Oct 15, 2021
04805c2
Fixed two compilation errors.
ppanopticon Oct 18, 2021
57c4359
Merge branch 'master' into polyphenydb
ppanopticon Oct 20, 2021
e3530a1
Merge branch 'dev' into polyphenydb
silvanheller Oct 28, 2021
5dfc2bb
specifying jar version
silvanheller Oct 28, 2021
da9070d
removing start & endabs
silvanheller Oct 28, 2021
5c5b583
Fixing temporal import for LSC
sauterl Oct 29, 2021
c013349
Bumped Polypheny Driver to 1.5.1 (maven hosted)
sauterl Nov 10, 2021
7baab9a
Merged dev into polyphenydb
sauterl Nov 10, 2021
7b9371e
Fixed compilation errors in tests (the're still disabled)
sauterl Nov 12, 2021
506a71d
Added embedded cottontaildb (Tests still broken)
sauterl Nov 12, 2021
459d641
Updated Polypheny-DB and Cottontail DB driver version.
ppanopticon Dec 20, 2021
9b1f801
Unified signature of CottontailWrapper and PolyphenyWrapper constructor.
ppanopticon Dec 20, 2021
1cb5c9f
All ADAMpro related classes have now been marked for deprecation.
ppanopticon Dec 20, 2021
7a74f61
Removed superfluous spaces.
ppanopticon Dec 20, 2021
405081d
Removed superfluous constructors.
ppanopticon Dec 20, 2021
d85e74e
Fixed compilation error.
ppanopticon Dec 20, 2021
d3a4255
Added todo for potential future work.
ppanopticon Dec 20, 2021
5478995
Fixed two more compilation errors.
ppanopticon Dec 20, 2021
c4dd6cc
Merge branch 'master' into polyphenydb
ppanopticon Dec 20, 2021
64d0f5d
Cleanup after merge.
ppanopticon Dec 20, 2021
dfdd285
Implemented new methods for metadat entity creation (with specific ta…
ppanopticon Dec 20, 2021
bd01eb9
DBSelector and PersistencyWriter now extend Closeable instead of Auto…
ppanopticon Dec 20, 2021
a9186d8
Fixed compilation errors in unit tests.
ppanopticon Dec 20, 2021
4e8d6b8
Added missing transaction ID.
ppanopticon Jan 3, 2022
4f6749d
Individual terms are now explicitly ORed
ppanopticon Jan 3, 2022
b16d33d
Fixed type issues and disabled two tests (see TODO).
ppanopticon Jan 3, 2022
64c6e17
Embedded Cottontail DB is no longer started in a dedicated thread (wh…
ppanopticon Jan 3, 2022
26d8049
Separated version of Cottontail DB and Cottontail DB Proto and elevat…
ppanopticon Jan 3, 2022
3c7cd43
Removed optimization, which is no longer required due to incremental …
ppanopticon Jan 3, 2022
840ea92
Embedded database should now be shutdown properly once tests have con…
ppanopticon Jan 3, 2022
a49fdfe
Catalogue is now properly closed upon shutdown.
ppanopticon Jan 3, 2022
5d93d7e
Trying to intercept errors that can occur when creating the Cottontai…
ppanopticon Jan 3, 2022
31d38bc
Caching of ManagedChannels now takes state of the channel into account.
ppanopticon Jan 3, 2022
cd85e8b
Adjusted test cases to be more in line with the Cineast API.
ppanopticon Jan 3, 2022
35942ca
Removed embedded Cottontail DB.
ppanopticon Jan 3, 2022
fe82ec8
Removed dependency on latest Cottontail DB version.
ppanopticon Jan 3, 2022
57eedaf
Updated to latest Cottontail DB version (tests only).
ppanopticon Jan 3, 2022
72ff775
Merge branch 'master' into polypheny-merge
silvanheller Jan 4, 2022
39514e4
reformatting codebase
silvanheller Jan 4, 2022
c01dee3
reformatting codebase
silvanheller Jan 4, 2022
cc87863
removing empty @param tags
silvanheller Jan 4, 2022
0a27431
starting polypheny-unittests
silvanheller Jan 5, 2022
c782671
finalizing unittests for polypheny
silvanheller Jan 5, 2022
1ed5aef
Merge branch 'master' into polyphenydb
silvanheller Jan 5, 2022
86d38d8
Fixed order of how PK_HINT and NULLABLE_HINT are applied during entit…
ppanopticon Jan 6, 2022
168bf08
Fixed SELECT EXISTS statement syntactically.
ppanopticon Jan 6, 2022
f0035d0
The PolyphenyIntegrationDBProvider now properly closes the wrapper in…
ppanopticon Jan 6, 2022
f43ca9f
Adjusted integration tests for compatibility to Polypheny DB.
ppanopticon Jan 6, 2022
b21a0e6
Fixed syntax error in BETWEEN queries.
ppanopticon Jan 6, 2022
9269f83
Fixed binding issue in PolyphenySelector.getFeatureVectors()
ppanopticon Jan 6, 2022
1f3cc1f
adding polypheny-vitrivr docker container for unit tests & ci
silvanheller Jan 24, 2022
cac1453
Merge branch 'master' into polyphenydb
silvanheller Jan 24, 2022
c8c0248
updating docker container name
silvanheller Jan 24, 2022
5d67c46
removing update for the time being
silvanheller Jan 24, 2022
fa911dc
adjusting new feature module
silvanheller Jan 24, 2022
09ddebc
update to postgres/polypheny connection
silvanheller Jan 24, 2022
d514c5f
added missing -X
silvanheller Jan 24, 2022
3532403
Fixed typo
ppanopticon Jan 25, 2022
308170d
Refactoring based on conversation with @lucaro:
ppanopticon Jan 26, 2022
91b80bb
Merge remote-tracking branch 'origin/polyphenydb' into polyphenydb
ppanopticon Jan 26, 2022
4d38ac5
Fixed typo.
ppanopticon Jan 26, 2022
bfb0968
Fixed unit tests.
ppanopticon Jan 26, 2022
2440df4
Renamed method to make intent clearer.
ppanopticon Jan 26, 2022
9fbfe3b
further github actions experimentation
silvanheller Jan 26, 2022
32d7aae
spaces and tabs
silvanheller Jan 26, 2022
998e132
docker options
silvanheller Jan 26, 2022
6915690
trying out docker network
silvanheller Jan 26, 2022
da66b0a
removing unneeded service containers
silvanheller Jan 26, 2022
1f34889
fixing payload
silvanheller Jan 26, 2022
a991b2c
typo in yml
silvanheller Jan 26, 2022
1408d1e
adding another test
silvanheller Jan 26, 2022
efe33e2
adding logging to understand test behavior
silvanheller Jan 31, 2022
c088b0d
adding new ci container
silvanheller Jan 31, 2022
8bb546e
ci script updates
silvanheller Jan 31, 2022
8cbf4de
Fixed PolyphenyWriter.exists() for the lack of better Polypheny DB su…
ppanopticon Feb 4, 2022
254c9b8
Implemented getRowsAND() explicitly.
ppanopticon Feb 4, 2022
6ef30f1
Fixed textBetweenANDInQuery
ppanopticon Feb 4, 2022
6ba81f3
Fixed issue in MetadataTest
ppanopticon Feb 4, 2022
4cd2b33
Updated gRPC dependency for cineast-proto.
ppanopticon Feb 4, 2022
6182bb6
Merge remote-tracking branch 'origin/master' into polyphenydb
silvanheller Feb 4, 2022
760d419
closing resources at least at the end, pending on the outcome of #251
silvanheller Feb 4, 2022
bbc0e05
resetting to defaults
silvanheller Feb 4, 2022
0ac3a69
removing unneeded payload, bumping cottontail version for CI
silvanheller Feb 4, 2022
402a30b
removing erroneous commented lines
silvanheller Feb 7, 2022
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
10 changes: 9 additions & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,24 @@ jobs:
# Setup Cottontail DB service container
services:
cottontail:
image: vitrivr/cottontaildb:0.12.11
image: vitrivr/cottontaildb:0.13.2
ports:
- 1865:1865
options: -it
polypheny-ci:
image: silvanheller/polypheny-vitrivr-ci:0.4.1
ports:
- 8070:8070
- 13137:13137
- 20591:20591

# Start actual job.
steps:
- uses: actions/checkout@v2
- name: nc connection test
run: nc -zv 127.0.0.1 1865
- name: polypheny connection test
run: nc -zv 127.0.0.1 13137
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
Expand Down
1 change: 1 addition & 0 deletions add-postgres-polypheny-payload
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"query": "ALTER ADAPTERS ADD \"postgresql\" USING 'org.polypheny.db.adapter.jdbc.stores.PostgresqlStore' WITH '{\"mode\":\"remote\",\"database\":\"polypheny\",\"password\":\"happy-jumping-alpaca\",\"port\":\"5432\",\"host\":\"polypheny-postgres\",\"username\":\"polypheny\",\"maxConnections\":\"25\"}'"}
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ allprojects {
group = 'org.vitrivr'

/* Our current version, on dev branch this should always be release+1-SNAPSHOT */
version = '3.6.4'
version = '3.7.0'

apply plugin: 'java-library'
apply plugin: 'maven-publish'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ public class APIEndpoint {
/**
* The retrieval logic used to retrieve
*/
public static ContinuousRetrievalLogic retrievalLogic = new ContinuousRetrievalLogic(
Config.sharedConfig().getDatabase());
public static ContinuousRetrievalLogic retrievalLogic = new ContinuousRetrievalLogic(Config.sharedConfig().getDatabase());

/**
* The single instance of this class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,13 @@ public static void start() {

LOGGER.info("Starting GRPC Endpoint at port {}", port);

server = ServerBuilder.forPort(port).addService(new CineastQueryService(APIEndpoint.retrievalLogic)) //FIXME this should come from a more reasonable location
.addService(new CineastExtractionService()).addService(new CineastManagementService()).build();
//server = ServerBuilder.forPort(port).addService(new CineastQueryService(APIEndpoint.retrievalLogic)) //FIXME this should come from a more reasonable location
// .addService(new CineastExtractionService()).addService(new CineastManagementService()).build();

try {
server.start();
} catch (IOException e) {
e.printStackTrace();
}
//try {
//server.start();
//} catch (IOException e) {
//}

}

Expand Down
5 changes: 4 additions & 1 deletion cineast-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,12 @@ signing {
dependencies {

/** THE Cottontail DB proto dependency */
api group: 'org.vitrivr', name: 'cottontaildb-proto', version: version_cottontail_proto
api group: 'org.vitrivr', name: 'cottontaildb-proto', version: version_cottontaildb_proto
api group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: version_kotlin_stdlib

/** THE Polypheny dependency */
api group: "org.polypheny", name: "polypheny-jdbc-driver", version: version_polypheny

/** THE ADAMpro proto dependency (legacy) */
api group: 'org.vitrivr', name: 'adampro-proto', version: version_adampro

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,91 +2,34 @@

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.File;
import java.util.function.Supplier;
import org.vitrivr.cineast.core.db.DBSelector;
import org.vitrivr.cineast.core.db.DBSelectorSupplier;
import org.vitrivr.cineast.core.db.NoDBSelector;
import org.vitrivr.cineast.core.db.NoDBWriter;
import org.vitrivr.cineast.core.db.DataSource;
import org.vitrivr.cineast.core.db.PersistencyWriter;
import org.vitrivr.cineast.core.db.PersistencyWriterSupplier;
import org.vitrivr.cineast.core.db.adampro.ADAMproEntityCreator;
import org.vitrivr.cineast.core.db.adampro.ADAMproSelector;
import org.vitrivr.cineast.core.db.adampro.ADAMproStreamingSelector;
import org.vitrivr.cineast.core.db.adampro.ADAMproWrapper;
import org.vitrivr.cineast.core.db.adampro.ADAMproWriter;
import org.vitrivr.cineast.core.db.cottontaildb.CottontailEntityCreator;
import org.vitrivr.cineast.core.db.cottontaildb.CottontailSelector;
import org.vitrivr.cineast.core.db.cottontaildb.CottontailWrapper;
import org.vitrivr.cineast.core.db.cottontaildb.CottontailWriter;
import org.vitrivr.cineast.core.db.json.JsonFileWriter;
import org.vitrivr.cineast.core.db.json.JsonSelector;
import org.vitrivr.cineast.core.db.memory.InMemoryEntityCreator;
import org.vitrivr.cineast.core.db.memory.InMemoryWriter;
import org.vitrivr.cineast.core.db.setup.EntityCreator;
import org.vitrivr.cineast.core.db.setup.NoEntityCreator;

public final class DatabaseConfig {


/**
* Default value for batchsize.
*/
public static final int DEFAULT_BATCH_SIZE = 1000;
public static final String DEFAULT_HOST = "localhost";
public static final int DEFAULT_PORT = 5890;
public static final boolean DEFAULT_PLAINTEXT = true;
public static final boolean SINGLE_CONNECTION = true;

private String host = DEFAULT_HOST;
private int port = DEFAULT_PORT;
private boolean plaintext = DEFAULT_PLAINTEXT;
private Writer writer = Writer.COTTONTAIL;
private Selector selector = Selector.COTTONTAIL;
private DataSource writer = DataSource.COTTONTAIL;
private DataSource selector = DataSource.COTTONTAIL;

private Integer batchsize = DEFAULT_BATCH_SIZE;

private static final PersistencyWriterSupplier NO_WRITER_SUPPLY = NoDBWriter::new;

private static final DBSelectorSupplier NO_SELECTOR_SUPPLY = NoDBSelector::new;

private static final Supplier<EntityCreator> NO_CREATOR_SUPPLY = NoEntityCreator::new;


public enum Writer {
NONE,
JSON,
ADAMPRO,
COTTONTAIL,
INMEMORY
}

public enum Selector {
NONE,
JSON,
ADAMPRO,
ADAMPROSTREAM,
COTTONTAIL,
INMEMORY
}

private ADAMproWrapper adaMproWrapper = null;

private synchronized void ensureAdamProWrapper() {
if (this.adaMproWrapper == null) {
this.adaMproWrapper = new ADAMproWrapper(this);
}
}

private CottontailWrapper cottontailWrapper = null;

private synchronized void ensureCottontailWrapper() {
if (this.cottontailWrapper == null) {
this.cottontailWrapper = new CottontailWrapper(this, true);
}
}

@JsonCreator
public DatabaseConfig() {

}

@JsonProperty
Expand All @@ -105,7 +48,6 @@ public void setHost(String host) {
public int getPort() {
return this.port;
}

public void setPort(int port) {
if (port < 1 || port > 65535) {
throw new IllegalArgumentException(port + " is outside of valid port range");
Expand All @@ -124,118 +66,40 @@ public void setPlaintext(boolean plaintext) {

@JsonProperty
public Integer getBatchsize() {
return batchsize;
return this.batchsize;
}

public void setBatchsize(Integer batchsize) {
this.batchsize = batchsize;
}

@JsonProperty
public Writer getWriter() {
public DataSource getWriter() {
return this.writer;
}

public void setWriter(Writer writer) {
public void setWriter(DataSource writer) {
this.writer = writer;
}

@JsonProperty
public Selector getSelector() {
public DataSource getSelector() {
return this.selector;
}

public void setSelector(Selector selector) {
public void setSelector(DataSource selector) {
this.selector = selector;
}

public synchronized PersistencyWriterSupplier getWriterSupplier() {
switch (this.writer) {
case NONE:
return NO_WRITER_SUPPLY;
case ADAMPRO: {
if (SINGLE_CONNECTION) {
ensureAdamProWrapper();
return () -> new ADAMproWriter(this.adaMproWrapper);
}
return () -> new ADAMproWriter(new ADAMproWrapper(this));
}
case JSON: {
return () -> new JsonFileWriter(new File(this.host));
}
case COTTONTAIL: {
if (SINGLE_CONNECTION) {
ensureCottontailWrapper();
return () -> new CottontailWriter(this.cottontailWrapper);
}
return () -> new CottontailWriter(new CottontailWrapper(this, false));
}
case INMEMORY: {
return InMemoryWriter::new;
}
default:
throw new IllegalStateException("No supplier for writer " + this.writer);

}
public PersistencyWriterSupplier getWriterSupplier() {
return this.writer.getWriterSupplier(this);
}

public synchronized DBSelectorSupplier getSelectorSupplier() {
switch (this.selector) {
case ADAMPRO: {
if (SINGLE_CONNECTION) {
ensureAdamProWrapper();
return () -> new ADAMproSelector(this.adaMproWrapper);
}
return () -> new ADAMproSelector(new ADAMproWrapper(this));
}
case ADAMPROSTREAM: {
if (SINGLE_CONNECTION) {
ensureAdamProWrapper();
return () -> new ADAMproStreamingSelector(this.adaMproWrapper);
}
return () -> new ADAMproStreamingSelector(new ADAMproWrapper(this));
}
case JSON: {
return () -> new JsonSelector(new File(this.host));
}
case NONE:
return NO_SELECTOR_SUPPLY;
case COTTONTAIL: {
if (SINGLE_CONNECTION) {
ensureCottontailWrapper();
return () -> new CottontailSelector(this.cottontailWrapper);
}
return () -> new CottontailSelector(new CottontailWrapper(this, false));
}
default:
throw new IllegalStateException("No supplier for selector " + this.selector);

}
public Supplier<EntityCreator> getEntityCreatorSupplier() {
return this.writer.getEntityCreatorSupplier(this);
}

public synchronized Supplier<EntityCreator> getEntityCreatorSupplier() {
switch (this.selector) {
case ADAMPRO:
case ADAMPROSTREAM: {
if (SINGLE_CONNECTION) {
ensureAdamProWrapper();
return () -> new ADAMproEntityCreator(this.adaMproWrapper);
}
return () -> new ADAMproEntityCreator(new ADAMproWrapper(this));
}
case NONE:
return NO_CREATOR_SUPPLY;
case COTTONTAIL: {
if (SINGLE_CONNECTION) {
ensureCottontailWrapper();
return () -> new CottontailEntityCreator(this.cottontailWrapper);
}
return () -> new CottontailEntityCreator(new CottontailWrapper(this, false));
}
case INMEMORY:
return InMemoryEntityCreator::new;
default:
throw new IllegalStateException("No supplier for EntityCreator " + this.selector);
}
public DBSelectorSupplier getSelectorSupplier() {
return this.writer.getSelectorSupplier(this);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import java.util.stream.Collectors;
import org.apache.commons.lang3.tuple.Triple;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.vitrivr.cineast.core.config.ReadableQueryConfig;
import org.vitrivr.cineast.core.data.distance.DistanceElement;
import org.vitrivr.cineast.core.data.providers.primitive.FloatArrayTypeProvider;
Expand All @@ -26,6 +27,8 @@

public interface DBSelector extends Closeable {

Logger LOGGER = LogManager.getLogger();
ppanopticon marked this conversation as resolved.
Show resolved Hide resolved

boolean open(String name);

void close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

import java.util.function.Supplier;

public interface DBSelectorSupplier extends Supplier<DBSelector> {
ppanopticon marked this conversation as resolved.
Show resolved Hide resolved
/**
* This interface describes a {@link Supplier} for {@link DBSelector}s.
*
* <strong>Important:</strong> This class is required because of signature clashes in {@link org.vitrivr.cineast.core.features.abstracts.AbstractFeatureModule} due
* to type erasure!
*/
public interface DBSelectorSupplier extends Supplier<DBSelector>{

}
Loading