Skip to content

Commit f5f672e

Browse files
authored
fixing an initilization issue when using postgres as docstore (#17)
1 parent da6ea99 commit f5f672e

1 file changed

Lines changed: 1 addition & 11 deletions

File tree

config-service-impl/src/main/java/org/hypertrace/config/service/store/DocumentConfigStore.java

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public class DocumentConfigStore implements ConfigStore {
5555
@Override
5656
public void init(Config config) {
5757
datastore = initDataStore(config);
58-
this.collection = getOrCreateCollection(datastore);
58+
this.collection = this.datastore.getCollection(CONFIGURATIONS_COLLECTION);;
5959
}
6060

6161
private Datastore initDataStore(Config config) {
@@ -65,16 +65,6 @@ private Datastore initDataStore(Config config) {
6565
return DatastoreProvider.getDatastore(dataStoreType, dataStoreConfig);
6666
}
6767

68-
private Collection getOrCreateCollection(Datastore datastore) {
69-
if (!datastore.listCollections().contains(CONFIGURATIONS_COLLECTION)) {
70-
if (!datastore.createCollection(CONFIGURATIONS_COLLECTION, Collections.emptyMap())) {
71-
throw new RuntimeException(
72-
"Failed to create collection:" + CONFIGURATIONS_COLLECTION + " in document store");
73-
}
74-
}
75-
return datastore.getCollection(CONFIGURATIONS_COLLECTION);
76-
}
77-
7868
@Override
7969
public long writeConfig(ConfigResource configResource, String userId, Value config)
8070
throws IOException {

0 commit comments

Comments
 (0)