Programmatically check number of parallel copies
Hi Everyone,
I am working on a script to make unique ID's for something. The script runs on the local copy of the code. It scans all the ID's made and finds what the next highest ID should be and starts making ID's from there. The script is working fine in test, but it is very vulnerable to parallel changes. Right now we are planning to fix errors caused by parallel changes manually. However, if there is some way to find out how many copies of a file there are checked out at one time, then the script could use this every time the script is run. If someone could let me know I would really appreciate it. -Thanks |
5 answers
Ralph Schoon (63.6k●3●36●46)
| answered Aug 10 '11, 3:02 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Hi,
RTC/Jazz SCM does not have a concept of being checked out today. Therefore I doubt that there is any information available on server side. The repository workspaces are just loaded and the server should not have to know about that fact. Also change sets containing a change to the file could be included in multiple streams etc. I would think about making the number unique building in the repository workspace id. Since several of these could also be loaded you could try to put in the information taken from the hostname and the sandbox location to make it unique. Only a thought. |
Hi Ralph,
Thanks for the answer. I guess those design decisions might help RTC function better, so I won't complain about that. The answer is still useful, because I don't need to spend time looking for a way to do it. Also, thanks for the suggestion about the ID generation. Thanks :) |
Geoffrey Clemm (30.1k●3●30●35)
| answered Aug 11 '11, 12:32 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
This is not supported currently, but is requested in work item 29735 and
work item 155842. Please feel free to add a comment to one of these work items to indicate your interest/support. Cheers, Geoff On 8/9/2011 7:23 PM, hbhakhr wrote: Hi Everyone, |
Thanks again for the response. I now have a follow up question knowing this about RTC.
It seems like there is no way that I can ensure that generated codes are unique since I will not be aware of the number of copies checked out. However, as a next best thing, I was wondering if I could just have the program modify the file in such a way that RTC would detect a conflict if there have been concurrent changes. I know one way to do this would be do just modify the name of the file with some sort of version number and when there are changes to the name of the file by different people RTC would detect a conflict. I know this would probably work, but I was wondering if I could have it still raise a conflict without having to change the file name. Basically, what is the minimum I need to do to force a conflict. For example, would having one line in the file with a time-stamp that is changed each time my script is run be enough to detect a conflict? Also, is there any way that I can have RTC run a script automatically on check out? Thanks |
Geoffrey Clemm (30.1k●3●30●35)
| answered Aug 11 '11, 5:24 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
There is no need to do anything fancy here ... just require that
everyone that is modifying the file delivers the change to a common stream. If someone has modified the file before you, you will get a conflict when you try to deliver to the stream. Accept the changes from the stream, resolve the conflict by modifying the "mine" version with a number that is one greater than the "proposed" version, checkin the merge, and re-try the deliver. Cheers, Geoff On 8/11/2011 2:53 PM, hbhakhr wrote: Thanks again for the response. I now have a follow up question knowing |
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.