Skip to content

MetastoreRepository

Init Metastore If Needed

MetastoreDAO initMetastoreIfNeeded()

initMetastoreIfNeeded starts a transaction (with a new Session (Hibernate) from the system-wide SessionFactory).

initMetastoreIfNeeded looks up the one and only metastore.

Unless found, initMetastoreIfNeeded creates a new metastore.

initMetastoreIfNeeded prints out the following INFO message to the logs:

No metastore found, initializing a metastore for the server...

initMetastoreIfNeeded creates a MetastoreDAO with a pseudo-randomly generated UUID and persists it.

initMetastoreIfNeeded prints out the following INFO message to the logs:

Server initialized with metastore id: [id]

In case of any exception, initMetastoreIfNeeded prints out the following ERROR message to the logs:

Failed to initialize metastore

initMetastoreIfNeeded is used when:

  • UnityCatalogServer is requested to start

System-Wide MetastoreRepository Instance

MetastoreRepository INSTANCE

MetastoreRepository creates an instance of itself at the class load time.

Final Property

INSTANCE is a Java final property to prevent subclasses from overriding or hiding it.

Learn more in the Java Language Specification.

Static Property

INSTANCE is a Java class property to be invoked without a reference to a particular object.

Learn more in the Java Language Specification.

This MetastoreRepository instance is available using MetastoreRepository.getInstance.

Get Instance

MetastoreRepository getInstance()
Static Method

getInstance is a Java class method to be invoked without a reference to a particular object.

Learn more in the Java Language Specification.

getInstance returns the system-wide MetastoreRepository Instance.


getInstance is used when: