Commit Graph

21 Commits

Author SHA1 Message Date
Jun Wu
ad910092e1 pushrebase: fix None handling for ontoctx
Summary:
`ontoctx` could be `None`. In that case `.hex()` will fail.
Fix it by recording `ontorev` as `None` in that case.

Reviewed By: liubov-dmitrieva

Differential Revision: D10178579

fbshipit-source-id: e7fdcfe1bc59043685b6da790c28c4a83c514043
2018-10-03 13:32:56 -07:00
Stanislau Hlebik
d93c5269be pushrebase: record pushrebases failed on hooks
Summary:
At the moment they are not recorded because setrecordingparams may not be set
before hooks are called.

Also hooks weren't recorded because pushrebasereplacements weren't correctly
set and KeyError was thrown. This diff fixes it

Reviewed By: quark-zju

Differential Revision: D10147933

fbshipit-source-id: ef33d3e4efa7f3c42e7fcc22ee5f6e54068bf1dc
2018-10-03 04:20:22 -07:00
Stanislau Hlebik
5b12e92cc2 pushrebase: record failed pushrebase conflicts
Summary:
In D10023543 stackpush was added, and conflict check can happen earlier. In
that case failed pushrebase wasn't recorded. This diff fixes it.

Reviewed By: quark-zju

Differential Revision: D10119679

fbshipit-source-id: ef12e00a43375151f81a95eec2d9f02db0a9b12b
2018-10-01 04:05:57 -07:00
Jun Wu
d0d8a6a74b hgsql: rename variables to make things more obvious
Summary:
* Rename takelock to dbwritable
  The word "lock" is unclear what lock (local or SQL) it is. Make it clear it's
  all about database writes.

* Rename waitforlock to enforcepullfromdb
  Again, unclear what lock it is. It's also unclear what it does. Rename to
  "enforce pull from db" to make it obvious.

* Rename syncdb to pullfromdb
  "sync" is unclear about what direction to sync. Use "pullfromdb" to make it
  clear.  The hook name is unchanged for compatibility.

Reviewed By: phillco

Differential Revision: D10108594

fbshipit-source-id: fff405e2df9e926f5db436ef74cb5a9aacaebdb4
2018-09-28 16:58:36 -07:00
Jun Wu
2e6d87ce23 pushrebase: also write logs to blackbox
Summary:
This would be useful for investigating individual cases where sql lockheld time
is long.

Reviewed By: phillco

Differential Revision: D10055069

fbshipit-source-id: f3cdd7a198bdec777c12b98dd6a48e87d862c1bf
2018-09-26 14:20:14 -07:00
Phil Cohen
5f9bd1a7da pushrebase: run hgsql sync after running prepushrebase hooks
Summary:
Our hypothesis is that if the prepushrebase hooks take a significant amount of time, the repo state will get out date, causing hgsql to degrade under load.

This uses the previous test to simulate new commits coming in to the database while a single server is busy running prepushrebase hooks. The new code causes a second sync to occur just after running the hooks.

Reviewed By: quark-zju

Differential Revision: D9999683

fbshipit-source-id: 43d2390b476d090a66353555247c9a623386e75a
2018-09-25 18:23:12 -07:00
Jun Wu
83559cfb29 pushrebase: introduce a stackpush fast path
Summary:
The fast path avoids recreating the bundlerepo in the critical section, which
is like a reliable 0.8s win.

See the docstring in stackpush.py for details. It does not replace all use cases
that the old code path supports. So the old path is preserved.

Since it's a drop-in replacement, make it the default.

Reviewed By: phillco

Differential Revision: D10023543

fbshipit-source-id: eaceb9ae5067ab9040aa10cc65170ae54abd3331
2018-09-25 16:06:21 -07:00
Phil Cohen
34a35919c7 pushrebase: improve cold manifest logging (track what was cached)
Summary:
Multiple calls to the wrapped function should, in theory, be cached, so that calling them isn't as expensive as the first time.

Let's track what should be cached ourself so we can provide useful output. This is less risky than trying to separate the underlying logic in revlog.py.

Also, properly handle rev numbers (we are called with both) and turn them into nodes.

Reviewed By: quark-zju

Differential Revision: D10023518

fbshipit-source-id: 9a9ac1ed223136ca19d20db2ee6eb1ca11d5ae49
2018-09-25 13:21:44 -07:00
Phil Cohen
25d9c831b1 pushrebase: add debug command to print manifest reads during push
Summary:
Part of push contention debugging. We want to be able to turn this on server-side to see how many uncached manifest reads we're doing.

If `pushrebase.debugprintmanifestreads` is set it'll log to blackbox.

If `pushrebase.debugprintmanifestreads.user` is set it'll also be sent to client logs, which is fine since most pushes are Landcastle these days.

Stolen from my test in D4785464.

Reviewed By: quark-zju

Differential Revision: D9994420

fbshipit-source-id: ff1294dfda2f2774fc6be78e096dad9fd9a28a5e
2018-09-21 15:33:21 -07:00
Jun Wu
8c33c0736a pushrebase: handle tree commits correctly for merges and renames
Summary:
In pushrebase code path, `_getmanifest` needs to be used to obtain the manifest
correctly for pushes from treeonly repos. The merge commit code path missed this
change. Fix it.

Besides, the rename checking code patch can also hit flat manifest errors via
repo.commitctx -> ... -> fctx._copied -> ctx.filenode -> ctx._fileinfo. Patch
that path too.

