public void Merge_data(Xow_wiki wiki, Io_url src_url, int idx_cur) { long all_time_bgn = gplx.core.envs.System_.Ticks(); wiki.Init_by_wiki(); Db_conn src_conn = Db_conn_bldr.Instance.Get_or_autocreate(false, src_url); ctx.Init(wiki, src_conn); // merge data int hash_len = wkr_hash.Len(); for (int i = 0; i < hash_len; ++i) { if (prog_wkr.Canceled()) break; Merge2_wkr wkr = (Merge2_wkr) wkr_hash.Get_at(i); // if (prog_wkr.Checkpoint__skip_wkr(src_url, wkr.Tbl_name())) continue; long wkr_time_bgn = gplx.core.envs.System_.Ticks(); wkr.Merge_data(ctx, prog_wkr); Gfo_log_.Instance.Info( "merge.wkr.done", "data", src_url.NameAndExt() + "|" + wkr.Tbl().Tbl_name() + "|" + gplx.core.envs.System_.Ticks__elapsed_in_frac(wkr_time_bgn)); } if (ctx.Heap__copy_to_wiki()) ctx.Heap__increment_nxt(); Gfo_log_.Instance.Info( "merge.wkr.done", "data", src_url.NameAndExt() + "|-1|" + gplx.core.envs.System_.Ticks__elapsed_in_frac(all_time_bgn)); src_conn.Rls_conn(); // NOTE: must close conn else pack_conn will stay open }
@Override protected void Fill_stmt(Db_stmt stmt, int bgn, int end) { for (int i = bgn; i < end; i++) { Xowd_page_itm page = (Xowd_page_itm) hash.Get_at(i); stmt.Crt_int(page_tbl.Fld_page_ns(), page.Ns_id()); stmt.Crt_bry_as_str(page_tbl.Fld_page_title(), page.Ttl_page_db()); } }
@Override protected Xowd_page_itm Get_page_or_null(Xowd_page_itm rdr_page) { Xow_ns ns = ns_mgr.Ids_get_or_null(rdr_page.Ns_id()); if (ns == null) return null; // NOTE: ns seems to "randomly" be null when threading during redlinks; guard // against null; DATE:2014-01-03 byte[] ttl_wo_ns = rdr_page.Ttl_page_db(); rdr_page.Ttl_(ns, ttl_wo_ns); return (Xowd_page_itm) hash.Get_by(rdr_page.Ttl_full_db()); }
private static Ordered_hash Make_wkrs(Merge2_wkr... wkrs) { Ordered_hash rv = Ordered_hash_.New(); for (Merge2_wkr wkr : wkrs) rv.Add(wkr.Tbl().Tbl_name(), wkr); return rv; }