[Rt-commit] rt branch, 4.2/mysql-native-fts, repushed
Alex Vandiver
alexmv at bestpractical.com
Wed Jul 30 17:36:44 EDT 2014
The branch 4.2/mysql-native-fts was deleted and repushed:
was b490888fd9527edb9c5340ae492251e3ba08a410
now 17850b60d781282fa57fca0b70781db54b5e96a6
1: ff018f3 = 1: ff018f3 Add additional clarification points about Sphinx on MySQL
2: 7d52ea3 = 2: 7d52ea3 Drop sphinx xmlpipe2 output, which was unusable and undocumented
3: 3152f64 = 3: 3152f64 Drop finalize and clean functions, which are now unused
4: fd038d9 = 4: fd038d9 Rename Sphinx FTS search
5: 2374496 = 5: 2374496 Support native FTS on MySQL 5.6 and above
6: bfd8dce = 6: bfd8dce Using a separate MyISAM table, we can also support FTS on MySQL < 5.6
7: a4e5362 = 7: a4e5362 extract_text and extract_html are identical; inline them
8: 2474f53 = 8: 2474f53 Inline the differences between text/plain and text/html attachment lists
9: b276cbe = 9: b276cbe Stop skipping indexing of text/html within multipart/alternative
10: b3bf43a = 10: b3bf43a Use the new, shorterm initialization form
11: 06e22fe = 11: 06e22fe Simplify and condense option parsing
12: 5b8ed2a = 12: 5b8ed2a Documentation has moved out; update --help accordingly
13: b06fef2 = 13: b06fef2 Remove AUTHOR section; it is unnecessary in core sbin files
14: 929539a = 14: 929539a Skipping ACL checks yields a sizable performance increase
15: 434556b = 15: 434556b Index attachments in one pass through the database, not two
16: 1f70512 = 16: 1f70512 Index attachments even on deleted tickets
17: f9c8eae = 17: f9c8eae mysql and pg share the same last_indexed; unify the method
18: b01e737 ! 18: 31fe979 Replace the last use of goto_specific with explicit function calls
@@ -12,7 +12,7 @@
- process( $a, \$text );
+ if ($db_type eq 'mysql') {
+ process_mysql( $a, \$text );
-+ } elsif ($db_type eq 'pg') {
++ } elsif ($db_type eq 'Pg') {
+ process_pg( $a, \$text );
+ }
debug("Processed attachment #". $a->id );
19: c876f7c = 19: 0692e70 Simplify last_indexed
20: 5c56ed6 = 20: 2152feb Only call last_indexed once, as it may be heavy
21: 6768ac5 = 21: 6f02246 Index even empty attachments
22: acb1782 ! 22: 35037b6 As last_indexed is based on the highest insert, there will never be an UPDATE needed
@@ -20,14 +20,16 @@
$dbh->do( $query, undef, $$text, $attachment->id );
}
@@
+ my $column = $fts_config->{'Column'};
my $query;
- if ( $table ) {
+- if ( $table ) {
- if ( my ($id) = $dbh->selectrow_array("SELECT id FROM $table WHERE id = ?", undef, $attachment->id) ) {
- $query = "UPDATE $table SET $column = to_tsvector(?) WHERE id = ?";
- } else {
- $query = "INSERT INTO $table($column, id) VALUES(to_tsvector(?), ?)";
- }
++ if ( $table ne 'Attachments' ) {
+ $query = "INSERT INTO $table($column, id) VALUES(to_tsvector(?), ?)";
} else {
$query = "UPDATE Attachments SET $column = to_tsvector(?) WHERE id = ?";
23: d2ddcbe ! 23: 6842b22 Inversion of control of main indexing loops
@@ -1,6 +1,16 @@
Author: Alex Vandiver <alexmv at bestpractical.com>
- Inversion of control
+ Inversion of control of main indexing loops
+
+ Rather than having database-dependent if-statements, followed by a
+ standard loop which contains further database-dependent if-statements,
+ instead turn the loop into a function which cane be called from one of
+ two database-specific functions. This is important because MySQL's
+ iteration will further diverge from PostgreSQL's in the following
+ commits.
+
+ This commit is best viewed with:
+ git diff --patience --ignore-all-space
diff --git a/sbin/rt-fulltext-indexer.in b/sbin/rt-fulltext-indexer.in
--- a/sbin/rt-fulltext-indexer.in
@@ -40,7 +50,7 @@
- $found++;
- if ($db_type eq 'mysql') {
- process_mysql( $a, \$text );
-- } elsif ($db_type eq 'pg') {
+- } elsif ($db_type eq 'Pg') {
- process_pg( $a, \$text );
- }
- debug("Processed attachment #". $a->id );
@@ -50,7 +60,7 @@
+my $LAST;
+if ($db_type eq 'mysql') {
+ process_mysql();
-+} elsif ($db_type eq 'pg') {
++} elsif ($db_type eq 'Pg') {
+ process_pg();
}
@@ -117,14 +127,14 @@
my $table = $fts_config->{'Table'};
my $column = $fts_config->{'Column'};
-+ if ($table) {
++ if ( $table ne 'Attachments' ) {
+ ($LAST) = $dbh->selectrow_array("SELECT MAX(id) FROM $table");
+ } else {
+ ($LAST) = $dbh->selectrow_array("SELECT MAX(id) FROM Attachments WHERE $column IS NOT NULL");
+ }
+
my $query;
- if ( $table ) {
+ if ( $table ne 'Attachments' ) {
$query = "INSERT INTO $table($column, id) VALUES(to_tsvector(?), ?)";
@@
$query = "UPDATE Attachments SET $column = to_tsvector(?) WHERE id = ?";
24: 7a29799 ! 24: 00037f9 Switch to preparing statements, rather than just setting strings
@@ -30,7 +30,7 @@
- my $query;
+ my $sth;
- if ( $table ) {
+ if ( $table ne 'Attachments' ) {
- $query = "INSERT INTO $table($column, id) VALUES(to_tsvector(?), ?)";
+ $sth = $dbh->prepare("INSERT INTO $table($column, id) VALUES(to_tsvector(?), ?)");
} else {
25: 7d78413 = 25: d2b9064 INSERT DELAYED provides notable speed benefits on MyISAM
26: b490888 = 26: 17850b6 Improve MySQL insert speed by batching inserts into one statement
More information about the rt-commit
mailing list