Skip to content

Commit 1df1de6

Browse files
committed
Enable postgres image variant injection
1 parent 329e27e commit 1df1de6

3 files changed

Lines changed: 20 additions & 3 deletions

File tree

src/main/java/org/polypheny/simpleclient/executor/PolyphenyDbExecutor.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,18 @@ default String deployMonetDb( boolean deployStoresUsingDocker ) throws ExecutorE
122122

123123

124124
default String deployPostgres( boolean deployStoresUsingDocker ) throws ExecutorException {
125+
return deployPostgres( deployStoresUsingDocker, "pgvector & PostGIS" );
126+
}
127+
128+
129+
default String deployPostgres( boolean deployStoresUsingDocker, String imageVariant ) throws ExecutorException {
125130
String config;
126131
String name;
127132
if ( deployStoresUsingDocker ) {
128133
name = "postgres" + storeCounter.getAndIncrement();
129134
if ( PolyphenyVersionSwitch.getInstance().useNewAdapterDeployParameters ) {
130135
int dockerInstanceId = getDockerInstanceId();
131-
config = "{\"mode\":\"docker\",\"instanceId\":\"" + dockerInstanceId + "\",\"maxConnections\":\"25\"}";
136+
config = "{\"mode\":\"docker\",\"instanceId\":\"" + dockerInstanceId + "\",\"maxConnections\":\"25\",\"imageVariant\":\"" + imageVariant + "\"}";
132137
} else {
133138
config = "{\"port\":\"" + nextPort.getAndIncrement() + "\",\"maxConnections\":\"25\",\"password\":\"postgres\",\"mode\":\"docker\",\"instanceId\":\"0\"}";
134139
}
@@ -345,7 +350,7 @@ public PolyphenyDbInstance( PolyphenyControlConnector polyphenyControlConnector,
345350
if ( !config.deployStoresUsingDocker ) {
346351
PostgresInstance.reset();
347352
}
348-
executor.deployPostgres( config.deployStoresUsingDocker );
353+
executor.deployPostgres( config.deployStoresUsingDocker, config.postgresImageVariant );
349354
break;
350355
case "monetdb":
351356
if ( !config.deployStoresUsingDocker ) {

src/main/java/org/polypheny/simpleclient/scenario/AbstractConfig.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ public abstract class AbstractConfig {
7070
public final boolean workloadMonitoringWarmup;
7171

7272
public final int progressReportBase = 100;
73+
public final String postgresImageVariant;
7374

7475

7576
protected AbstractConfig( String scenario, String system, Properties properties ) {
@@ -103,6 +104,7 @@ protected AbstractConfig( String scenario, String system, Properties properties
103104
workloadMonitoringExecutingWorkload = false;
104105
workloadMonitoringLoadingData = true;
105106
workloadMonitoringWarmup = true;
107+
postgresImageVariant = getStringPropertyOrDefault( properties, "postgresImageVariant", "pgvector & PostGIS" );
106108

107109
// This is hacky but ensures that VersionSwitch is initialized when running tasks from CLI.
108110
PolyphenyVersionSwitch.initialize( this );
@@ -150,6 +152,7 @@ protected AbstractConfig( String scenario, String system, Map<String, String> cd
150152
workloadMonitoringExecutingWorkload = Boolean.parseBoolean( cdlGetOrDefault( cdl, "workloadMonitoring", "false" ) );
151153
workloadMonitoringLoadingData = Boolean.parseBoolean( cdlGetOrDefault( cdl, "workloadMonitoringLoadingData", "false" ) );
152154
workloadMonitoringWarmup = Boolean.parseBoolean( cdlGetOrDefault( cdl, "workloadMonitoringWarmup", "true" ) );
155+
postgresImageVariant = cdlGetOrDefault( cdl, "postgresImageVariant", "pgvector & PostGIS" );
153156
}
154157

155158

@@ -171,6 +174,12 @@ protected String getStringProperty( Properties properties, String name ) {
171174
}
172175

173176

177+
protected String getStringPropertyOrDefault( Properties properties, String name, String defaultName ) {
178+
String str = getProperty( properties, name );
179+
return str == null ? defaultName : str;
180+
}
181+
182+
174183
protected int getIntProperty( Properties properties, String name ) {
175184
String str = getProperty( properties, name );
176185
if ( str == null ) {

src/main/resources/org/polypheny/simpleclient/scenario/vectorbench/vector.properties

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@ mode = polypheny
66
dataStoreFeature = postgresql
77
dataStoreMeta = hsqldb
88

9+
# Default, pgvector, PostGIS, pgvector & PostGIS
10+
postgresImageVariant = Default
11+
912
# False -> Does not create index
10-
useIndex = true
13+
useIndex = false
1114

1215
# Query-time index parameters (direct-postgres path only, ignored on the Polypheny path).
1316
# ---------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)