Ejegg has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/259340

Change subject: Revert "Add contact_id and link_id to raw LP stats"
......................................................................

Revert "Add contact_id and link_id to raw LP stats"

Jeff says the table is 70GB and running the alter would seriously
impact Civi and the rest for a couple hours.  We can just build
a multi-row INSERT IGNORE statement for donatewiki_uniques alongside
the existing insert statement.

This reverts commit 47503fca7b0ebf2d56ca79c5ec92a4accf88ee77.

Bug: T114010
Change-Id: Ibc9b53e1d1370bf48d199f3baa97113fdacfa9e7
---
M fundraiser/analytics/management/commands/LoadLPImpressions.py
D sql/001_add_contact_link_to_landingimpressions.sql
M sql/create.sql
3 files changed, 2 insertions(+), 18 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/tools/DjangoBannerStats 
refs/changes/40/259340/1

diff --git a/fundraiser/analytics/management/commands/LoadLPImpressions.py 
b/fundraiser/analytics/management/commands/LoadLPImpressions.py
index 68a8d93..0444561 100644
--- a/fundraiser/analytics/management/commands/LoadLPImpressions.py
+++ b/fundraiser/analytics/management/commands/LoadLPImpressions.py
@@ -53,7 +53,7 @@
     )
     help = 'Parses the specified squid log file and stores the impression in 
the database.'
 
-    impression_sql = "INSERT INTO `landingpageimpression_raw%s` (timestamp, 
squid_id, squid_sequence, utm_source, utm_campaign, utm_key, contact_id, 
link_id, utm_medium, landingpage, project_id, language_id, country_id) VALUES 
%s"
+    impression_sql = "INSERT INTO `landingpageimpression_raw%s` (timestamp, 
squid_id, squid_sequence, utm_source, utm_campaign, utm_key, utm_medium, 
landingpage, project_id, language_id, country_id) VALUES %s"
 
     pending_impressions = []
 
@@ -244,8 +244,6 @@
                         utm_campaign = ""
                         utm_medium = ""
                         utm_key = ""
-                        contact_id = ""
-                        link_id = ""
 
                         if "utm_source" in qs:
                             utm_source = qs["utm_source"][0].replace("%", "%%")
@@ -255,10 +253,6 @@
                             utm_medium = qs["utm_medium"][0].replace("%", "%%")
                         if "utm_key" in qs:
                             utm_key = qs["utm_key"][0].replace("%", "%%")
-                        if "contact_id" in qs:
-                            contact_id = qs["contact_id"][0].replace("%", "%%")
-                        if "link_id" in qs:
-                            link_id = qs["link_id"][0].replace("%", "%%")
 
                         landingpage = ""
                         language = None
@@ -329,8 +323,6 @@
                         # truncate to db max lengths
                         utm_campaign = utm_campaign[:255]
                         utm_source = utm_source[:255]
-                        contact_id = contact_id[:31]
-                        link_id = link_id[:127]
 
                         squid = lookup_squidhost(hostname=m.group("squid"), 
verbose=self.verbose)
                         seq = 0  # Can't do int(m.group("sequence")) because 
its > 2^32 and I don't want to run an alter
@@ -338,15 +330,13 @@
 
                         # not using the models here saves a lot of wall time
                         try:
-                            lp_tmp = "('%s',%s, %s, '%s', '%s', '%s', '%s', 
'%s', '%s', '%s', %s, %s, %s)" % (
+                            lp_tmp = "('%s',%s, %s, '%s', '%s', '%s', '%s', 
'%s', %s, %s, %s)" % (
                                 
MySQLdb.escape_string(str(timestamp.strftime("%Y-%m-%d %H:%M:%S"))),
                                 MySQLdb.escape_string(str(squid.id)),
                                 MySQLdb.escape_string(str(seq)),
                                 MySQLdb.escape_string(utm_source),
                                 MySQLdb.escape_string(utm_campaign),
                                 MySQLdb.escape_string(utm_key),
-                                MySQLdb.escape_string(contact_id),
-                                MySQLdb.escape_string(link_id),
                                 MySQLdb.escape_string(utm_medium),
                                 MySQLdb.escape_string(landingpage),
                                 MySQLdb.escape_string(str(project.id)),
diff --git a/sql/001_add_contact_link_to_landingimpressions.sql 
b/sql/001_add_contact_link_to_landingimpressions.sql
deleted file mode 100644
index 9525e66..0000000
--- a/sql/001_add_contact_link_to_landingimpressions.sql
+++ /dev/null
@@ -1,4 +0,0 @@
-ALTER TABLE landingimpression_raw
-ADD COLUMN contact_id VARCHAR(32) CHARACTER SET utf8 DEFAULT '' NOT NULL,
-ADD COLUMN link_id VARCHAR(128) CHARACTER SET utf8 DEFAULT '' NOT NULL;
-
diff --git a/sql/create.sql b/sql/create.sql
index 0c26bb9..b5506b3 100644
--- a/sql/create.sql
+++ b/sql/create.sql
@@ -98,8 +98,6 @@
   utm_campaign    VARCHAR(255)  CHARACTER SET utf8 DEFAULT '' NOT NULL,
   utm_medium      VARCHAR(255)  CHARACTER SET utf8 DEFAULT '' NOT NULL,
   utm_key         VARCHAR(128)  CHARACTER SET utf8 DEFAULT '' NOT NULL,
-  contact_id      VARCHAR(32)   CHARACTER SET utf8 DEFAULT '' NOT NULL,
-  link_id         VARCHAR(128)  CHARACTER SET utf8 DEFAULT '' NOT NULL,
   landingpage     VARCHAR(255)  CHARACTER SET utf8 DEFAULT '' NOT NULL,
   project_id      SMALLINT(3)   UNSIGNED DEFAULT NULL,
   language_id     SMALLINT(3)   UNSIGNED DEFAULT NULL,

-- 
To view, visit https://gerrit.wikimedia.org/r/259340
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibc9b53e1d1370bf48d199f3baa97113fdacfa9e7
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/tools/DjangoBannerStats
Gerrit-Branch: master
Gerrit-Owner: Ejegg <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to