Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Eliminated mentions to the wikitrust_text_cache table.

  • Loading branch information...
commit b6ab2cbfd919ea9df1b48a4afc233a9037d2ca95 1 parent 8558c25
@lucadealfaro lucadealfaro authored
View
2  analysis/eval_online_wiki.ml
@@ -93,7 +93,7 @@ let db = Online_db.create_db !use_exec_api !db_prefix mediawiki_dbh None
(* If requested, we erase all coloring, and we recompute it from scratch. *)
if !delete_all then begin
- db#delete_all true;
+ db#delete_all ();
!Online_log.online_logger#log "\n Cleared the db.\n"
end;
View
124 analysis/online_db.ml
@@ -471,7 +471,7 @@ object(self)
(** [delete_page page_id] deletes all the information related to page_id
in the system. With an option, we can specify whether to delete also
the information in the regular Mediawiki tables. *)
- method delete_page (page_id: int) (delete_also_mediawiki: bool) =
+ method delete_page (page_id: int) = begin
(* First, deletes the information in the db. *)
let s = Printf.sprintf
"DELETE FROM %swikitrust_revision WHERE page_id = %s"
@@ -481,25 +481,16 @@ object(self)
"DELETE FROM %swikitrust_page WHERE page_id = %s"
db_prefix (ml2int page_id) in
ignore(self#db_exec mediawiki_dbh s);
- if delete_also_mediawiki then begin
- let s = Printf.sprintf
- "DELETE FROM %spage WHERE page_id = %s"
- db_prefix (ml2int page_id) in
- ignore(self#db_exec mediawiki_dbh s);
- let s = Printf.sprintf
- "DELETE FROM %srevision WHERE rev_page = %s"
- db_prefix (ml2int page_id) in
- ignore(self#db_exec mediawiki_dbh s)
- end;
- (* Deletes the cached revisions for the page. *)
+ (* in mediawiki API mode, we also control mediawiki tables... *)
+ let s = Printf.sprintf
+ "DELETE FROM %spage WHERE page_id = %s"
+ db_prefix (ml2int page_id) in
+ ignore(self#db_exec mediawiki_dbh s);
+ (* Deletes the cached revisions for the page; we only call
+ 'delete_page' on error, so we really want to delete
+ the text cache as well. *)
self#erase_cached_rev_text page_id true;
- (* Then, deletes the information, if any, in the blob pages and
- in the disk cache. *)
- begin
- match rev_base_path with
- Some b -> Filesystem_store.delete_revision b page_id None
- | None -> ()
- end;
+ (* Then, deletes the information, if any, in the blob pages *)
begin
match colored_base_path with
None -> begin
@@ -518,6 +509,7 @@ object(self)
ignore(Revision_store.delete_all_page_blobs b page_id)
end
end
+ end
(* Chunk methods *)
@@ -1020,7 +1012,7 @@ object(self)
votes are not deleted. This enables the recomputation from
scratch of all reputations and trust. Careful! The
recomputation may take a very long time for large wikis. *)
- method delete_all (really : bool) =
+ method delete_all () =
let add_prefix cmd = Printf.sprintf cmd db_prefix in
match really with
true -> begin
@@ -1030,11 +1022,9 @@ object(self)
ignore (self#db_exec mediawiki_dbh (add_prefix "TRUNCATE TABLE %swikitrust_blob"));
ignore (self#db_exec mediawiki_dbh (add_prefix "TRUNCATE TABLE %swikitrust_user"));
ignore (self#db_exec mediawiki_dbh (add_prefix "TRUNCATE TABLE %swikitrust_queue"));
- ignore (self#db_exec mediawiki_dbh (add_prefix "TRUNCATE TABLE %swikitrust_text_cache"));
ignore (self#db_exec mediawiki_dbh (add_prefix "UPDATE %swikitrust_vote SET processed = FALSE"));
(* Note that we do NOT delete the votes!! *)
- ignore (self#db_exec mediawiki_dbh "COMMIT");
(* We also delete the filesystem storage of signatures and
colored revisions. *)
begin
@@ -1043,7 +1033,7 @@ object(self)
| None -> ()
end
end
- | false -> ignore (self#db_exec mediawiki_dbh "COMMIT")
+ | false -> ()
method init_queue (really : bool) : unit =
let s1 = Printf.sprintf
@@ -1189,94 +1179,6 @@ object(self)
end
end
- (** [delete_page page_id] deletes all the information related to page_id
- in the system. With an option, we can specify whether to delete also
- the information in the regular Mediawiki tables. *)
- method delete_page (page_id: int) (delete_also_mediawiki: bool) = begin
- (* TODO: delete_also_mediawiki isn't truly used; better to get
- rid of it so we can call erase_cached_rev_text. *)
- self#start_transaction;
- (* First, deletes the information in the db. *)
- let s = Printf.sprintf
- "DELETE FROM %swikitrust_revision WHERE page_id = %s"
- db_prefix (ml2int page_id) in
- ignore(self#db_exec mediawiki_dbh s);
- let s = Printf.sprintf
- "DELETE FROM %swikitrust_page WHERE page_id = %s"
- db_prefix (ml2int page_id) in
- ignore(self#db_exec mediawiki_dbh s);
- (* in mediawiki API mode, we also control mediawiki tables... *)
- let s = Printf.sprintf
- "DELETE FROM %spage WHERE page_id = %s"
- db_prefix (ml2int page_id) in
- ignore(self#db_exec mediawiki_dbh s);
- (* Deletes the cached revisions for the page; we only call
- 'delete_page' on error, so we really want to delete
- the text cache as well. *)
- self#erase_cached_rev_text page_id true;
- (* Then, deletes the information, if any, in the blob pages *)
- begin
- match colored_base_path with
- None -> begin
- (* The blobs are stored in the db. *)
- (* TODO: this is a hack! It would be much better to
- store also the page_id in the wikitrust_blob table! *)
- let p0 = make_blob_key page_id 0 in
- let p1 = make_blob_key (page_id + 1) 0 in
- let s = Printf.sprintf
- "DELETE FROM %swikitrust_blob WHERE blob_id >= %s and blob_id < %s"
- db_prefix (ml2decimal p0) (ml2decimal p1) in
- ignore(self#db_exec mediawiki_dbh s)
- end
- | Some b -> begin
- (* The blobs are stored in the filesystem. *)
- ignore(Revision_store.delete_all_page_blobs b page_id)
- end
- end;
- self#commit;
- end
-
- (** Deletes all WikiTrust data. (Uncolored) revisions, pages, and
- votes are not deleted. This enables the recomputation from
- scratch of all reputations and trust. Careful! The
- recomputation may take a very long time for large wikis. *)
- method delete_all (really : bool) = begin
- self#start_transaction;
- let add_prefix cmd = Printf.sprintf cmd db_prefix in
- (match really with
- true -> begin
- ignore (self#db_exec mediawiki_dbh (add_prefix "TRUNCATE TABLE %swikitrust_global"));
- ignore (self#db_exec mediawiki_dbh (add_prefix "TRUNCATE TABLE %swikitrust_page"));
- ignore (self#db_exec mediawiki_dbh (add_prefix "TRUNCATE TABLE %swikitrust_revision"));
- ignore (self#db_exec mediawiki_dbh (add_prefix "TRUNCATE TABLE %swikitrust_blob"));
- ignore (self#db_exec mediawiki_dbh (add_prefix "TRUNCATE TABLE %swikitrust_user"));
- ignore (self#db_exec mediawiki_dbh (add_prefix "TRUNCATE TABLE %swikitrust_queue"));
- (* Note that we do NOT delete the votes!! *)
- ignore (self#db_exec mediawiki_dbh (add_prefix "UPDATE %swikitrust_vote SET processed = FALSE"));
-
- (* We also delete the filesystem storage of signatures and
- colored revisions. *)
- begin
- match colored_base_path with
- Some b -> ignore (Revision_store.delete_all b)
- | None -> ()
- end;
- (* And don't forget the revision cache. *)
- if not keep_text_cache then begin
- match rev_base_path with
- Some b -> ignore (Filesystem_store.delete_all b)
- | None -> begin
- ignore (self#db_exec mediawiki_dbh (add_prefix "TRUNCATE TABLE %stext"));
- ignore (self#db_exec mediawiki_dbh (add_prefix "TRUNCATE TABLE %srevision"));
- ignore (self#db_exec mediawiki_dbh (add_prefix "TRUNCATE TABLE %spage"));
- end
- end;
- end
- | false -> ()
- );
- self#commit;
- end
-
end (* class db_mediawiki_api *)
View
11 analysis/online_db.mli
@@ -219,10 +219,11 @@ class db :
in the MediaWiki tables *)
method get_mwpage_id : string -> int list
- (** [delete_page page_id delete_also_mediawiki] deletes all the information related to [page_id]
- in the system. If [delete_also_mediawiki] is true, deletes also the info on the page
- in the normal Mediawiki tables. *)
- method delete_page : int -> bool -> unit
+ (** [delete_page page_id delete_also_mediawiki] deletes all the
+ information related to [page_id] in the system. If
+ [delete_also_mediawiki] is true, deletes also the info on the
+ page in the normal Mediawiki tables. *)
+ method delete_page : int -> unit
(* Chunk methods *)
@@ -411,7 +412,7 @@ class db :
(** Totally clear out the db structure -- THIS IS INTENDED ONLY FOR UNIT
TESTING *)
- method delete_all : bool -> unit
+ method delete_all : unit -> unit
(* removed old items from the q. *)
method init_queue : bool -> unit
View
13 includes/TrustUpdateScripts.inc
@@ -97,18 +97,6 @@ CREATE INDEX " . $wgDBprefix . "wikitrust_queue_idx ON "
. $wgDBprefix . "wikitrust_queue (processed, requested_on)
");
-$create_scripts[$wgDBprefix.'wikitrust_text_cache'] = array("
-CREATE TABLE ".$wgDBprefix."wikitrust_text_cache (
- revision_id int PRIMARY KEY,
- page_id int,
- time_string binary(14),
- revision_text longtext NOT NULL
-) ENGINE=InnoDB","
-GRANT ALL ON ".$wgDBprefix."wikitrust_text_cache TO '$wgDBuser'", "
-CREATE INDEX " . $wgDBprefix . "wikitrust_text_cache ON "
- . $wgDBprefix . "wikitrust_text_cache (revision_id, time_string, page_id)
-");
-
$remove_scripts[$wgDBprefix.'wikitrust_vote'] = array("DROP TABLE ".$wgDBprefix."wikitrust_vote");
$remove_scripts[$wgDBprefix.'wikitrust_global'] = array("DROP TABLE ".$wgDBprefix."wikitrust_global");
$remove_scripts[$wgDBprefix.'wikitrust_page'] = array("DROP TABLE ".$wgDBprefix."wikitrust_page");
@@ -116,6 +104,5 @@ $remove_scripts[$wgDBprefix.'wikitrust_revision'] = array("DROP TABLE ".$wgDBpre
$remove_scripts[$wgDBprefix.'wikitrust_blob'] = array("DROP TABLE ".$wgDBprefix."wikitrust_blob");
$remove_scripts[$wgDBprefix.'wikitrust_user'] = array("DROP TABLE ".$wgDBprefix."wikitrust_user");
$remove_scripts[$wgDBprefix.'wikitrust_queue'] = array("DROP TABLE ".$wgDBprefix."wikitrust_queue");
-$remove_scripts[$wgDBprefix.'wikitrust_text_cache'] = array("DROP TABLE ".$wgDBprefix."wikitrust_text_cache");
?>
View
8 remote/analysis/server_coloring_dispatcher.ml
@@ -46,7 +46,8 @@ POSSIBILITY OF SUCH DAMAGE.
Edits:
* Insert the page in the wikitrust_queue table.
- * Optionally, add the text to the wikitrust_text_cache table.
+ * Optionally, add the text to the text cache (in the revision and text
+ tables).
Missing coloring:
* Insert the page in the wikiturst_queue table.
@@ -234,8 +235,7 @@ let process_page (page_id: int) (page_title: string) =
let got_it = child_db#get_page_lock page_id Online_command_line.lock_timeout in
if got_it then begin
try
- child_db#delete_page page_id true;
- child_db#commit;
+ child_db#delete_page page_id;
child_db#release_page_lock page_id
with e -> begin
child_db#release_page_lock page_id;
@@ -306,7 +306,7 @@ let main_loop () =
let db = create_db mediawiki_dbh global_dbh in
begin
db#init_queue true;
- if !delete_all then db#delete_all true;
+ if !delete_all then db#delete_all ();
while true do
if (Hashtbl.length working_children) >= !max_concurrent_procs then begin
(* Cleans up terminated children, if any *)
View
2  remote/analysis/wikipedia_api.ml
@@ -489,7 +489,7 @@ let store_wiki_revs (db: Online_db.db) (wiki_page: wiki_page_t) (wiki_revs: wik
if got_it = false then
raise (API_error "store_wiki_revs: DB lock failed");
try
- db#delete_page page_id true;
+ db#delete_page page_id;
db#release_page_lock page_id
with e -> begin
db#release_page_lock page_id;
View
17 sql/wikitrust.sql
@@ -1015,23 +1015,6 @@ CREATE TABLE `wikitrust_revision` (
SET character_set_client = @saved_cs_client;
--
--- Table structure for table `wikitrust_text_cache`
---
-
-DROP TABLE IF EXISTS `wikitrust_text_cache`;
-SET @saved_cs_client = @@character_set_client;
-SET character_set_client = utf8;
-CREATE TABLE `wikitrust_text_cache` (
- `revision_id` int(11) NOT NULL,
- `page_id` int(11) default NULL,
- `time_string` binary(14) default NULL,
- `revision_text` longtext NOT NULL,
- PRIMARY KEY (`revision_id`),
- KEY `wikitrust_text_cache` (`revision_id`,`time_string`,`page_id`)
-) ENGINE=InnoDB DEFAULT CHARSET=binary;
-SET character_set_client = @saved_cs_client;
-
---
-- Table structure for table `wikitrust_user`
--
View
1  sql/wikitrust_remove.sql
@@ -48,7 +48,6 @@ DROP TABLE `wikitrust_global` ;
DROP TABLE `wikitrust_page` ;
DROP TABLE `wikitrust_queue` ;
DROP TABLE `wikitrust_revision` ;
-DROP TABLE `wikitrust_text_cache` ;
DROP TABLE `wikitrust_user` ;
DROP TABLE `wikitrust_vote` ;
DROP TABLE `wikitrust_running_wikis` ;
View
1  test-scripts/q2_eval.sql
@@ -4,7 +4,6 @@ DELETE FROM wikitrust_vote;
DELETE FROM wikitrust_revision;
DELETE FROM wikitrust_blob;
DELETE FROM wikitrust_queue;
-DELETE FROM wikitrust_text_cache;
DELETE FROM revision;
DELETE FROM page;
View
1  test-scripts/q_eval.sql
@@ -4,7 +4,6 @@ DELETE FROM wikitrust_vote;
DELETE FROM wikitrust_revision;
DELETE FROM wikitrust_blob;
DELETE FROM wikitrust_queue;
-DELETE FROM wikitrust_text_cache;
DELETE FROM revision;
DELETE FROM page;
View
1  test-scripts/truncate_wikitrust_keep_user.py
@@ -67,7 +67,6 @@ def usage():
curs.execute("delete from "+ini_config.get('db', 'prefix')+"wikitrust_revision")
curs.execute("delete from "+ini_config.get('db', 'prefix')+"wikitrust_blob")
curs.execute("delete from "+ini_config.get('db', 'prefix')+"wikitrust_queue")
-curs.execute("delete from "+ini_config.get('db', 'prefix')+"wikitrust_text_cache")
connection.commit()
View
1  test-scripts/truncate_wikitrust_tables.py
@@ -68,7 +68,6 @@ def usage():
curs.execute("delete from "+ini_config.get('db', 'prefix')+"wikitrust_blob")
curs.execute("delete from "+ini_config.get('db', 'prefix')+"wikitrust_user")
curs.execute("delete from "+ini_config.get('db', 'prefix')+"wikitrust_queue")
-curs.execute("delete from "+ini_config.get('db', 'prefix')+"wikitrust_text_cache")
connection.commit()
Please sign in to comment.
Something went wrong with that request. Please try again.