|
|
1.1 ! root 1: PATH=:$PATH ! 2: export PATH ! 3: x=$1 ! 4: if test $# = 0 ! 5: then ! 6: echo verify rec-cnt ! 7: exit 1 ! 8: fi ! 9: echo 1. loading a btree with $x records ! 10: btcreat junk ! 11: awk '{for(i = 0; i < $1; i++) printf "%8.8d\n", i}' <<! | btran | btbuild junk ! 12: $x ! 13: ! ! 14: echo 1. does btreport think there are $x records ! 15: btreport junk ! 16: echo 2. if btcat doesn\'t agree, it will say so ! 17: btcat junk | awk 'length != 9 || $0+0 != NR-1 {print length, $0+0, NR, "bad"}' ! 18: echo 2. end of load test ! 19: echo ! 20: echo 3. delete all the records ! 21: awk '{for(i = 0; i < $1; i++) printf "%8.8d\n", i}' <<! | btdelete junk ! 22: $x ! 23: ! ! 24: echo 3. btreport should think they are all gone ! 25: btreport junk ! 26: echo 4. btcat should too ! 27: btcat junk | awk '{next}; END {print NR " records"}' ! 28: echo 4. there should be no records left ! 29: echo ! 30: echo 5. now load them back one at a time ! 31: echo $x | awk '{for(i = 0; i < $1; i++) printf "%8.8d\n", i}' | ! 32: btran | tee foo | btadd junk ! 33: echo 5. btreport should think there are $x records ! 34: btreport junk ! 35: echo 6. btcat should think so too ! 36: btcat junk | awk 'length != 9 || $0+0 != NR-1 {print length, $0+0, NR, "bad"} ! 37: END {print NR " records"}' ! 38: echo 6. there should have been no bad records ! 39: echo ! 40: echo 7. now throw every other one away ! 41: awk '{for(i = 0; i < $1; i+=2) printf "%8.8d\n", i}' <<! | btdelete junk ! 42: $x ! 43: ! ! 44: echo 7. btreport should think they are gone ! 45: btreport junk ! 46: echo 8. btcat should too ! 47: btcat junk | awk '{next}; END {print NR " records"}' ! 48: echo 8. there should be half the records left ! 49: echo ! 50: echo 9. now squash the file ! 51: btsquash junk ! 52: echo 9. btreport says ! 53: btreport junk ! 54: echo 10. and can btcat find them all: ! 55: btcat junk | awk 'length != 9 || $0+0 != 2*NR-1 {print length, $0+0, NR, "bad"} ! 56: END {print NR " records"}' ! 57: echo 10. there should be half the records left ! 58: echo ! 59: echo 11. now put the other half back ! 60: echo $x | awk '{for(i = 0; i < $1; i+=2) printf "%8.8d\n", i}' | ! 61: btran | btadd junk ! 62: echo 11. btreport should see $x records ! 63: btreport junk ! 64: echo 12. so should btcat ! 65: btcat junk | awk 'length != 9 || $0+0 != NR-1 {print length, $0+0, NR, "bad"} ! 66: END {print NR " records"}' ! 67: echo 13. and they should all be there after squashing ! 68: btsquash junk ! 69: echo 13. btreport should see $x records ! 70: btreport junk ! 71: echo 14. so should btcat ! 72: btcat junk | awk 'length != 9 || $0+0 != NR-1 {print length, $0+0, NR, "bad"} ! 73: END {print NR " records"}' ! 74: echo and that is all I could think of doing
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.