FAQ: Difference between revisions

From MidasWiki
Jump to navigation Jump to search
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 11: Line 11:
=== Stop all front-ends and programs connected to midas ===
=== Stop all front-ends and programs connected to midas ===


[[mlogger]], [[mhttpd]], etc.
Manually kill any lingering frontends and other midas programs ([[mlogger]], [[mhttpd]], etc.).


=== Remove the shared memory associated to your experiment ===
=== Remove the old ODB and create an empty one with the new size ===


Find the shared memory segment by doing
Note this uses odbinit, not odbedit!
ls -l /dev/shm
then use the rm command to delete the segments that are contain your experiment name.


If you have the MIDAS_EXPT_NAME environment variable defined, you can just do:
  odbinit --cleanup -s 100000000
  rm /dev/shm/${MIDAS_EXPT_NAME}_*SHM


=== Move or delete the old .SHM files ===
The -s argument is the new size of the ODB in bytes. The maximum allowed value is 100MB (100000000 bytes).


These will be in the location given by [[Exptab]], e.g. ~/online
The first time you try this, odbinit will probably complain that you're trying to resize the ODB. It will tell you the path to a file called <code>.ODB_SIZE.TXT</code>, and ask you to delete it. Delete that file and run odbinit again.
# Either move some of the files...
 
cd online
  rm /path/to/.ODB_SIZE.TXT
mv .ODB.SHM .ODB.SHM.BAD
  odbinit --cleanup -s 100000000
mv .SYSMSG.SHM .SYSMSG.SHM.BAD
  mv .MSG.SHM .MSG.SHM.BAD
  # .. or just delete all of them
cd online
rm .*SHM*


