Discussion:
[p4] p4 sync for recreated client
Hamza Sheikh
2018-02-09 05:29:21 UTC
Permalink
Does p4 download all data again during `p4 sync` if:

- the client is deleted `p4 client -d clientfoo`
- but data in workspace is not deleted
- then the client is created again with the same config values `p4 client`
- run `p4 sync`

I would expect the data to not be downloaded again in this case since
it already exists.

- Is my expectation wrong?
- Am I misunderstanding and data is not downloaded again?


Here's my scenario:

Create a Docker container. Mount a volume in the container that will
contain synced with p4, say at /ws. Create a workspace like below and
run `p4 sync`.

Client: foostr
Update: blahdate
Access: blahdate
Owner: foouser
Host: build-container
Description:
Created by foouser.
Root: /ws
Options: noallwrite noclobber nocompress unlocked nomodtime normdir
SubmitOptions: submitunchanged
LineEnd: local
View:
//depot/bar/... //foostr/bar/...


I can recreate the container many times and run `p4 sync`. If there
have been no changes, then the workspace is in sync and there's
nothing to do every time.

However, if I delete the client with `p4 client -d foostr`, create it
again with the same config, and run `p4 sync`, *all* files are
downloaded again.
_______________________________________________
perforce-user mailing list - perforce-***@perforce.com
http://maillist.perforce.com/mailman/listinfo
Sven Erik Knop
2018-02-09 07:12:31 UTC
Permalink
HI Hamza,

The Perforce Helix server keeps track of the state of the workspace in its database (in the db.have table). When you delete the workspace you also wipe the db.have table for that workspace, therefore a 'p4 sync' will have to download all the files again.

Instead of deleting the client you could unload it instead (after creating an unload depot). This would preserve the client's state.

If you can guarantee that the state of the workspace has not changed between deleting the client workspace and recreation of the client workspace, you can use 'p4 sync -k', which will not download the files but update the metadata. Be careful with that though: If someone sneaked in a change to your files in between deletion and recreation of your client workspace, you now have synced in the incorrect state.

Cheers,

Sven Erik

--

Sven Erik Knop | Principal Solutions Engineer
Perforce Software<http://www.perforce.com>
T: +44 1189 771020<tel:+441189771020> | M: +44 7974 351514<tel:+447974351514>
Visit us on: Twitter<https://twitter.com/perforce> | LinkedIn<https://www.linkedin.com/company/perforce-software> | Facebook<https://www.facebook.com/Perforce>

New code hosting for Git, SVN, and more.
Try Helix TeamHub free today!<http://info.perforce.com/try-perforce-helix-teamhub-free?leadsourcedetail=hth-global-ongoing-wtl-freemium-cloud&leadsource=outlook-direct-email&utm_source=outlook-direct-email&utm_medium=email&utm_campaign=hth-global-ongoing-wtl-freemium-cloud&utm_term=vcs&utm_content=email-signature-link>



On 9 Feb 2018, at 07:29, Hamza Sheikh <***@codeghar.com<mailto:***@codeghar.com>> wrote:

Does p4 download all data again during `p4 sync` if:

- the client is deleted `p4 client -d clientfoo`
- but data in workspace is not deleted
- then the client is created again with the same config values `p4 client`
- run `p4 sync`

I would expect the data to not be downloaded again in this case since
it already exists.

- Is my expectation wrong?
- Am I misunderstanding and data is not downloaded again?


Here's my scenario:

Create a Docker container. Mount a volume in the container that will
contain synced with p4, say at /ws. Create a workspace like below and
run `p4 sync`.

Client: foostr
Update: blahdate
Access: blahdate
Owner: foouser
Host: build-container
Description:
Created by foouser.
Root: /ws
Options: noallwrite noclobber nocompress unlocked nomodtime normdir
SubmitOptions: submitunchanged
LineEnd: local
View:
//depot/bar/... //foostr/bar/...


I can recreate the container many times and run `p4 sync`. If there
have been no changes, then the workspace is in sync and there's
nothing to do every time.

However, if I delete the client with `p4 client -d foostr`, create it
again with the same config, and run `p4 sync`, *all* files are
downloaded again.
_______________________________________________
perforce-user mailing list - perforce-***@perforce.com<mailto:perforce-***@perforce.com>
http://maillist.perforce.com/mailman/listinfo/perforce-user

_______________________________________________
perforce-user mailing list - perforce-***@perforce.com
http://maillist.perforce.com/mailman/list

Loading...