Closed Bug 1182485 Opened 10 years ago Closed 9 years ago

Datasource should remove extra whitespace when reading in stored SQL statements

Categories

(Tree Management :: Treeherder, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: emorley, Assigned: emorley)

References

Details

Attachments

(2 files)

(This bug is just facepalm that we're even having to think about this; but oh well. Grr Datasource. Grr binlogs. Grr unreasonable DB disk quotas.) The stored procs look like: "set_series_signature":{ "sql":"INSERT INTO `series_signature` (`signature`, `property`, `value`) SELECT ?,?,? FROM DUAL WHERE NOT EXISTS ( SELECT `signature`, `property`, `value` FROM `series_signature` WHERE `signature` = ? AND `property` = ? AND `value` = ? )", "host_type":"master_host" }, It would seem that the datasource package is not stripping the extra whitespace when reading in the files, and so makes queries that contain excessive whitespace. eg from the binlog dumps I've been doing for bug 1179223: Count: 42120 Time=0.00s (0s) Lock=0.00s (0s) Rows=0.0 (0), 0users@0hosts at N #N N:N:N server id N end_log_pos N CRC32 N Query thread_id=N exec_time=N error_code=N SET TIMESTAMP=N/*!*/; INSERT INTO `series_signature` (`signature`, `property`, `value`) SELECT 'S','S','S' FROM DUAL WHERE NOT EXISTS ( SELECT `signature`, `property`, `value` FROM `series_signature` WHERE `signature` = 'S' AND `property` = 'S' AND `value` = 'S' ) /*!*/ The SQL statements in the binlogs are not compressed from what I can tell, so I imagine that stripping this whitespace would actually reduce their size by a reasonable amount.
Plus it would just make the queries there and everywhere else (eg when viewing New Relic's query analysis page, or in MySQLWorkbench when looking at open connections) easier to read.
Attachment #8632146 - Flags: review?(mdoglio) → review+
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
The tests pass locally, but Travis is still not enabled properly on the datasource repo (Jeads needs to flick the switch, I can't since not owner).
Attachment #8685752 - Flags: review?(mdoglio)
Attachment #8632146 - Flags: checkin+
Attachment #8685752 - Flags: review?(mdoglio) → review+
Status: REOPENED → RESOLVED
Closed: 10 years ago9 years ago
Resolution: --- → FIXED
Working well on stage, Before: SELECT signature, state, avg_sec, median_sec, min_sec, max_sec, std, sample_count, MAX(submit_timestamp) FROM job_eta WHERE signature IN (%s) GROUP BY signature, state ORDER BY submit_timestamp DESC After: SELECT signature, state, avg_sec, median_sec, min_sec, max_sec, std, sample_count, MAX(submit_timestamp) FROM job_eta WHERE signature IN (%s) GROUP BY signature, state ORDER BY submit_timestamp DESC
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: