コード例 #1
0
 private void Init_bldr_bmks() {
   if (!resume_enabled) // clear cfg entries if resume disabled; note that disabled by default;
     // DATE:2014-10-24
     bldr_cfg_tbl.Delete_grp(Cfg_fsdb_make);
   Db_cfg_hash bmk_hash = bldr_cfg_tbl.Select_as_hash(Cfg_fsdb_make);
   String tier_id_str = bmk_hash.Get_by(Cfg_tier_id_bmk).To_str_or(null);
   if (tier_id_str == null) { // bmks not found; new db;
     bldr_conn.Txn_bgn("bldr__fsdb_make__bldr_conn");
     bldr_cfg_tbl.Insert_int(Cfg_fsdb_make, Cfg_tier_id_bmk, tier_id_bmk);
     bldr_cfg_tbl.Insert_int(Cfg_fsdb_make, Cfg_page_id_bmk, page_id_bmk);
     bldr_cfg_tbl.Insert_int(Cfg_fsdb_make, Cfg_lnki_id_bmk, lnki_id_bmk);
     bldr_conn.Txn_end();
     if (tier_id_bmk == -1) tier_id_bmk = 0;
     if (page_id_bmk == -1) page_id_bmk = 0;
     if (lnki_id_bmk == -1) lnki_id_bmk = 0;
   } else {
     if (tier_id_bmk == -1) {
       tier_id_bmk = Int_.parse(tier_id_str);
       usr_dlg.Note_many("", "", "restoring from bmk: tier_id=~{0}", tier_id_bmk);
     }
     if (page_id_bmk == -1) {
       page_id_bmk = bmk_hash.Get_by(Cfg_page_id_bmk).To_int();
       usr_dlg.Note_many("", "", "restoring from bmk: page_id=~{0}", page_id_bmk);
     }
     if (lnki_id_bmk == -1) {
       lnki_id_bmk = bmk_hash.Get_by(Cfg_lnki_id_bmk).To_int();
       usr_dlg.Note_many("", "", "restoring from bmk: lnki_id=~{0}", lnki_id_bmk);
     }
   }
   tier_id_val = tier_id_bmk;
   page_id_val = page_id_bmk;
   lnki_id_val = lnki_id_bmk;
 }
コード例 #2
0
 private void Txn_sav() {
   usr_dlg.Prog_many("", "", "committing data: count=~{0} failed=~{1}", exec_count, exec_fail);
   bldr_cfg_tbl.Update_int(Cfg_fsdb_make, Cfg_page_id_bmk, page_id_val);
   bldr_cfg_tbl.Update_int(Cfg_fsdb_make, Cfg_lnki_id_bmk, lnki_id_val);
   bldr_cfg_tbl.Conn().Txn_sav();
   trg_cfg_mgr.Next_id_commit();
   trg_atr_fil.Conn().Txn_sav();
   if (!trg_atr_fil.Conn().Eq(trg_cfg_mgr.Tbl().Conn())) // need to create txn for v1
   trg_cfg_mgr.Tbl().Conn().Txn_sav();
   if (src_bin_mgr__fsdb_version != null && src_bin_mgr__fsdb_skip_wkrs != null) {
     src_fsdb_wkr.Skip_mgr().Skip_term(src_fsdb_wkr.Mnt_mgr().Mnts__get_main().Cfg_mgr());
   }
   if (!trg_mnt_itm.Db_mgr().File__solo_file()) trg_bin_fil.Conn().Txn_sav();
   if (exit_after_commit) exit_now = true;
 }
コード例 #3
0
 @Override
 public void Cmd_end() {
   usr_dlg.Note_many(
       "",
       "",
       "fsdb_make.done: count=~{0} rate=~{1}",
       exec_count,
       Decimal_adp_.divide_safe_(exec_count, System_.Ticks__elapsed_in_sec(time_bgn))
           .To_str("#,###.000"));
   if (src_fsdb_wkr != null) {
     src_fsdb_wkr.Mnt_mgr()
         .Mnts__get_main()
         .Txn_end(); // NOTE: src_fsdb_wkr will be null if no src db defined
   }
   trg_atr_fil.Conn().Txn_end();
   trg_atr_fil.Conn().Rls_conn();
   if (!trg_atr_fil.Conn().Eq(trg_cfg_mgr.Tbl().Conn())) // need to create txn for v1
   trg_cfg_mgr.Tbl().Conn().Txn_end();
   trg_cfg_mgr.Tbl().Conn().Rls_conn();
   if (!trg_mnt_itm.Db_mgr().File__solo_file()) {
     trg_bin_fil.Conn().Txn_end();
     trg_bin_fil.Conn().Rls_conn();
   }
   if (exec_done) {
     bldr_cfg_tbl.Delete_grp(Cfg_fsdb_make); // delete bmks for future reruns; DATE:2014-08-20
     Io_mgr.Instance.DeleteFil_args(wiki.Fsys_mgr().Root_dir().GenSubFil("xowa.file.make.cfg.gfs"))
         .MissingFails_off()
         .Exec();
   }
   bldr_conn.Rls_conn();
 }
