Skip to content
Permalink
Browse files Browse the repository at this point in the history
go go gadget mysql fix for 2877
  • Loading branch information
JohnMcLear committed Apr 1, 2020
1 parent 1c966cc commit e8b58d0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions mysql_db.js
Expand Up @@ -129,7 +129,7 @@ exports.database.prototype.init = function(callback)

exports.database.prototype.get = function (key, callback)
{
this.db.query("SELECT `value` FROM `store` WHERE `key` = ?", [key], function(err,results)
this.db.query("SELECT `value` FROM `store` WHERE BINARY `key` = ?", [key], function(err,results)
{
var value = null;

Expand All @@ -146,7 +146,7 @@ exports.database.prototype.get = function (key, callback)

exports.database.prototype.findKeys = function (key, notKey, callback)
{
var query="SELECT `key` FROM `store` WHERE `key` LIKE ?"
var query="SELECT `key` FROM `store` WHERE BINARY `key` LIKE ?"
, params=[]
;

Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -43,7 +43,7 @@
"url": "https://github.com/ether/ueberDB.git"
},
"main": "./CloneAndAtomicLayer",
"version": "0.4.3",
"version": "0.4.4",
"gitHead": "00cb8c896433922111c12fe9d2a45087fdb11d59",
"bugs": {
"url": "https://github.com/ether/ueberDB/issues"
Expand Down

8 comments on commit e8b58d0

@olio2
Copy link

@olio2 olio2 commented on e8b58d0 May 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Breaks on large databases since no index is used with BINARY:
SELECT * FROM store WHERE key = 'MYSQL_MIGRATION_LEVEL' 0.0015 seconds
SELECT * FROM store WHERE BINARY key = 'MYSQL_MIGRATION_LEVEL' timeout

possible
SELECT * FROM store WHERE key = 'MYSQL_MIGRATION_LEVEL' AND BINARY key = 'MYSQL_MIGRATION_LEVEL' 0.0019 seconds

@JohnMcLear
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You know we are on 0.4.9 right? This is already fixed afaik. Please try latest.

@olio2
Copy link

@olio2 olio2 commented on e8b58d0 May 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its still there an broke our current etherpad update:

this.db.query("SELECT `value` FROM `store` WHERE `key` = ? AND BINARY `key` = ?", [key, key], function(err,results)

I was only searching where and why BINARY was put in.

@JohnMcLear
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh

@JohnMcLear
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait. Notice the and

@JohnMcLear
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I run benchmarks since this bug and my benchmarks disagree with you.... Are you 100 percent sure you are right?

@olio2
Copy link

@olio2 olio2 commented on e8b58d0 May 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fiexed in ueberdb but etherpad 1.8.3 still uses ueberdb 0.4.5 which has BINARY with no AND:
this.db.query("SELECT value FROM store WHERE BINARY key = ?", [key], function(err,results)

@JohnMcLear
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I know, and that's waiting on a patch fix being merged by @muxator - See etherpad open pull requests.

FWIW see https://travis-ci.org/github/ether/ueberDB bottom of the page. I have a new branch where I'm collecting data so this doesn't happen again.

Please sign in to comment.