{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/orleans/issues/1207","labels_url":"https://api.github.com/repos/dotnet/orleans/issues/1207/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/orleans/issues/1207/comments","events_url":"https://api.github.com/repos/dotnet/orleans/issues/1207/events","html_url":"https://github.com/dotnet/orleans/pull/1207","id":123981936,"number":1207,"title":"fix MySql script concurrency issues and add sql publisher tests","user":{"login":"shayhatsor","id":12084632,"avatar_url":"https://avatars.githubusercontent.com/u/12084632?v=3","gravatar_id":"","url":"https://api.github.com/users/shayhatsor","html_url":"https://github.com/shayhatsor","followers_url":"https://api.github.com/users/shayhatsor/followers","following_url":"https://api.github.com/users/shayhatsor/following{/other_user}","gists_url":"https://api.github.com/users/shayhatsor/gists{/gist_id}","starred_url":"https://api.github.com/users/shayhatsor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shayhatsor/subscriptions","organizations_url":"https://api.github.com/users/shayhatsor/orgs","repos_url":"https://api.github.com/users/shayhatsor/repos","events_url":"https://api.github.com/users/shayhatsor/events{/privacy}","received_events_url":"https://api.github.com/users/shayhatsor/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dotnet/orleans/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/dotnet/orleans/labels/cla-already-signed","name":"cla-already-signed","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-12-27T14:47:41Z","updated_at":"2015-12-28T16:05:59Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/dotnet/orleans/pulls/1207","html_url":"https://github.com/dotnet/orleans/pull/1207","diff_url":"https://github.com/dotnet/orleans/pull/1207.diff","patch_url":"https://github.com/dotnet/orleans/pull/1207.patch"},"body":"This is a fix for #1169.\r\nImportant changes:\r\n* [SELECT ... FOR UPDATE] (http://www.techonthenet.com/oracle/cursors/for_update.php) was changed to [INSERT ... ON DUPLICATE KEY UPDATE](http://dev.mysql.com/doc/refman/5.7/en/insert-on-duplicate.html)\r\n* Removed redundancies from the `MySql` script. (same can be done to the `MSSQL` script)\r\n * Removed all `IS NOT NULL` checks.\r\n * Removed column `ETag` from `OrleansMembershipVersionTable` because it's the same as `Version`\r\n* Added tests for `SqlStatisticsPublisher` for both `MSSQL` and `MySQL`\r\n* Changed reminders upsert test to test in parallel"},"comment":{"url":"https://api.github.com/repos/dotnet/orleans/issues/comments/167595418","html_url":"https://github.com/dotnet/orleans/pull/1207#issuecomment-167595418","issue_url":"https://api.github.com/repos/dotnet/orleans/issues/1207","id":167595418,"user":{"login":"veikkoeeva","id":5158694,"avatar_url":"https://avatars.githubusercontent.com/u/5158694?v=3","gravatar_id":"","url":"https://api.github.com/users/veikkoeeva","html_url":"https://github.com/veikkoeeva","followers_url":"https://api.github.com/users/veikkoeeva/followers","following_url":"https://api.github.com/users/veikkoeeva/following{/other_user}","gists_url":"https://api.github.com/users/veikkoeeva/gists{/gist_id}","starred_url":"https://api.github.com/users/veikkoeeva/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/veikkoeeva/subscriptions","organizations_url":"https://api.github.com/users/veikkoeeva/orgs","repos_url":"https://api.github.com/users/veikkoeeva/repos","events_url":"https://api.github.com/users/veikkoeeva/events{/privacy}","received_events_url":"https://api.github.com/users/veikkoeeva/received_events","type":"User","site_admin":false},"created_at":"2015-12-28T16:05:59Z","updated_at":"2015-12-28T16:05:59Z","body":"@shayhatsor Oh, now I see! I missed it somehow as it looked like the red came due to shiting lines. Doing that for SQL Server would make me nervous -- also for MySQL. Could you use the MySQL `<=>` operator if you want to shave of a bit on the query character lengths?\r\n\r\nThis may come across as preaching and it's not my intention, but I'll provide context for my thinking for you and others. SQL works on [three-valued logic](https://en.wikipedia.org/wiki/Three-valued_logic) wherein `NULL` denotes either missing or an unknown value. [Comparing to null could be considered as undefined](http://www.xaprb.com/blog/2006/05/18/why-null-never-compares-false-to-anything-in-sql/) in programming parlor (depends on database settings, database etc. etc., basically undefined).\r\n\r\nI put the `NULL` checks to SQL Server initially on purpose. Even if the values are already checked in the code, I intended it as a piece of documentation to the possible DBA and a sanity check and to ease on defining other relational databases as what should only really be needed is porting the script. It's one line of defence against errors in code (due to refactoring or some other reason) and something that's easier to see locally, on the database script, without checking and making sure in the code that if there are nulls or if there are no nulls. It's always clear the situation is accounted for. I don't think it has a (noticeable) performance impact and somebody might also script testing logic straight to the DB (using the queries in the tables and looking performance counters, deadlock graphs etc.), in which case it aids understanding to have too to have those checks."}}