Question
· Jun 21, 2018

Installation Manifest - I can disabled the journal globals by the XML?

I'm creating a new namespace by the installation manifest XML and in the "database" tag configuration I don't see attribute to configure if I what jounal globals or not to this database.

In the database wizard of the "portal administration", have this option.

Regards,

Lucas Boeing Scarduelli

Discussion (8)2
Log in or sign up to continue

You can call code from %Installer via Invoke tag (more on that).

To change journaling programmatically execute:

/// Change database journaling state.
/// dbDir - database Directory (can be passed relative to the current working dir)
/// journal - 1 or 0. 1 enables journaling, 0 disables it.
/// zw ##class(util.Test).JournalDB("USER", 1)
ClassMethod JournalDB(dbDir As %String, journal As %Boolean = {$$$YES}) As %Status
{
    quit:((journal<0) || (journal>3)) $$$ERROR($$$GeneralError, "Invalid journal value. 0 or 2 for No, 1 or 3 for Yes")
    set:journal=$$$YES journal=3
    set:journal=$$$NO journal=2

    new $namespace
    set $namespace = "%SYS"
    set db=##Class(SYS.Database).%OpenId(dbDir)
    set db.GlobalJournalState = journal
    quit db.%Save()
}

That said, any particular reason you want unjournaled databases?

Thank you for helping Eduard Lebedyuk.
Lucas Scarduelli and I followed that idea. Just by contributing, we developed the following method:

ClassMethod disableJournaling(databaseDir As %String = "")
{
    #dim database As SYS.Database = ""
    #dim error As %RegisteredObject = ""
    #dim currentNamespace As %String = $namespace
    
    try {
        znspace "%SYS"
        
        set database = ##class(SYS.Database).%OpenId(databaseDir)
        do database.DisableJournaling()
        $$$ThrowOnError(database.%Save())
        
        znspace currentNamespace
    } catch error {
        znspace currentNamespace
        do error.Log()
    }    
}