You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ambari.apache.org by Anita Jebaraj <an...@gmail.com> on 2017/05/18 17:57:33 UTC

In-memory Persistence Type

Hello everyone,

             I came across the below piece of code in AmbariServer.java,
Can someone point me to some documentation on In-memory Persistence type or
on what context it would be used. Thanks in advance

  @Transactional
  protected void initDB() throws AmbariException {
    if (configs.getPersistenceType() == PersistenceType.IN_MEMORY ||
dbInitNeeded) {
      LOG.info("Database init needed - creating default data");
      Users users = injector.getInstance(Users.class);

      users.createUser("admin", "admin");
      users.createUser("user", "user");

      MetainfoEntity schemaVersion = new MetainfoEntity();
      schemaVersion.setMetainfoName(Configuration.SERVER_VERSION_KEY);

schemaVersion.setMetainfoValue(VersionUtils.getVersionSubstring(ambariMetaInfo.getServerVersion()));

      metainfoDAO.create(schemaVersion);
    }
  }


Thanks & Regards,
Anita Jebaraj

Re: In-memory Persistence Type

Posted by Jonathan Hurley <jh...@hortonworks.com>.
I believe that this database type is only ever used for unit tests.

> On May 18, 2017, at 1:57 PM, Anita Jebaraj <an...@gmail.com> wrote:
> 
> Hello everyone,
> 
>             I came across the below piece of code in AmbariServer.java,
> Can someone point me to some documentation on In-memory Persistence type or
> on what context it would be used. Thanks in advance
> 
>  @Transactional
>  protected void initDB() throws AmbariException {
>    if (configs.getPersistenceType() == PersistenceType.IN_MEMORY ||
> dbInitNeeded) {
>      LOG.info("Database init needed - creating default data");
>      Users users = injector.getInstance(Users.class);
> 
>      users.createUser("admin", "admin");
>      users.createUser("user", "user");
> 
>      MetainfoEntity schemaVersion = new MetainfoEntity();
>      schemaVersion.setMetainfoName(Configuration.SERVER_VERSION_KEY);
> 
> schemaVersion.setMetainfoValue(VersionUtils.getVersionSubstring(ambariMetaInfo.getServerVersion()));
> 
>      metainfoDAO.create(schemaVersion);
>    }
>  }
> 
> 
> Thanks & Regards,
> Anita Jebaraj