Reviewed By: phillco

Differential Revision: D9977904

fbshipit-source-id: 8c51aa9cc6bd85b0147d88c61a5af074e36cdb61
2018-09-21 10:26:40 -07:00
Stanislau Hlebik
782da103f1 fix pushrebase recording
Summary:
It was trying to add a recording for non-pushrebase pushes. It did not result
in failure, but it did result in an annoying warning.

Reviewed By: farnz

Differential Revision: D9570530

fbshipit-source-id: de999a60c146cc49a1a5fd057b6037cf9f73e367
2018-08-31 03:52:07 -07:00
Kaley Huang
9d54d78caa verify LFS blobs were uploaded before push
Summary:
per @[1070541862:quark]'s suggestion, I attempt to add a verification hook that checks LFS blobs were uploaded before push.

The code execution path looks like this:
`command.py: push()` -->
`exchange.py: push()` -->
 ......
 `exchange.py: _pushbundle2()`
 `exchange.py: _pushcheckoutgoing()`
 ......

And I insert the hook in `exchange.py: _pushcheckoutgoing()`

Reviewed By: quark-zju

Differential Revision: D9212199

fbshipit-source-id: 98e016da81f9df85731771b7d486d03848624bcb
2018-08-20 16:51:07 -07:00
Pavel Aslanov
8ed850dc2b fixes recording of: 1. correct repo_id. 2. full ontorev
Summary:
This change fixes two problems in pushrebase recording, that will be used to test mononoke pushrebase:
- record correct `repo_id`, it used to be always 0
- `ontorev` truncation, as we store rev as hex string we need 40 bytes instead of 20

Reviewed By: ikostia

Differential Revision: D9398009

fbshipit-source-id: 91add2d75fbb9acf32b99dc952c467d44c2ccbc9
2018-08-20 06:23:20 -07:00
Jun Wu
dd0296f079 pushrebase: do not create obsmarkers on the server
Summary:
The obsmarker does not make much sense on the server repo since the precursor
does not exist. The client can still receive them.

This makes sure even if we turn obsstore on by default, the server won't create
markers.

Reviewed By: DurhamG

Differential Revision: D9236657

fbshipit-source-id: 32cce8c6ce6bd53ce92e17d1e7b048e089b43fe6
2018-08-18 10:51:56 -07:00
Jun Wu
ba0bb4495f pushrebase: use overlayfilectx
Summary: This allows pushrebase to avoid reading LFS content.

Reviewed By: DurhamG

Differential Revision: D8986782

fbshipit-source-id: 4ae6725d6fe901ec6b33d22d1f6c0f28c2ccfd39
2018-07-27 20:06:08 -07:00
Stanislau Hlebik
def2302abb pushrebase: record duration as well
Summary: Useful to compare perf

Reviewed By: quark-zju

Differential Revision: D8932499

fbshipit-source-id: 4624222db49f95cdcbb347ffa4eade10f9128225
2018-07-25 02:34:49 -07:00
Kaley Huang
813ff213e6 pushrebase: add a test with lfs enabled
Summary:
enables lfs for pushrebase and adds tests.

using
```
  > [pushrebase]
  > rewritedates = True
```
in the tests so that pushrebase actually changes the hash of the commit

Reviewed By: DurhamG

Differential Revision: D8939281

fbshipit-source-id: a3b95962635bb1f7926889c2869ea79cfca8132d
2018-07-24 09:32:02 -07:00
Durham Goode
7386791327 pushrebase: don't send flat manifests back during reply to treeonly
Summary:
When constructing the pushrebase reply part, we weren't passing the
bundlecaps along, so it was creating a normal flat-manifest changegroup. A
treeonly client that received this would have to translate it to a tree, which
was expensive for pushes that returned a lot of manifests.

The fix is to pass the appopriate bundle caps to the changegroup creation. Since
we don't have access to the bundle1 caps inside a bundle2 part handler, we had
to update the treeonly logic to also pass treeonly=True caps as bundle2 caps.

Reviewed By: StanislavGlebik

Differential Revision: D8958866

fbshipit-source-id: 4d68031aedb61ae4b113ea9376c704c7548f029c
2018-07-23 18:53:13 -07:00
Stanislau Hlebik
1b2b294b18 pushrebase: add recording requests
Summary:
If pushrebase.enablerecording and the rest of the parameters are set then let's
save pushrebase requests. It involves saving the changegroup and treemanifest
bundles2 parts to bundlestore, and then inserting an entry into the database

Reviewed By: quark-zju

Differential Revision: D8801602

fbshipit-source-id: bea4f798daa8542541c8d7c4c2a051c8583930a0
2018-07-13 09:36:52 -07:00
Stanislau Hlebik
60e10ef772 pushrebase: add ConflictsError
Summary:
For request recording we want to treat conflicts separately. Let's add a
special exception for that.

Reviewed By: quark-zju

Differential Revision: D8787567

fbshipit-source-id: 8bee7e1a61763982e74fbaf15a9320d1d565fd76
2018-07-13 09:36:52 -07:00
Stanislau Hlebik
74b93af7fe pushrebase: move to a separate package
Summary:
The file is already quite big, and I'm going to add request recording
functionality soon. Let's move it in a separate package

Reviewed By: quark-zju

Differential Revision: D8787566

fbshipit-source-id: c0202d2ebf1e1662d4b02b966035f6cce9d2344e
2018-07-13 09:36:52 -07:00