It's pretty rare that News index files become corrupted in ways that aren't fixed routinely on the next full Skim pass. As this is written, I haven't heard of a group index file dying (except with the disk it resides on) yet. The item index file is a bit less bulletproof; in particular, some sites report that duplicate key values occasionally creep into their file, causing an RMS error when records with that key value are manipulated. A lot of people would love to know how this happens (and woe betide the bug then), but it's rare enough that it's been difficult to track it down.
However, the world being what it is, bad things do happen occasionally to good files, so News is distributed with these utilities, to allow you to recover as much information as possible. You'll generally find out about a damaged index file pretty quickly, as News will begin to report errors, particularly during Add File and Skim passes, since these actually modify the index files. If you do develop problems with an index file, it's a good idea to shut down all News activity as soon as possible, so as not to compound the problem. The sections of this manual describing NewsShutDown and the logical name News_Stop describe ways to do this. In addition, it's critical that you not perform a Skim pass before you've done whatever rebuilding you plan on, since Skim is designed to clear up discrepancies in the News database, mostly by deleting "orphaned" items, and you can lose valid newsitems if you skim when the index files are scrambled.
If your item index file has become corrupted, you should first use NewItmFile to recover as much of the damaged item index file as possible. NewItmFile will tell you how far it got before it ran into an error. Then, use Rebuild_Item_File to reconstruct item index records for the rest of the items in your database. This process can take quite some time, if you have a large database. If there are particular groups you don't consider worth the effort of rebuilding, you can directly delete the item files in those groups before running Rebuild_Item_File. News stores the item files on News_Device, in a directory with the same path name as the group name, so the item files for the group news.software.anu-news are News_Device:[News.Software.ANU-News]*.Itm;*.
If your group index file is damaged, you should first use NewGrpFile to recover as much of the old file as possible. Then, from within News, re-create all newsgroups which are still missing, either by hand or using a checkgroups message. After this is done, perform a Skim/Newsgroups on any groups you had to re-create, so that the item counts in that group's index record will be accurate. Finally, you'll have to manually reset restricted newsgroups, using the Set Newsgroup/Restrict command. The old membership information is still there, and will be used; you just have to tell News to look for it.
In either case, if you decide that the amount of work involved in recovering parts of the existing database is too great, you're always free to quickly recover what information you can with NewGrpFile or NewItmFile, and then let the next full Skim sort out any remaining inconsistencies, or even to write off your entire current database and start fresh.
In order to use NewGrpFile, you must have SysLck privilege, and read and write access to the News_Root directory.
Once the lock is acquired or the request has timed out, NewGrpFile copies the existing News_Root:News.Groups record by record to News_Root:News.Groups_Wrk. The work file is created with an initial size that is 87% of the size of the existing News.Groups, and is contiguous; if this is not possible, a message is printed, and the file is created contiguous-best-try. Its extension size is 6% of the size of the existing News.Groups. If no errors are encountered, the work file is renamed to News.Groups, and the old copy of News.Groups is deleted. Be careful of this -- if NewGrpFile was unable to obtain an exclusive lock on the News resource, another process may still have the old copy of News.Groups open, in which case any changes this process makes will affect only in the now-deleted version of this file, and will not be reflected in the new version.
If any errors are encountered, copying stops immediately, and a message is printed which notes the RMS status code for the error. The work file is not renamed, and the original News.Groups is left unchanged.
$ Run [News_Dist]NewGrpFile Unable to aquire Exclusive Access to the News System: operation canceled Continuing . . . NEWSGROUP INDEX (#0) bionet.molbio.genbank.updates (#6) control (#7) junk (#3) univ.announce (#28) wombat.announce (#10) wombat.genbank.updates (#11) wombat.misc (#9) wombat.old_sys_welcome (#8) End of file reached, 9 records read, 9 records written Renaming newly created NEWS_ROOT:NEWS.GROUPS_WRK to NEWS.GROUPS
If you are unable to recover a portion of the index file using NewItmFile, you may wish to use Rebuild_Item_File, which creates new item index file records from scratch, instead. Beware that running either of these programs may require quite some time (up to many hours), if there are many items in your News database.
In order to use NewItmFile, you must have SysLck privilege, and read and write access to the News_Root directory.
Once the lock is acquired or the request has timed out, NewItmFile copies the existing News_Root:News.Items record by record to News_Root:News.Items_Wrk. The work file is created with an initial size that is 75% of the size of the existing News.Items, and is contiguous; if this is not possible, a message is printed, and the file is created contiguous-best-try. Its extension size is 12% of the size of the existing News.Items. A status message is issued for each group copied completely, and when processing groups with large numbers of items, a running count is displayed. If no errors are encountered, the work file is renamed to News.Items, and the old copy of News.Items is deleted. Be careful of this - if NewItmFile was unable to obtain an exclusive lock on the News resource, another process may still have the old copy of News.Items open, in which case any changes this process makes will affect only the now-deleted version of this file, and will not be reflected in the new version.
If any errors are encountered, copying stops immediately, and a message is printed which notes the RMS status code for the error. The work file is not renamed, and the original News.Items is left unchanged.
$ Run [News_Dist]NewItmFile Unable to aquire Exclusive Access to the News System: operation canceled Continuing . . . Newsgroup: junk, Count: 1 Newsgroup: control, Count: 1 Newsgroup: wombat.old_sys_welcome, Count: 1 Newsgroup: wombat.misc, Count: 4 Newsgroup: wombat.announce, Count: 1 Newsgroup: wombat.genbank.updates, Count: 1344 End of file reached, 1375 records read, 1375 records written Renaming newly created NEWS_ROOT:NEWS.ITEMS_WRK to NEWS.ITEMS
If your item index file has been damaged, and you're considering rebuilding it, keep these facts in mind:
Since you wouldn't be running Rebuild_Item_File if there weren't a problem with the index files, you'll want to keep the other News images from running until the item index file is rebuilt. This can be done via the News_Stop logical name, or by running Rebuild_Item_File under NewsShutDown. Both of these approaches are described in more detail in previous sections of this manual.
$ Set Default [News_Build] $ CC [-.News_Src]Rebuild_Item_File.C $ Link/Exec=[-.News_Dist] Rebuild_Item_File.Obj, - NewsMsg.Obj, [-.News_Src]Options_C_Link.Opt/Option $ Delete Rebuild_Item_File.Obj;
You may keep this image in any convenient location (e.g. News_Manager).
indexfile -- The file specification of the item index file. If this parameter is omitted, it defaults to News_Root:News.Items.
itmfil_pattern -- A wildcard file specification which matches all item text files you want Rebuild_Item_File to process. If this parameter is omitted, it defaults to News_Device:[000000...]*.Itm;* (i.e. all the item text files in the local News database).
Once the index files are open, Rebuild_Item_File begins processing files which match itmfil_pattern. For each file, it first checks that the directory in which the file is found matches the name of a newsgroup in the group index file. If so, it then looks for that item's entry in indexfile, and, if it finds the entry, does nothing. If there is no index entry, it build a new record as follows:
Rebuild_Item_File displays a running count of item files processed, and when it is done, displays a message showing the total number of items processed.
$ Rebuild_Item_File News_Manager:Local.Items - News_Device:[Local.Test]*.Itm;* Scanning Item files: news_device:[local.test]*.itm;*: Added 50 news articles.
previous: 7.2.2.4 Example
next: 7.4 Miscellaneous maintenance utilities
Table of Contents