=== Re-load a saved version of the ODB ===
=== Re-load a saved version of the ODB ===
Line 44: Line 35:
* The dumps are .xml, .odb or .json files.  
* The dumps are .xml, .odb or .json files.  
* Depending on your [[mlogger]] ODB settings ('/Logger/ODB Dump', '/Logger/ODB Dump File', and '/Logger/ODB Last Dump File'), you may have files named based on run numbers or just 'last.json' etc. If using run numbers, you almost certainly want to load the most recent one.
* Depending on your [[mlogger]] ODB settings ('/Logger/ODB Dump', '/Logger/ODB Dump File', and '/Logger/ODB Last Dump File'), you may have files named based on run numbers or just 'last.json' etc. If using run numbers, you almost certainly want to load the most recent one.
* The files are stored in the same location as the midas history data (based on '/Logger/History dir' or '/Logger/Data dir).
* The files are stored in the same location as the midas history data (based on '/Logger/History dir' or '/Logger/Data dir').


Once you have found the correct file, run a command like:
Once you have found the correct file, run a command like:
  odbedit -s 100000000 -c "load online/history/run001234.xml"'
  odbedit -c "load online/history/run001234.xml"'
  or
  or
  odbedit -s 100000000 -c "load online/history/last.json"'
  odbedit -c "load online/history/last.json"'
  etc.
  etc.
The -s argument indicates to recreate an empty ODB with a new size (in bytes). The -c argument specifies the file to use to populate the new ODB.


=== Your ODB should now be fixed ===
=== Your ODB should now be fixed ===


See also [[odbinit]].
Done!


== How to resize the ODB ==
== How to resize the ODB ==
Line 64: Line 53:
The procedure is very similar to how you recover from a corrupted ODB (see above), but you can create a dump of the current ODB structure rather than relying on one that was written previously.
The procedure is very similar to how you recover from a corrupted ODB (see above), but you can create a dump of the current ODB structure rather than relying on one that was written previously.


=== Stop all front-ends and programs connected to midas ===


=== Stop all front-ends and programs connected to midas ===
Either by killing processes manually, or via odbedit:


[[mlogger]], [[mhttpd]], etc.
odbedit -c "shutdown all"


=== Save the current ODB content ===
=== Save the current ODB content ===
Line 73: Line 63:
  odbedit -c "save dump.json"
  odbedit -c "save dump.json"


=== Remove the shared memory associated to your experiment ===
=== Remove the old ODB and create an empty one with the new size ===
 
Find the shared memory segment by doing
ls -l /dev/shm
then use the rm command to delete the segments that are contain your experiment name.


If you have the MIDAS_EXPT_NAME environment variable defined, you can just do:
Note this uses odbinit, not odbedit!
rm /dev/shm/${MIDAS_EXPT_NAME}_*SHM


=== Move or delete the old .SHM files ===
odbinit --cleanup -s 100000000


These will be in the location given by [[Exptab]], e.g. ~/online
The -s argument is the new size of the ODB in bytes. The maximum allowed value is 100MB (100000000 bytes).
# Either move some of the files...
cd online
mv .ODB.SHM .ODB.SHM.BAD
mv .SYSMSG.SHM .SYSMSG.SHM.BAD
mv .MSG.SHM .MSG.SHM.BAD
# .. or just delete all of them
cd online
rm .*SHM*


=== Re-size the ODB and load the saved content ===
The first time you try this, odbinit will probably complain that you're trying to resize the ODB. It will tell you the path to a file called <code>.ODB_SIZE.TXT</code>, and ask you to delete it. Delete that file and run odbinit again.


Re-initialise the ODB with a new size, and load the saved content
rm /path/to/.ODB_SIZE.TXT
odbinit --cleanup -s 100000000


odbedit -s 100000000 -c "load dump.json"'
=== Load the saved ODB content ===


The -s argument indicates to recreate an empty ODB with a new size (in bytes). The -c argument specifies the file to use to populate the new ODB.
odbedit -c "load dump.json"


=== Your ODB should now be re-sized ===
=== Your ODB should now be re-sized ===

Latest revision as of 13:56, 20 June 2023


Frequently Asked Questions

There is a related page of Common Installation Problems.


How to recover from a corrupted ODB

Stop all front-ends and programs connected to midas

Manually kill any lingering frontends and other midas programs (mlogger, mhttpd, etc.).

Remove the old ODB and create an empty one with the new size

Note this uses odbinit, not odbedit!

odbinit --cleanup -s 100000000

The -s argument is the new size of the ODB in bytes. The maximum allowed value is 100MB (100000000 bytes).

The first time you try this, odbinit will probably complain that you're trying to resize the ODB. It will tell you the path to a file called .ODB_SIZE.TXT, and ask you to delete it. Delete that file and run odbinit again.

rm /path/to/.ODB_SIZE.TXT
odbinit --cleanup -s 100000000

Re-load a saved version of the ODB

See save and reload the ODB for more about ODB dumps.

These dumps are typically called something like 'online/history/*.xml'.

To find the correct file:

  • The dumps are .xml, .odb or .json files.
  • Depending on your mlogger ODB settings ('/Logger/ODB Dump', '/Logger/ODB Dump File', and '/Logger/ODB Last Dump File'), you may have files named based on run numbers or just 'last.json' etc. If using run numbers, you almost certainly want to load the most recent one.
  • The files are stored in the same location as the midas history data (based on '/Logger/History dir' or '/Logger/Data dir').

Once you have found the correct file, run a command like:

odbedit -c "load online/history/run001234.xml"'
or
odbedit -c "load online/history/last.json"'
etc.

Your ODB should now be fixed

Done!

How to resize the ODB

If you see messages telling you that the ODB is getting full, you will need to resize it. This cannot be done while any midas programs are running (as the ODB is a binary blob and midas programs store handles/pointers to bits of data at specific offsets within that blob).

The procedure is very similar to how you recover from a corrupted ODB (see above), but you can create a dump of the current ODB structure rather than relying on one that was written previously.

Stop all front-ends and programs connected to midas

Either by killing processes manually, or via odbedit:

odbedit -c "shutdown all"

Save the current ODB content

odbedit -c "save dump.json"

Remove the old ODB and create an empty one with the new size

Note this uses odbinit, not odbedit!

odbinit --cleanup -s 100000000

The -s argument is the new size of the ODB in bytes. The maximum allowed value is 100MB (100000000 bytes).

The first time you try this, odbinit will probably complain that you're trying to resize the ODB. It will tell you the path to a file called .ODB_SIZE.TXT, and ask you to delete it. Delete that file and run odbinit again.

rm /path/to/.ODB_SIZE.TXT
odbinit --cleanup -s 100000000

Load the saved ODB content

odbedit -c "load dump.json"

Your ODB should now be re-sized

Done!

How to get odbedit to show run state

Question: I've seen the ODB prompt displaying the run state, how do you do that?

Answer: Modify the /System/prompt field. The "S" is the trick.

 Fri> odb -e bnmr1 -h isdaq01
 [host:expt:Stopped]/cd /System/
 [host:expt:Stopped]/System>ls
 Clients
 Client Notify                   0
 Prompt                          [%h:%e:%S]%p
 Tmp
 [host:expt:Stopped]/System
 [host:expt:Stopped]/Systemset prompt [%h:%e:%S]%p>
 [host:expt:Stopped]/System>ls
 Clients
 Client Notify                   0
 Prompt                          [%h:%e:%S]%p>
 Tmp
 [host:expt:Stopped]/System>set Prompt [%h:%e:%s]%p>
 [host:expt:S]/System>set Prompt [%h:%e:%S]%p>
 [host:expt:Stopped]/System>     

See also /System ODB tree#Prompt.

Increasing Number of Hot-links

MIDAS, by default, allows you to have a maximum of 256 individual hot-links to be registered. If you find that you need more hot-links than that, follow the procedure below:

  1. Use odbedit to save current ODB
    odbedit
    save current_odb.odb 
    
  2. Stop all the running MIDAS processes, including mlogger and mserver using the web interface. Then stop mhttpd as well. To stop mhttpd just do
    killall mhttpd
    
  3. Remove your old ODB (we will recreate it after modifying MIDAS, using the backup you just made).
    mv .ODB.SHM .ODB.SHM.20161104
    rm /dev/shm/<expname>_ODB_SHM
    

    where <expname> is the name of your experiment.

  4. Make the following modifications to midas. In this particular case I have increased the max number of open records from 256 to 1024. You would need to change the constants if you want to change to other values
    diff --git a/include/midas.h b/include/midas.h
    index 02b30dd..33be7be 100644
    --- a/include/midas.h
    +++ b/include/midas.h
    @@ -254,7 +254,7 @@ typedef std::vector<std::string> STRING_LIST;
    -#define MAX_OPEN_RECORDS       256           /**< number of open DB records   */
    +#define MAX_OPEN_RECORDS       1024           /**< number of open DB records   */
    diff --git a/src/odb.c b/src/odb.c
    index 47ace8f..ac1bef3 100755
    --- a/src/odb.c
    +++ b/src/odb.c
    @@ -699,8 +699,8 @@ static void db_validate_sizes()
    -   assert(sizeof(DATABASE_CLIENT) == 2112);
    -   assert(sizeof(DATABASE_HEADER) == 135232);
    +   assert(sizeof(DATABASE_CLIENT) == 8256);
    +   assert(sizeof(DATABASE_HEADER) == 528448);
    

    The calculation is as follows (in case you want a different number of open records): DATABASE_CLIENT = 64 + 8*MAX_OPEN_ERCORDS = 64 + 8*1024 = 8256 DATABASE_HEADER = 64 + 64*DATABASE_CLIENT = 64 + 64*8256 = 528448

  5. Rebuild MIDAS
    cd $MIDASSYS
    make clean; make
    
  6. Create new ODB
    odbedit -s 1000000
    

    Note, you should change the size of the ODB to whatever you need.

  7. reload your original ODB
    [local:exp:Stopped] load  current_odb.odb
    
  8. Rebuild all your frontend programs (and other user-specific programs) against new MIDAS; they should then work and you should be able to produce more open records.