[This is preliminary documentation and subject to change]

# Edit-While-Running Scenario 4

This scenario illustrates how edit-while-running works under the following conditions:

- MetaBase.XML is newer than the temporary file when the in-memory metabase is written to disk.
- Edit-while-running is enabled.

What you will learn:

- How edit-while-running handles the situation when the in-memory metabase is written to disk and the MetaBase.XML file, which has pending changes, is newer than the temporary file.

Step 1:
Edit the value of C (C=2) in the in-memory metabase.

Step 2:
Using a text editor, open MetaBase.XML, change C (C=1), and then save and close the file.

This step outlines what happens when the in-memory metabase is written to disk at approximately the same time that changes are saved to MetaBase.XML by using a text editor such as Notepad. A race-against-time between the temporary file overwriting MetaBase.XML and MetaBase.XML being saved by Notepad begins.

Note For the purpose of this scenario, the MetaBase.XML file saved by using Notepad is newer (has a later timestamp) than the temporary file that was created when the in-memory metabase was written to disk.

1. When the in-memory metabase is written to disk, IIS creates a temporary file with the contents of the in-memory metabase.
2. The temporary file is copied to the history folder and renamed in the following format, where MajorVersionNumber is the numerical value that is assigned to the HistoryMajorVersionNumber property written within the temporary file:

   MetaBase_MajorVersionNumber_MinorVersionNumber.XML

   The minor version number is reset to zero. In this scenario, the temporary file is renamed to MetaBase_0000000008_0000000000.XML.

3. An instant later, the MetaBase.XML file is saved using Notepad.
4. IIS compares the date and timestamps of the temporary file and MetaBase.XML.

   Note Because the MetaBase.XML file is newer than the temporary file, IIS does not overwrite MetaBase.XML with the temporary file. Instead, an error is sent to the event log.

5. IIS compares the difference between MetaBase.XML and the corresponding history file and sends the changes to the in-memory metabase through the Admin Base Objects.
6. In the history folder, a new file is created, named MetaBase_0000000007_0000000001.XML, that has the contents of the corresponding history file and the changes that were sent to the in-memory metabase.

Note The value that was changed by directly editing the in-memory metabase (C=2) in step 1 was overwritten by the administrator who changed the value (C=1) in MetaBase.XML using Notepad. This is because the last write always wins.

Important Because the last write always wins, you should not run a script that makes API changes to the in-memory metabase and edits MetaBase.XML at the same time.

phrase 1, phrase 2, phrase 3

© 1997-2001 Microsoft Corporation. All rights reserved.