Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: migrate to HEX() uuids #3092

Merged
merged 2 commits into from
Sep 3, 2018

Conversation

jniles
Copy link
Collaborator

@jniles jniles commented Aug 29, 2018

BREAKING CHANGE: you should no longer call uuid() directly on the server. Instead, call util.uuid() to generate a compatible UUID.

This commit migrates the application to use hexadecimal UUIDs instead of using the standard representation with dashes. From a data structure perspective, this doesn't change anything - the data is still stored in binary. However, SELECT BUID() is 3x faster due to a simpler construction.

This change caused me to revisit our tests and try to clean up a lot of the code. Most files were changed to update the syntax for UUIDs as well as clean up lint issues.

Closes #3090.

Copy link
Contributor

@sfount sfount left a comment

Choose a reason for hiding this comment

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

This is a great refactor, eslint thanks you!

Insightful analysis with #3090 and well executed.

Just one question about the roll-out plan but the code look good to me.

@@ -323,7 +301,7 @@ exports.configure = function configure(app) {
/* Depot distributions routes */
app.get('/depots/:depotId/distributions', depots.listDistributions);
app.get('/depots/:depotId/distributions/:uuid', depots.detailDistributions);
app.post('/depots/:depotId/distributions', depots.createDistributions);
// app.post('/depots/:depotId/distributions', depots.createDistributions);
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like the createDistributions method has been removed from depots, this can probably be fully removed.

@@ -22,11 +22,9 @@ $$
Converts a binary uuid (16 bytes) to dash-delimited hex UUID (36 characters).
*/
CREATE FUNCTION BUID(b BINARY(16))
RETURNS CHAR(36) DETERMINISTIC
RETURNS CHAR(32) DETERMINISTIC
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it necessary to write a migrate script for the API/ change in function? I'm under the impression the backup system doesn't include functions or stored procedures so it may not be needed, just making sure there's a plan for applying this PR to existing systems.

@jniles
Copy link
Collaborator Author

jniles commented Sep 3, 2018

@sfount, I made the changes requested. Do things look satisfactory to you?

BREAKING CHANGE: you should no longer call uuid() directly.  Instead,
call util.uuid() to generate a compatible UUID.

This commit migrates the application to use hexadecimal UUIDs instead of
using the standard representation with dashes.  From a data structure
perspective, this doesn't change anything - the data is still stored in
binary.  However, `SELECT BUID()` is 3x faster due to a simpler
construction.

This change caused me to revisit our tests and try to clean up a lot of
the code.  Most files were changed to update the syntax for UUIDs as
well as clean up lint issues.

Closes Third-Culture-Software#3090.
This commit adds the BUID() migration script to remove the previous
version and update the database with a new one.
@sfount
Copy link
Contributor

sfount commented Sep 3, 2018

@jniles Looks great! 👍 This shouldn't be a problem in development but the utility might be useful out in production, nice work.

@jniles
Copy link
Collaborator Author

jniles commented Sep 3, 2018

Cheers! Let's see if it will merge...

bors r+

bors bot added a commit that referenced this pull request Sep 3, 2018
3092: perf: migrate to HEX() uuids r=jniles a=jniles

BREAKING CHANGE: you should no longer call `uuid()` directly on the server.  Instead, call `util.uuid()` to generate a compatible UUID.

This commit migrates the application to use hexadecimal UUIDs instead of using the standard representation with dashes.  From a data structure perspective, this doesn't change anything - the data is still stored in binary.  However, `SELECT BUID()` is 3x faster due to a simpler construction.

This change caused me to revisit our tests and try to clean up a lot of the code.  Most files were changed to update the syntax for UUIDs as well as clean up lint issues.

Closes #3090.

Co-authored-by: Jonathan Niles <[email protected]>
@bors
Copy link
Contributor

bors bot commented Sep 3, 2018

Build succeeded

@bors bors bot merged commit d340997 into Third-Culture-Software:master Sep 3, 2018
@jniles jniles deleted the perf-buid-as-hex branch September 3, 2018 13:54
mbayopanda pushed a commit to mbayopanda/bhima that referenced this pull request Dec 15, 2018
3015: Update karma to the latest version 🚀 r=jniles a=greenkeeper[bot]




## Version **3.0.0** of **karma** was just published.

<table>
  <tr>
    <th align=left>
      Dependency
    </th>
    <td>
      <a target=_blank href=https://github.com/karma-runner/karma>karma</a>
    </td>
  </tr>
  <tr>
      <th align=left>
       Current Version
      </th>
      <td>
        2.0.5
      </td>
    </tr>
  <tr>
    <th align=left>
      Type
    </th>
    <td>
      devDependency
    </td>
  </tr>
</table>



The version **3.0.0** is **not covered** by your **current version range**.

If you don’t accept this pull request, your project will work just like it did before. However, you might be missing out on a bunch of new features, fixes and/or performance improvements from the dependency update.

It might be worth looking into these changes and trying to get this project onto the latest version of karma.

If you have a solid test suite and good coverage, a passing build is a strong indicator that you can take advantage of these changes directly by merging the proposed change into your project. If the build fails or you don’t have such unconditional trust in your tests, this branch is a great starting point for you to work on the update.


---


<details>
<summary>Release Notes</summary>
<strong>v3.0.0</strong>

<h3>Bug Fixes</h3>
<ul>
<li><strong>config:</strong> wait 20s for browser activity. (<a href="https://urls.greenkeeper.io/karma-runner/karma/issues/3087">#3087</a>) (<a href="https://urls.greenkeeper.io/karma-runner/karma/commit/88b977f">88b977f</a>)</li>
<li><strong>config:</strong> Wait 30s for browser activity per Travis. (<a href="https://urls.greenkeeper.io/karma-runner/karma/issues/3091">#3091</a>) (<a href="https://urls.greenkeeper.io/karma-runner/karma/commit/f6d2f0e">f6d2f0e</a>)</li>
<li><strong>init:</strong> add "ChromeHeadless" to the browsers' options (<a href="https://urls.greenkeeper.io/karma-runner/karma/issues/3096">#3096</a>) (<a href="https://urls.greenkeeper.io/karma-runner/karma/commit/56fda53">56fda53</a>)</li>
<li><strong>server:</strong> Exit clean on unhandledRejections. (<a href="https://urls.greenkeeper.io/karma-runner/karma/issues/3092">#3092</a>) (<a href="https://urls.greenkeeper.io/karma-runner/karma/commit/02f54c6">02f54c6</a>), closes <a href="https://urls.greenkeeper.io/karma-runner/karma/issues/3064">#3064</a></li>
<li><strong>travis:</strong> Up the socket timeout 2-&gt;20s. (<a href="https://urls.greenkeeper.io/karma-runner/karma/issues/3103">#3103</a>) (<a href="https://urls.greenkeeper.io/karma-runner/karma/commit/732396a">732396a</a>), closes <a href="https://urls.greenkeeper.io/karma-runner/karma/issues/3102">#3102</a></li>
<li><strong>travis:</strong> use the value not the key name. (<a href="https://urls.greenkeeper.io/karma-runner/karma/issues/3097">#3097</a>) (<a href="https://urls.greenkeeper.io/karma-runner/karma/commit/90f5546">90f5546</a>)</li>
<li><strong>travis:</strong> validate TRAVIS_COMMIT if TRAVIS_PULL_REQUEST_SHA is not set. (<a href="https://urls.greenkeeper.io/karma-runner/karma/issues/3094">#3094</a>) (<a href="https://urls.greenkeeper.io/karma-runner/karma/commit/fba5d36">fba5d36</a>)</li>
<li><strong>travis:</strong> Validate TRAVIS_PULL_REQUEST_SHA rather than TRAVIS_COMMIT. (<a href="https://urls.greenkeeper.io/karma-runner/karma/issues/3093">#3093</a>) (<a href="https://urls.greenkeeper.io/karma-runner/karma/commit/a58fa45">a58fa45</a>)</li>
</ul>
</details>

<details>
<summary>Commits</summary>
<p>The new version differs by 17 commits.</p>
<ul>
<li><a href="https://urls.greenkeeper.io/karma-runner/karma/commit/a4d5bdcbe36cbe12974fa9936a224a7837c5f0a4"><code>a4d5bdc</code></a> <code>chore: release v3.0.0</code></li>
<li><a href="https://urls.greenkeeper.io/karma-runner/karma/commit/75f466dc172223cd8aa6fd7eec9bee810c982341"><code>75f466d</code></a> <code>chore: release v2.0.6</code></li>
<li><a href="https://urls.greenkeeper.io/karma-runner/karma/commit/5db939907cabae3d0ef77ec08ae04563177116c2"><code>5db9399</code></a> <code>chore: update contributors</code></li>
<li><a href="https://urls.greenkeeper.io/karma-runner/karma/commit/eb3b1b4ce8e0545832676289deb6e48bde5465fd"><code>eb3b1b4</code></a> <code>chore(deps): update mime -&gt; 2.3.1 (Third-Culture-Software#3107)</code></li>
<li><a href="https://urls.greenkeeper.io/karma-runner/karma/commit/732396a087c6dddeea2cf7f7493bf148a508725d"><code>732396a</code></a> <code>fix(travis): Up the socket timeout 2-&gt;20s. (Third-Culture-Software#3103)</code></li>
<li><a href="https://urls.greenkeeper.io/karma-runner/karma/commit/173848e3a0659bceea9d87d4eeee6c8a11c0f1a1"><code>173848e</code></a> <code>Remove erroneous change log entries for 2.0.3</code></li>
<li><a href="https://urls.greenkeeper.io/karma-runner/karma/commit/10025695c4af3ea983c2c1316ec4ef078e056ebc"><code>1002569</code></a> <code>chore(ci): drop node 9 from travis tests (Third-Culture-Software#3100)</code></li>
<li><a href="https://urls.greenkeeper.io/karma-runner/karma/commit/02f54c6c57f5a3e0be3a44e8e5ca1db98b8dbc8f"><code>02f54c6</code></a> <code>fix(server): Exit clean on unhandledRejections. (Third-Culture-Software#3092)</code></li>
<li><a href="https://urls.greenkeeper.io/karma-runner/karma/commit/0fdd8f9e91b6039c07c857e11a5d7f7b3205cf01"><code>0fdd8f9</code></a> <code>chore(deps): update socket.io -&gt; 2.1.1 (Third-Culture-Software#3099)</code></li>
<li><a href="https://urls.greenkeeper.io/karma-runner/karma/commit/90f5546a9f88199f8118eae506922d4e8ee38945"><code>90f5546</code></a> <code>fix(travis): use the value not the key name. (Third-Culture-Software#3097)</code></li>
<li><a href="https://urls.greenkeeper.io/karma-runner/karma/commit/fba5d365146bad122d54af75bf191ad0b6091dd0"><code>fba5d36</code></a> <code>fix(travis): validate TRAVIS_COMMIT if TRAVIS_PULL_REQUEST_SHA is not set. (Third-Culture-Software#3094)</code></li>
<li><a href="https://urls.greenkeeper.io/karma-runner/karma/commit/56fda53ec19a1a691cd80342fef9b23d9f9fe4d2"><code>56fda53</code></a> <code>fix(init): add "ChromeHeadless" to the browsers' options (Third-Culture-Software#3096)</code></li>
<li><a href="https://urls.greenkeeper.io/karma-runner/karma/commit/f6d2f0ea5a3323c5e359e26fe5be9fbf68db819f"><code>f6d2f0e</code></a> <code>fix(config): Wait 30s for browser activity per Travis. (Third-Culture-Software#3091)</code></li>
<li><a href="https://urls.greenkeeper.io/karma-runner/karma/commit/a58fa45c1df08ff4e74f9e75379f74c1311073c3"><code>a58fa45</code></a> <code>fix(travis): Validate TRAVIS_PULL_REQUEST_SHA rather than TRAVIS_COMMIT. (Third-Culture-Software#3093)</code></li>
<li><a href="https://urls.greenkeeper.io/karma-runner/karma/commit/88b977fcada5d08ae8d5bba9bc8eefc8404eff82"><code>88b977f</code></a> <code>fix(config): wait 20s for browser activity. (Third-Culture-Software#3087)</code></li>
</ul>
<p>There are 17 commits in total.</p>
<p>See the <a href="https://urls.greenkeeper.io/karma-runner/karma/compare/00189471d383600a95415ea526b152dd556ce751...a4d5bdcbe36cbe12974fa9936a224a7837c5f0a4">full diff</a></p>
</details>

<details>
  <summary>FAQ and help</summary>

  There is a collection of [frequently asked questions](https://greenkeeper.io/faq.html). If those don’t help, you can always [ask the humans behind Greenkeeper](https://github.com/greenkeeperio/greenkeeper/issues/new).
</details>

---


Your [Greenkeeper](https://greenkeeper.io) bot 🌴



Co-authored-by: greenkeeper[bot] <greenkeeper[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants