New2Python
New2Python

Reputation: 415

Perforce's p4 sync doesn't catch changes

I have an odd issue of my p4 sync <path>/... always returns

- file(s) up-to-date.

This started happening intermittently about 2 weeks ago, then slowly progressed to 100% not working ie p4 sync does not pickup any changes.

If I run

p4 changes -m5
Enter password: 
User <p4user> logged in.
Change 1523039 on 2019/09/19 by *********************************************online fix read me info'
Change 1523038 on 2019/09/19 by *********************************************config ids to Part'
Change 1523037 on 2019/09/19 by **********************************************pending* 'Created item-definition cache f'
Change 1523036 on 2019/09/19 by ********************************************* '<saved by Perforce> '
Change 1523035 on 2019/09/19 by ********************************************* '<saved by Perforce> '

Ran p4 sync <path>/... and got the files up to date response.

I have performed the following steps a few times now

This then syncs all the files successfully. I am using this as part of my automated build pipeline so I can be having to do the above manually.

Incidentally, I did perform

export P4CONFIG=~/.p4settings; /bin/p4 login < ~/.p4p; p4 workspace

and validated the views all parameters are OK.

My build pipeline has worked for over a year. How can I resolve this?

Upvotes: 2

Views: 1709

Answers (2)

New2Python
New2Python

Reputation: 415

I worked around it. I couldn't find a solution, so created a new workspace and copied in the client configs and workspace views. Our builds are working now again.

Upvotes: 0

Samwise
Samwise

Reputation: 71574

A slightly faster alternative to your p4 sync -f workaround is p4 clean. This is still pretty slow compared to a normal sync, since it needs to checksum the entire workspace, but it's at least a bit faster than re-transferring all the files over the network.

As far as finding and fixing the root cause so you can just sync at full speed and with full confidence, here are some basic things to check up front:

  1. What does p4 have show as being synced to the workspace? Is it the head revisions, or are the revisions old?
  2. If p4 have shows that you have old revisions but p4 sync doesn't want to update them, check p4 opened -- remember that p4 sync won't immediately update open files (it will instead schedule a resolve so you can merge the changes)

I'm going to proceed on the assumption that p4 have shows you already have the head revisions, and the issue isn't that the files are opened.

  1. Are you ever using p4 sync -k or p4 flush to force an update of the have list without updating the workspace? If so, your workspace is obviously going to be inconsistent afterwards; you probably don't want to use those commands.
  2. Are you using the same client spec to sync multiple machines? If so, they're sharing a have list, but not the physical workspace, so the machine where you didn't do the sync is going to be inconsistent with the have list. Do not share a client spec across multiple workspaces. The Host field in the client spec will help remind you not to do this, as long as you don't delete it or override P4HOST.

If you're not sure of the answers to those questions, you can check the server log to see which commands have been issued with this client spec. You may also want to consider setting the client spec to locked to prevent mischievous usage that might break your build pipeline.

Upvotes: 3

Related Questions