From 8e8dcd3aa99386578b4002a09696884f61941306 Mon Sep 17 00:00:00 2001 From: Enrico Tassi Date: Fri, 13 May 2005 10:58:40 +0000 Subject: [PATCH] now the extractor manager renames the tables (old tables are renamed to _BACKUP) --- helm/ocaml/metadata/extractor/extractor.ml | 3 +- .../metadata/extractor/extractor_manager.ml | 69 ++++++++++++++++++- 2 files changed, 68 insertions(+), 4 deletions(-) diff --git a/helm/ocaml/metadata/extractor/extractor.ml b/helm/ocaml/metadata/extractor/extractor.ml index c1ade99ea..8511c37d1 100644 --- a/helm/ocaml/metadata/extractor/extractor.ml +++ b/helm/ocaml/metadata/extractor/extractor.ml @@ -68,7 +68,8 @@ let main () = (Unix.getpid ()) !i len perc short; flush stdout; let uri = UriManager.uri_of_string u in - MetadataDb.index_obj ~dbd ~uri) + MetadataDb.index_obj ~dbd ~uri; + CicEnvironment.empty ()) uris; print_string "END "; Unix.system "date" ;; diff --git a/helm/ocaml/metadata/extractor/extractor_manager.ml b/helm/ocaml/metadata/extractor/extractor_manager.ml index 42902d514..dc8fcb7e7 100644 --- a/helm/ocaml/metadata/extractor/extractor_manager.ml +++ b/helm/ocaml/metadata/extractor/extractor_manager.ml @@ -146,7 +146,7 @@ let main () = Helm_registry.load_from "extractor.conf.xml"; Http_getter.init (); print_endline "Updating the getter...."; - Http_getter.update (); + Http_getter.update (); let base = (Helm_registry.get "tmp.dir") ^ "/maps" in let formats i = (Helm_registry.get "tmp.dir") ^ "/"^(string_of_int i)^"/maps" @@ -195,8 +195,71 @@ let main () = wait_a_peon peons done; while is_a_peon_busy peons do wait_a_peon peons done; - print_string "END "; flush stdout; - ignore(Unix.system "date") + print_string "END "; flush stdout; + ignore(Unix.system "date"); + (* and now the rename table stuff *) + let obj_tbl = MetadataTypes.library_obj_tbl in + let sort_tbl = MetadataTypes.library_sort_tbl in + let rel_tbl = MetadataTypes.library_rel_tbl in + let name_tbl = MetadataTypes.library_name_tbl in + let count_tbl = MetadataTypes.library_count_tbl in + let obj_tbl_b = obj_tbl ^ "_BACKUP" in + let sort_tbl_b = sort_tbl ^ "_BACKUP" in + let rel_tbl_b = rel_tbl ^ "_BACKUP" in + let name_tbl_b = name_tbl ^ "_BACKUP" in + let count_tbl_b = count_tbl ^ "_BACKUP" in + let obj_tbl_c = MetadataTypes.obj_tbl () in + let sort_tbl_c = MetadataTypes.sort_tbl () in + let rel_tbl_c = MetadataTypes.rel_tbl () in + let name_tbl_c = MetadataTypes.name_tbl () in + let count_tbl_c = MetadataTypes.count_tbl () in + let stats = + SqlStatements.drop_tables [ + (obj_tbl_b,`RefObj); + (sort_tbl_b,`RefSort); + (rel_tbl_b,`RefRel); + (name_tbl_b,`ObjectName); + (count_tbl_b,`Count) ] @ + SqlStatements.drop_indexes [ + (obj_tbl,`RefObj); + (sort_tbl,`RefSort); + (rel_tbl,`RefRel); + (name_tbl,`ObjectName); + (count_tbl,`Count); + (obj_tbl_c,`RefObj); + (sort_tbl_c,`RefSort); + (rel_tbl_c,`RefRel); + (name_tbl_c,`ObjectName); + (count_tbl_c,`Count) ] @ + SqlStatements.rename_tables [ + (obj_tbl,obj_tbl_b); + (sort_tbl,sort_tbl_b); + (rel_tbl,rel_tbl_b); + (name_tbl,name_tbl_b); + (count_tbl,count_tbl_b) ] @ + SqlStatements.rename_tables [ + (obj_tbl_c,obj_tbl); + (sort_tbl_c,sort_tbl); + (rel_tbl_c,rel_tbl); + (name_tbl_c,name_tbl); + (count_tbl_c,count_tbl) ] @ + SqlStatements.create_indexes [ + (obj_tbl,`RefObj); + (sort_tbl,`RefSort); + (rel_tbl,`RefRel); + (name_tbl,`ObjectName); + (count_tbl,`Count) ] + in + List.iter (fun statement -> + try + ignore (Mysql.exec dbd statement) + with exn -> + let status = Mysql.status dbd in + match status with + | Mysql.StatusError Mysql.Table_exists_error -> () + | Mysql.StatusError _ -> raise exn + | _ -> ()) + stats ;; main () -- 2.39.2