2014-01-29 08:49:56 +04:00
|
|
|
$ . "$TESTDIR/library.sh"
|
|
|
|
|
|
|
|
# Populate the db with an initial commit
|
|
|
|
|
|
|
|
$ initclient client
|
|
|
|
$ cd client
|
|
|
|
$ echo x > x
|
|
|
|
$ hg commit -qAm x
|
|
|
|
$ cd ..
|
|
|
|
|
|
|
|
$ initserver master masterrepo
|
|
|
|
$ cd master
|
|
|
|
$ hg log
|
|
|
|
$ hg pull -q ../client
|
|
|
|
|
|
|
|
$ cd ..
|
|
|
|
|
|
|
|
# Verify new masters see the same commit
|
|
|
|
|
|
|
|
$ initserver master2 masterrepo
|
|
|
|
$ cd master2
|
|
|
|
$ hg log
|
|
|
|
changeset: 0:b292c1e3311f
|
|
|
|
tag: tip
|
|
|
|
user: test
|
|
|
|
date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
summary: x
|
|
|
|
|
|
|
|
|
|
|
|
# Push new commit to one master, verify it shows up in the other
|
|
|
|
|
|
|
|
$ cd ../client
|
|
|
|
$ echo y > y
|
|
|
|
$ hg commit -qAm y
|
|
|
|
$ hg push -q ssh://user@dummy/master
|
|
|
|
$ cd ../master2
|
|
|
|
$ hg log -l 1
|
|
|
|
changeset: 1:d34c38483be9
|
|
|
|
tag: tip
|
|
|
|
user: test
|
|
|
|
date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
summary: y
|
|
|
|
|
|
|
|
# Push a bookmark to one master, verify in the other
|
|
|
|
|
|
|
|
$ cd ../client
|
|
|
|
$ hg book mybook
|
|
|
|
$ hg push ssh://user@dummy/master -B mybook
|
|
|
|
pushing to ssh://user@dummy/master
|
|
|
|
searching for changes
|
|
|
|
no changes found
|
|
|
|
exporting bookmark mybook
|
|
|
|
[1]
|
|
|
|
$ cd ../master2
|
|
|
|
$ hg book
|
|
|
|
mybook 1:d34c38483be9
|
|
|
|
|
|
|
|
# Pull commit and bookmark to one master, verify in the other
|
|
|
|
|
|
|
|
$ cd ../client
|
|
|
|
$ hg up mybook
|
|
|
|
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
|
|
$ echo z > z
|
|
|
|
$ hg commit -qAm z
|
|
|
|
$ cd ../master
|
|
|
|
$ hg pull -q ssh://user@dummy/client
|
|
|
|
$ cd ../master2
|
|
|
|
$ hg log -l 1
|
|
|
|
changeset: 2:d47967ce72a5
|
|
|
|
bookmark: mybook
|
|
|
|
tag: tip
|
|
|
|
user: test
|
|
|
|
date: Thu Jan 01 00:00:00 1970 +0000
|
|
|
|
summary: z
|
|
|
|
|
2017-03-30 00:47:53 +03:00
|
|
|
# Delete a bookmark in one, verify in the other
|
|
|
|
|
|
|
|
$ hg book book1
|
|
|
|
$ cd ../master
|
|
|
|
$ hg book
|
|
|
|
book1 -1:000000000000
|
|
|
|
mybook 2:d47967ce72a5
|
|
|
|
$ hg book -d book1
|
|
|
|
$ cd ../master2
|
|
|
|
$ hg book
|
|
|
|
mybook 2:d47967ce72a5
|
|
|
|
|
2014-10-27 23:56:13 +03:00
|
|
|
# Verify that --forcesync works
|
|
|
|
|
2016-10-13 19:47:40 +03:00
|
|
|
$ cd ../
|
|
|
|
$ cp $HGRCPATH backup.hgrc
|
|
|
|
$ cd master
|
2014-10-27 23:56:13 +03:00
|
|
|
$ echo '[hooks]' >> $HGRCPATH
|
Make forcesync only acquire local repo lock
Summary:
Previously, the --forcesync flag would cause the command to acquire the
sqllock, which would mean a read only command would block for any ongoing write
commands to complete, which is undesirable. Now, we will wait for the lcoal repo
lock only, instead of skipping the sync as we did before the initial patch.
This ensures that forcesync operations will see all committed changes, but won't
wait for ongoing write transactions from other masters.
Test Plan: updated test
Reviewers: sid0, davidsp, pyd, mpm, durham
Reviewed By: durham
Differential Revision: https://phabricator.fb.com/D1682970
Signature: t1:1682970:1416014352:e7f3daa09e79abd43a16c8eb74bc69272d73c83d
2014-11-14 21:53:35 +03:00
|
|
|
$ echo 'presyncdb=$TESTTMP/hook.sh' >> $HGRCPATH
|
2015-11-18 00:29:21 +03:00
|
|
|
$ echo 'sleep 2' > $TESTTMP/hook.sh
|
2014-10-27 23:56:13 +03:00
|
|
|
$ chmod a+x $TESTTMP/hook.sh
|
|
|
|
$ cd ../client
|
|
|
|
$ echo a > a
|
|
|
|
$ hg commit -qAm a
|
Make forcesync only acquire local repo lock
Summary:
Previously, the --forcesync flag would cause the command to acquire the
sqllock, which would mean a read only command would block for any ongoing write
commands to complete, which is undesirable. Now, we will wait for the lcoal repo
lock only, instead of skipping the sync as we did before the initial patch.
This ensures that forcesync operations will see all committed changes, but won't
wait for ongoing write transactions from other masters.
Test Plan: updated test
Reviewers: sid0, davidsp, pyd, mpm, durham
Reviewed By: durham
Differential Revision: https://phabricator.fb.com/D1682970
Signature: t1:1682970:1416014352:e7f3daa09e79abd43a16c8eb74bc69272d73c83d
2014-11-14 21:53:35 +03:00
|
|
|
$ hg push -q ssh://user@dummy/master2
|
|
|
|
$ cd ../master
|
|
|
|
$ hg log -l 1 --template '{rev} {desc}\n' &
|
2015-11-18 00:29:21 +03:00
|
|
|
$ sleep 1
|
Make forcesync only acquire local repo lock
Summary:
Previously, the --forcesync flag would cause the command to acquire the
sqllock, which would mean a read only command would block for any ongoing write
commands to complete, which is undesirable. Now, we will wait for the lcoal repo
lock only, instead of skipping the sync as we did before the initial patch.
This ensures that forcesync operations will see all committed changes, but won't
wait for ongoing write transactions from other masters.
Test Plan: updated test
Reviewers: sid0, davidsp, pyd, mpm, durham
Reviewed By: durham
Differential Revision: https://phabricator.fb.com/D1682970
Signature: t1:1682970:1416014352:e7f3daa09e79abd43a16c8eb74bc69272d73c83d
2014-11-14 21:53:35 +03:00
|
|
|
$ hg log -l 1 --template '{rev} {desc}\n' --forcesync
|
2015-10-27 01:48:14 +03:00
|
|
|
waiting for lock on working directory of $TESTTMP/master held by * (glob)
|
Make forcesync only acquire local repo lock
Summary:
Previously, the --forcesync flag would cause the command to acquire the
sqllock, which would mean a read only command would block for any ongoing write
commands to complete, which is undesirable. Now, we will wait for the lcoal repo
lock only, instead of skipping the sync as we did before the initial patch.
This ensures that forcesync operations will see all committed changes, but won't
wait for ongoing write transactions from other masters.
Test Plan: updated test
Reviewers: sid0, davidsp, pyd, mpm, durham
Reviewed By: durham
Differential Revision: https://phabricator.fb.com/D1682970
Signature: t1:1682970:1416014352:e7f3daa09e79abd43a16c8eb74bc69272d73c83d
2014-11-14 21:53:35 +03:00
|
|
|
3 a
|
|
|
|
got lock after ? seconds (glob)
|
2014-10-27 23:56:13 +03:00
|
|
|
3 a
|
2016-10-13 19:47:40 +03:00
|
|
|
$ cd ..
|
|
|
|
$ cp backup.hgrc $HGRCPATH
|
|
|
|
|
|
|
|
# Update one bookmark but not the other
|
|
|
|
$ cat >> $TESTTMP/inspectsql.py <<EOF
|
|
|
|
> import os, sys
|
|
|
|
> from mercurial import demandimport, extensions
|
|
|
|
> with demandimport.deactivated():
|
|
|
|
> import mysql.connector
|
|
|
|
> watchstrings = os.environ.get("INSPECTSQL")
|
|
|
|
> if watchstrings:
|
|
|
|
> watchstrings = watchstrings.split(',')
|
|
|
|
> def printsql(orig, *args, **kwargs):
|
|
|
|
> if not watchstrings or any(s for s in watchstrings if s in args[1]):
|
|
|
|
> print >> sys.stderr, args[1] % args[2]
|
|
|
|
> return orig(*args, **kwargs)
|
|
|
|
> extensions.wrapfunction(mysql.connector.cursor.MySQLCursor, "execute", printsql)
|
|
|
|
> EOF
|
|
|
|
$ cat >> $HGRCPATH <<EOF
|
|
|
|
> [extensions]
|
|
|
|
> inspectsql=$TESTTMP/inspectsql.py
|
|
|
|
> EOF
|
|
|
|
$ cd master
|
|
|
|
$ INSPECTSQL=DELETE,INSERT hg book mybook2
|
|
|
|
INSERT INTO revision_references(repo, namespace, name, value) VALUES (masterrepo, 'bookmarks', mybook2, 0000000000000000000000000000000000000000)
|
|
|
|
INSERT INTO revision_references(repo, namespace, name, value)
|
|
|
|
VALUES(masterrepo, 'tip', 'tip', 3) ON DUPLICATE KEY UPDATE value=3
|
|
|
|
$ cd ..
|
|
|
|
$ cp backup.hgrc $HGRCPATH
|