コード例 #4
0
 @Override
 public void Cmd_bgn(Xob_bldr bldr) {
   wiki.Init_assert();
   this.poll_interval = poll_mgr.Poll_interval();
   this.bin_db_mgr = new Xob_bin_db_mgr(ns_ids);
   // src_bin_mgr
   if (src_bin_mgr__fsdb_version != null) {
     this.src_fsdb_wkr = Xof_bin_wkr__fsdb_sql.new_(wiki.File__mnt_mgr());
     src_bin_mgr.Wkrs__add(src_fsdb_wkr);
     src_fsdb_wkr.Mnt_mgr().Ctor_by_load(new_src_bin_db_mgr(wiki, src_bin_mgr__fsdb_version));
     src_fsdb_wkr.Mnt_mgr()
         .Mnts__get_main()
         .Txn_bgn(); // NOTE: txn on atr speeds up from 50 -> 300; DATE:2015-03-21
     if (src_bin_mgr__fsdb_skip_wkrs != null) {
       src_fsdb_wkr.Skip_mgr_init(
           src_fsdb_wkr.Mnt_mgr().Mnts__get_main().Cfg_mgr(), src_bin_mgr__fsdb_skip_wkrs);
     }
     if (src_bin_mgr__cache_enabled) {
       usr_dlg.Prog_many("", "", "src_bin_mgr.cache.bgn");
       src_fsdb_wkr.Mnt_mgr().Mnts__get_main().Atr_mgr().Db__core().Fil_cache_enabled_y_();
       usr_dlg.Prog_many("", "", "src_bin_mgr.cache.end");
     }
   }
   if (src_bin_mgr__wmf_enabled) {
     Xof_bin_wkr__http_wmf wmf_wkr = Xof_bin_wkr__http_wmf.new_(wiki);
     src_bin_mgr.Wkrs__add(wmf_wkr);
     wmf_wkr.Fail_timeout_(
         0); // 1000; NOTE: set Fail_timeout here; DATE:2014-06-21; NOTE: do not put in ctor, or
     // else will be 1st wkr; DATE:2014-06-28
   }
   // trg_mnt_itm
   this.trg_bin_db_max = app.Api_root().Bldr().Wiki().Import().File_db_max();
   Io_url trg_file_dir_v1 =
       String_.Eq(trg_bin_mgr__fsdb_version, "v1")
           ? wiki.Fsys_mgr().File_dir().GenNewNameOnly(wiki.Domain_str() + "-prv")
           : wiki.Fsys_mgr().File_dir(); // NOTE: convoluted way of setting trg to -prv if
   // trg_bin_mgr__fsdb_version_v1 is set; otherwise set to
   // "en.wikipedia.org" which will noop; DATE:2015-12-02
   Fsdb_db_mgr trg_db_mgr =
       Fsdb_db_mgr_.new_detect(wiki, wiki.Fsys_mgr().Root_dir(), trg_file_dir_v1);
   if (trg_db_mgr == null) trg_db_mgr = Fsdb_db_mgr__v2_bldr.Get_or_make(wiki, Bool_.Y);
   Fsm_mnt_mgr trg_mnt_mgr = new Fsm_mnt_mgr();
   trg_mnt_mgr.Ctor_by_load(trg_db_mgr);
   trg_mnt_mgr.Mnts__get_insert_idx_(
       Fsm_mnt_mgr
           .Mnt_idx_main); // NOTE: do not delete; mnt_mgr default to Mnt_idx_user; DATE:2014-04-25
   this.trg_mnt_itm = trg_mnt_mgr.Mnts__get_insert();
   Fsm_mnt_mgr.Patch(
       trg_mnt_itm.Cfg_mgr()
           .Tbl()); // NOTE: always patch again; fsdb_make may be run separately without lnki_temp;
   // DATE:2014-04-26
   this.trg_atr_fil = trg_mnt_itm.Atr_mgr().Db__core();
   this.trg_cfg_mgr = trg_mnt_itm.Cfg_mgr();
   bin_db_mgr.Init_by_mnt_mgr(trg_mnt_mgr);
   trg_atr_fil.Conn().Txn_bgn("bldr__fsdb_make__trg_atr_fil");
   if (!trg_atr_fil.Conn()
       .Eq(trg_cfg_mgr.Tbl().Conn())) // need to create txn for v1; DATE:2015-07-04
   trg_cfg_mgr.Tbl().Conn().Txn_bgn("bldr__fsdb_make__trg_cfg_fil");
   // bldr_db
   Xob_db_file bldr_db = Xob_db_file.New__file_make(wiki.Fsys_mgr().Root_dir());
   this.bldr_conn = bldr_db.Conn();
   this.bldr_cfg_tbl = bldr_db.Tbl__cfg(); // NOTE: cfg and atr is in same db; use it
   bldr_cfg_tbl.Conn().Txn_bgn("bldr__fsdb_make__bldr_cfg_tbl");
 }