Changes In Branch v1.63-configdbsync Through [f1e2f0433e] Excluding Merge-Ins
This is equivalent to a diff from 65358a4d53 to f1e2f0433e
2017-01-10
| ||
12:06 | merged with latest v1.63, fixed merge conflicts with db.scm check-in: 0764f1e0bc user: srehman tags: v1.63-configdbsync | |
11:50 | preparing for merge check-in: f1e2f0433e user: srehman tags: v1.63-configdbsync | |
00:45 | merged in solid fixes for server stability problems check-in: ebafbfa4a1 user: bjbarcla tags: v1.63 | |
2017-01-09
| ||
17:17 | added sqlite3 switch back check-in: 4b9956034c user: srehman tags: v1.63-configdbsync | |
12:04 | updated to latest v1.63, WIP check-in: 8e63364af0 user: srehman tags: v1.63-configdbsync | |
2017-01-05
| ||
15:43 | addressed stach dump in db:get-run-stats check-in: bd4a33953c user: bjbarcla tags: v1.63-stackdumpfix | |
11:03 | added .server verification against running server ; also touching .server periodically and checking its age to detect and recover from potential server crashes check-in: 65358a4d53 user: bjbarcla tags: v1.63 | |
09:51 | Bumped version to v1.6303 check-in: aa5fb6de80 user: mrwellan tags: v1.63, v1.6303 | |
Modified db.scm from [31eac1d5ff] to [03ae1f6f87].
︙ | |||
15 16 17 18 19 20 21 22 23 24 25 26 27 28 | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | + + | ;; dbstruct vector containing all the relevant dbs like main.db, megatest.db, run.db etc (require-extension (srfi 18) extras tcp) ;; RADT => use of require-extension? (use sqlite3 srfi-1 posix regex regex-case srfi-69 csv-xml s11n md5 message-digest base64 format dot-locking z3 typed-records) (import (prefix sqlite3 sqlite3:)) (import (prefix base64 base64:)) ;; RADT => prefix?? (include "/nfs/site/disks/icf_fdk_cw_gwa002/srehman/fossil/dbi/dbi.scm") (import (prefix dbi dbi:)) (declare (unit db)) (declare (uses common)) (declare (uses keys)) (declare (uses ods)) (declare (uses client)) (declare (uses mt)) |
︙ | |||
43 44 45 46 47 48 49 50 51 52 53 54 55 56 | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | + | ;; each db entry is a pair ( db . dbfilepath ) ;; I propose this record evolves into the area record ;; (defstruct dbr:dbstruct (tmpdb #f) (mtdb #f) (refndb #f) (slave-dbs '()) (homehost #f) ;; not used yet (on-homehost #f) ;; not used yet ) ;; goal is to converge on one struct for an area but for now it is too confusing ;; record for keeping state,status and count for doing roll-ups in ;; iterated tests |
︙ | |||
278 279 280 281 282 283 284 285 286 287 288 289 290 291 | 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | (refndb (db:open-megatest-db path: dbpath name: "megatest_ref.db")) (write-access (file-write-access? dbpath))) (if (and dbexists (not write-access)) (set! *db-write-access* #f)) (dbr:dbstruct-mtdb-set! dbstruct mtdb) (dbr:dbstruct-tmpdb-set! dbstruct tmpdb) ;; olddb is already a (cons db path) (dbr:dbstruct-refndb-set! dbstruct refndb) (if (args:get-arg "-server") (if (configf:get-section *configdat* "ext-sync") (let* ((dblist (configf:get-section *configdat* "ext-sync")) (res '()) (cfgdb #f)) (for-each (lambda (dbitem) (let* ((stringsplit (string-split (cadr dbitem))) (dbtype (string->symbol (car stringsplit))) (dbinfo '()) (cred '())) (if (eqv? 'sqlite3 dbtype) ((set! dbinfo (cadr stringsplit)) (set! cfgdb (dbi:open 'sqlite3 (cons (cons 'dbname dbinfo) '()) )) (db:initialize-main-db cfgdb) (db:initialize-run-id-db cfgdb) (set! res (cons (cons cfgdb dbinfo) res)))) (if (eqv? 'pg dbtype) ((for-each (lambda (x) (if (not (eqv? (string->symbol x) dbtype)) (let* ((pair (string-split x ":"))) (if (not (eqv? pair '())) (set! dbinfo (cons (cons (string->symbol (car pair)) (cadr pair)) dbinfo)))))) stringsplit) (set! cfgdb (dbi:open dbtype dbinfo)) (set! res (cons (cons cfgdb (alist-ref 'host dbinfo)) res)) )))) dblist) (dbr:dbstruct-slave-dbs-set! dbstruct res) ))) ;; (mutex-unlock! *rundb-mutex*) (if (and (not dbfexists) write-access) ;; *db-write-access*) ;; did not have a prior db and do have write access (begin (debug:print 0 *default-log-port* "filling db " (db:dbdat-get-path tmpdb) " with data from " (db:dbdat-get-path mtdb)) (db:sync-tables (db:sync-all-tables-list dbstruct) #f mtdb refndb tmpdb)) (debug:print 0 *default-log-port* " db, " (db:dbdat-get-path tmpdb) " already exists, not propogating data from " (db:dbdat-get-path mtdb))) |
︙ | |||
500 501 502 503 504 505 506 | 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 | - + - + - + - + - + - + - + + + + | (if (member fname '("megatest.db" "monitor.db")) "megatest -cleanup-db" "megatest -import-megatest.db;megatest -cleanup-db") "\"\n") (exit) ;; we can not safely continue when a db was corrupted - even if fixed. ) ;; test read/write access to the database |
︙ | |||
547 548 549 550 551 552 553 | 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 | - + - + | (cons todb slave-dbs)) 0) ;; this is the work to be done (cond ((not fromdb) (debug:print 3 *default-log-port* "WARNING: db:sync-tables called with fromdb missing") -1) ((not todb) (debug:print 3 *default-log-port* "WARNING: db:sync-tables called with todb missing") -2) |
︙ | |||
578 579 580 581 582 583 584 | 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 | - + + - - - + + + - - - + + + + - + - - + + + + + + + + + + + + + + + + + - + - - - + + + + + + - + | (num->field (apply vector (map car fields))) (full-sel (conc "SELECT " (string-intersperse (map car fields) ",") " FROM " tablename (if use-last-update ;; apply last-update criteria (conc " " (car last-update) ">=" (cdr last-update)) "") ";")) (full-ins (conc "INSERT OR REPLACE INTO " tablename " ( " (string-intersperse (map car fields) ",") " ) " |
︙ | |||
812 813 814 815 816 817 818 | 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 | - + + | ;; ;; run-ids: '(1 2 3 ...) or #f (for all) ;; (define (db:multi-db-sync dbstruct . options) (if (not (launch:setup)) (debug:print 0 *default-log-port* "ERROR: not able to setup up for megatest.") (let* ((mtdb (dbr:dbstruct-mtdb dbstruct)) |
︙ | |||
864 865 866 867 868 869 870 | 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 | - + | ;; run-ids))) ;; now ensure all newdb data are synced to megatest.db ;; do not use the run-ids list passed in to the function ;; (if (member 'new2old options) (set! data-synced |
︙ | |||
994 995 996 997 998 999 1000 | 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 | - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - - + + - + - + + - + - + | (define (db:initialize-main-db dbdat) (let* ((configdat (car *configinfo*)) ;; tut tut, global warning... (keys (keys:config-get-fields configdat)) (havekeys (> (length keys) 0)) (keystr (keys->keystr keys)) (fieldstr (keys->key/field keys)) |
︙ | |||
1137 1138 1139 1140 1141 1142 1143 | 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 | - - + + - + - - + + - + - - - + + + - - + + - + - + | comment TEXT DEFAULT '', event_time TIMESTAMP DEFAULT (strftime('%s','now')), fail_count INTEGER DEFAULT 0, pass_count INTEGER DEFAULT 0, archived INTEGER DEFAULT 0, -- 0=no, > 1=archive block id where test data can be found last_update INTEGER DEFAULT (strftime('%s','now')), CONSTRAINT testsconstraint UNIQUE (run_id, testname, item_path));") |
︙ |