Skip to content

Commit

Permalink
Merge branch 'metastore-impl' into metastore-tests
Browse files Browse the repository at this point in the history
# Conflicts:
#	server/src/main/java/io/unitycatalog/server/persist/MetastoreRepository.java
  • Loading branch information
vikrantpuppala committed Oct 8, 2024
2 parents 5f0a001 + 3ea48ae commit c064e33
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,7 @@
import io.vertx.core.Verticle;
import io.vertx.core.Vertx;
import java.nio.file.Path;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.DefaultParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.*;
import org.apache.logging.log4j.core.config.Configurator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public class MetastoreRepository {
private static final MetastoreRepository INSTANCE = new MetastoreRepository();
private static final Logger LOGGER = LoggerFactory.getLogger(MetastoreRepository.class);
private static final SessionFactory SESSION_FACTORY = HibernateUtils.getSessionFactory();
private static MetastoreDAO CACHED_METASTORE_DAO = null;

private MetastoreRepository() {}

Expand All @@ -29,16 +28,12 @@ public static MetastoreRepository getInstance() {
}

public GetMetastoreSummaryResponse getMetastoreSummary() {
if (CACHED_METASTORE_DAO != null) {
return CACHED_METASTORE_DAO.toGetMetastoreSummaryResponse();
}
try (Session session = SESSION_FACTORY.openSession()) {
session.setDefaultReadOnly(true);
MetastoreDAO metastoreDAO = getMetastoreDAO(session);
if (metastoreDAO == null) {
throw new BaseException(ErrorCode.NOT_FOUND, "No metastore found!");
}
CACHED_METASTORE_DAO = metastoreDAO;
return metastoreDAO.toGetMetastoreSummaryResponse();
}
}
Expand Down Expand Up @@ -69,7 +64,6 @@ public MetastoreDAO initMetastoreIfNeeded() {
tx.commit();
}
LOGGER.info("Server initialized with metastore id: {}", metastoreDAO.getId());
CACHED_METASTORE_DAO = metastoreDAO;
return metastoreDAO;
} catch (Exception e) {
tx.rollback();
Expand Down

0 comments on commit c064e33

Please sign in to comment.