Commit Graph

10 Commits

Author SHA1 Message Date
Jun Wu
89744897fb hgsql: make it test-friendly for external users
Summary:
Previously, when running with an external MySQL setup, it's easy to get the
following "mysterious" error when trying to create the "revisions" table:

  ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes

This is a cleanup of many minor areas to make it easier for external users
to run the test.

  * Move database schema to `schema.sql`, which could be used as `mysql`
    input directly. Remove schema in other places so `schema.sql` is the
    single source of truth.
  * Change `repo`, `namespace` fields to `varchar` to save space.
  * Explicitly set `latin1(_bin)` in schema to avoid potential encoding
    issues. Also specify `InnoDB` to avoid issues of other engines.
  * Source `getdb.sh` instead of parsing its output. Simplifies `getdb.sh`.
  * Provide an example of `getdb.sh` as `getdb.sh.example`.
  * Add `DROP DATABASE` cleanup. External setup probably don't have `testdb`
    dropped automatically.
  * Change `README.md` with the latest instruction about database and test.
  * Bundle `hg-ssh` so `test-pushpull.t` won't fail if it's missing.

Test Plan: `run-tests.py` and it mostly works on a local, non-prod Linux system.

Reviewers: #sourcecontrol, rmcelroy

Reviewed By: rmcelroy

Subscribers: stash, rmcelroy, tja, durham, andrasbelo

Differential Revision: https://phabricator.intern.facebook.com/D4313981

Signature: t1:4313981:1490381520:7c0c9af72ac3446c5ee31f8c9b4376c4198a6dc8
2017-03-23 19:14:52 -07:00
Durham Goode
3f97d92346 bypass: add a hgsql.bypass config option for disabling hgsql
Summary:
Previously, if we needed to disable hgsql for some reason (like testing
corruption, etc) we would just disable the extension. Since we now add a
requires flag to repos that are created with hgsql, this no longer works.

Let's add a config option that can disable hgsql instead and update the tests to
use it. I'm not sure how these test failures slipped through the original
commit.

Test Plan: Ran the tests

Reviewers: #mercurial, ttung, simonfar

Reviewed By: simonfar

Subscribers: simonfar

Differential Revision: https://phabricator.intern.facebook.com/D3289119

Signature: t1:3289119:1462999047:f33337610a1777c379adb70ec307971823f7ae59
2016-05-11 13:54:24 -07:00
Durham Goode
235a2d4a1a hooks: disable all pretxnclose hooks during sync
Summary:
pretxnclose hooks were incorrectly running during the sql sync. Since the
commits have already been committed (on another machine), there's no need to run
the hooks, so let's disable them.

Test Plan: Added a test

Reviewers: pyd, lcharignon, akushner, rmcelroy

Differential Revision: https://phabricator.fb.com/D2173886
2015-06-19 12:45:16 -07:00
Durham Goode
e12f55e798 hgssh: override readonly hook in hgssh
Summary:
The hg-ssh wrapper prevents all transactions from running, including the one we
use to sync our repositories from hgsql. This patch updates hgsql to override
that hook temporarily during syncs.

This wasn't an issue before because upstream mercurial used to hook on
prechangegroup which hgsql did not fire.

Test Plan: Added a test. Verified it failed before, and passes now.

Reviewers: pyd, lcharignon, rmcelroy, sid0

Differential Revision: https://phabricator.fb.com/D2148580
2015-06-11 14:37:03 -07:00
Ryan McElroy
ef88578b6b hgsql: always commit before refreshing references
Summary:
This can't hurt anything, and it makes sure we have a fresh
transaction for the references which have been timing out, strangely.

Test Plan: run_tests.py

Reviewers: durham

Reviewed By: durham

Subscribers: durham

Differential Revision: https://phabricator.fb.com/D2137954

Signature: t1:2137954:1433811692:1234cde23efd2fa8a95ad87453390aa8edeb335d
2015-06-08 17:35:09 -07:00
Durham Goode
53fffdadd1 Update bookmark write handling
Upstream Mercurial no longer always calls bookmark.write to serialize the
bookmarks. Now it sometimes goes through the transaction API which calls
bookmark._write.
2014-10-14 17:07:18 -07:00
Durham Goode
faf7475d75 Revert previous change and fix local phase moves
The previous change that allowed transactions that didn't touch revlogs was
broken. It allowed transactions like 'strip', etc. This reverts that.

To fix the actual issue we were trying to fix before, we now add a sql
transaction around local phase moves as part of exchange.
2014-08-26 03:51:11 -07:00
Durham Goode
8059a8f932 Take bookmark lock for duration of pulls
Summary:
In certain pull use cases (hg pull -B foo), it tries to update the bookmarks
outside of the normal bookmark.updatefromremote() function. This takes the lock
at the very beginning of the pull so all inner bookmark manipulations should
succeed.

Test Plan:
Ran the new test with and without the fix, verified it failed before
and passed afterwards.

Reviewers: sid0, davidsp

Differential Revision: https://phabricator.fb.com/D1214148
2014-03-11 11:25:23 -07:00
Durham Goode
0f98887c95 Fix pushing and pulling bookmarks from local repos
Pushing and pulling local bookmarks was a bit broken, since as soon as the
bookmark dict tried to write, it would sync with the db, which overwrote the
current bookmarks.

This changes it to require the sql connection to be set up and locked before
the bookmark modifications even start to happen.
2014-02-18 17:16:45 -08:00
Durham Goode
f7cb418f63 Fix pushing and pulling from a local repo 2014-02-18 15:59:46 -08:00