A db can be damaged by: hardware crashes, OS crashes, Jd bugs, application bugs...
A db is marked as damaged to prevent further use to avoid: appearing OK (when it isn't), strange errors, further damage (obscuring the original problem), wrong answers, ...
A db is marked as damaged when:
- Jd detects a serious problem - e.g., access a col with a bad count
- jd'validate' finds a problem
- jddamage_jd_'reason' is run to mark as damaged
jd'info validate' NB. complete report jd'info validatebad' NB. problem report jd'validate' NB. mark db as damaged if problem report not empty
A hardware crash mid insert can leave cols with bad counts. Accessing the db again and only using cols with good counts will work. But when you access a col with a bad count, the db will be marked as damaged.
After a crash (or any event that makes you nervous), always run jd'validate' to be sure there are no issues that will bite you down the road.
See tutorial log.
Jd can work with a damaged db if jdrepair has marked the db as under repair. In some cases this can facilitate determining the damage and effecting a repair.
The repair tool can fix some problems.
If you have a damaged db, try the following:
jdadmin ... |db damaged and not under repair: assert |... jd'info validatebad' |db damaged and not under repair: assert |... jdrepair_jd_ 'fixing it now' jd'info validatebad' NB. problems ... repair_jd_'' NB. fix col counts - mark refs as dirty jd'info validatebad' NB. are problems fixed?