SlideShare a Scribd company logo
1 of 28
# 
Sven Erik 
Technical Marketing 
Robert Cowham 
Professional Services
# 
• Background 
• Algorithm 
• Configuration 
• Adapting for continuous transfer 
• Customer Case Study
# 
Author of P4Python. 
Started as Lead Consultant at Perforce. 
Regular presenter at Perforce and other 
conferences. 
API experience includes P4OFC 
(P4COM) and P4Python. Author of 
'Learning Perforce SCM' by PACKT 
Publishing, Sep 2013.
#
# 
• One project in two separate Perforce Servers? 
– e.g. Public Depot and Master Depot 
Source P4D Target P4D 
?
# 
• Git? SHAs do not match. 
• Sandbox? Can only talk to one server. 
• Replication? Not practical. 
• Reconcile? Changes? Integrations? 
• Replay changes one by one ... ?
# 
• Transfer workspace sharing the same root 
Source Target 
transfer
# 
• One workspace on each server with shared root 
• Client views have to match 
– Depot views don’t have to match 
– Filter projects you want to transfer 
• Need to set options to allwrite 
Client: src-trans 
Root: /Users/sknop/perforce/transfer 
Options: allwrite 
View: 
//source/project1/... //src-trans/... 
Client: target-trans 
Root: /Users/sknop/perforce/transfer 
Options: allwrite 
View: 
//target/external/... //target-trans/...
# 
• Written in Python (2.6+ and 3.3+) using P4Python 
• Makes use of P4::Map and P4::Resolver 
– Use Map instead of “p4 where” 
– Resolver allows scripting of resolve results
# 
counter = getCounter() 
changes = p4 –p source changes ...@counter,#head 
for change in changes: 
filterChangeByClientView(change) 
p4 –p source sync 
if add: p4 –p target add 
if delete: p4 –p target delete -v 
if edit: p4 –p target sync –k ; p4 –p target edit 
if move: p4 –p target sync –f old; p4 –p target edit old; p4 –p target move old new 
integrate?
# 
• Integrations within workspace view are transferred 
– Resolve records match source records (details later) 
• Integrations from outside the view are downgraded 
– integrate  add/edit/delete 
• Use P4::Resolver to preserve resolve outcome
# 
Client: src-trans 
View: 
//depot/inside/... //src-trans/... 
Client: target-trans 
View: 
//target/... //target-trans/...
# 
• usage: P4Transfer.py [-h] [-n] [-c CONFIG] [-m MAXIMUM] [-k] [-p] [-r] [-s] 
• [--sample_config] [-i] 
• P4Transfer 
• optional arguments: 
• -h, --help show this help message and exit 
• -n, --preview Preview only, no transfer 
• -c CONFIG, --config CONFIG Default is transfer.cfg 
• -m MAXIMUM, --maximum MAXIMUM Maximum number of changes to transfer 
• -k, --nokeywords Do not expand keywords and remove +k from filetype 
• -p, --preflight Run a sanity check first to ensure target is empty 
• -r, --repeat Repeat transfer in a loop - for continuous transfer 
• -s, --stoponerror Stop on any error even if --repeat has been specified 
• --sample_config Print an example config file and exit 
• -i, --ignore Treat integrations as adds and edits
# 
• [general] 
• counter_name = p4transfer_counter 
• [source] 
• p4port = source.perforce.com:1666 
• p4user = sknop 
• p4client = source_transfer 
• [target] 
• p4port = target.perforce.com:1777 
• p4user = sknop 
• p4client = target_transfer 
P4Transfer.py --sample_config
# 
• How do we test P4Transfer with two servers? 
• Use the “rsh trick” 
– Spawn a local p4d but without consuming port 
P4PORT=rsh:/bin/p4d -r /path/to/target.root –i 
• Tests: 
– Inject changes into source 
– Transfer 
– Verify result in target
#
# 
• Experience based on source code migrations 
– which can take days 
• We want to keep an eye on things 
– But have a life at the same time  
• Reliability/robustness in the face of 
(communication) errors 
• Status / Error reporting to support the above
# 
• Customer working with multiple third parties 
• Provide some level of backup/DR 
• Limited access to remote repositories 
– Replicas considered but rejected 
– Basically only read-only access 
• Data size/connectivity issues
# 
• Volume / connectivity bandwidth 
– 280 Gb of data 
• Seeding via offline backup would have been ideal 
– 1Gb per hour transfer rate 
– Single (early) changelist ~120Gb! 
• We wanted 
– Handle/report VPN disconnects 
– Peace of mind…!
# 
• Use standard Python logging module 
– Subclass for custom behavior 
– Beware of Python 2.x/3.x compatibility issues 
• Custom logging enhancements 
– Use circular buffer to remember last 50 lines 
– Automatically notify users via email, including those 
lines
# 
Transferring 16 changes 
Syncing 16 changes, files 5375, size 11.2 GB 
Processing : 87370 "Removed unused physx files from 
filelist." 
source = 87370 : target = 460 
Processing : 87377 "Copying //depot/stable to live 
(//depot/live) various hotfixes" 
source = 87377 : target = 461 
Synced 8/16 changes, files 676/5375 (12.6 %), size 482.8 
MB/11.2 GB (4.3 %) 
Synced 8/16 changes, files 940/5375 (17.5 %), size 1.2 
GB/11.2 GB (10.7 %)
# 
• P4API / P4Python has callback options 
# Report status per change 
self.progress.ReportChangeSync() 
# Create a custom callback object (next slide) 
mycallback = SyncOutput(self.progress) 
# Pass it to the P4 sync command 
self.p4.run('sync', '...@{},{}'.format(change, change), handler=mycallback )
# 
class SyncOutput(P4.OutputHandler): 
def __init__(self, progress): 
P4.OutputHandler.__init__(self) 
self.progress = progress # Save reporting object 
def outputStat(self, stat): # Function called by P4API 
if 'fileSize' in stat: 
# Report how much data synced for current file 
self.progress.ReportFileSync(int(stat['fileSize'])) 
return P4.OutputHandler.HANDLED
# 
• What happens when the Dragon King is: 
– Der Drachenkönig.jpg 
• Windows servers (not in Unicode mode) handle 
(some) Unicode filenames happily 
– no P4CHARSET required, but… 
• On Mac/Unix - UTF8 does the job 
• On Windows: 
– Python 2.7 fine / Python 3.x requires work…
# 
• On Windows run as a service 
– Install: srvcinst.exe 
– Run service: srvany.exe (or other equivalents)
# 
• Basic algorithm unchanged 
– Fixed a couple of bugs 
– TDD => Test Harness 
• Added repeat/polling options 
• Enhanced Robustness 
– Logging / Status reporting 
– Error handling
# 
Sven Erik Knop 
sknop@perforce.com 
Robert Cowham 
rcowham@perforce.com 
@robertcowham
# 
RESOURCES 
Public Depot: 
swarm.workshop.perforce.com/projects/perforce-software-p4transfer/

More Related Content

What's hot

What's hot (20)

「Helix Core」導入事例紹介 『小~中規模事例 "Unreal Engine 4 × Helix Core ヒストリア運用レギュレーション紹介"』
「Helix Core」導入事例紹介 『小~中規模事例 "Unreal Engine 4 × Helix Core ヒストリア運用レギュレーション紹介"』「Helix Core」導入事例紹介 『小~中規模事例 "Unreal Engine 4 × Helix Core ヒストリア運用レギュレーション紹介"』
「Helix Core」導入事例紹介 『小~中規模事例 "Unreal Engine 4 × Helix Core ヒストリア運用レギュレーション紹介"』
 
【Unite 2018 Tokyo】そろそろ楽がしたい!新アセットバンドルワークフロー&リソースマネージャー詳細解説
【Unite 2018 Tokyo】そろそろ楽がしたい!新アセットバンドルワークフロー&リソースマネージャー詳細解説【Unite 2018 Tokyo】そろそろ楽がしたい!新アセットバンドルワークフロー&リソースマネージャー詳細解説
【Unite 2018 Tokyo】そろそろ楽がしたい!新アセットバンドルワークフロー&リソースマネージャー詳細解説
 
CEDEC2016: Unreal Engine 4 のレンダリングフロー総おさらい
CEDEC2016: Unreal Engine 4 のレンダリングフロー総おさらいCEDEC2016: Unreal Engine 4 のレンダリングフロー総おさらい
CEDEC2016: Unreal Engine 4 のレンダリングフロー総おさらい
 
【UE4.25 新機能】ロードの高速化機能「IOStore」について
【UE4.25 新機能】ロードの高速化機能「IOStore」について【UE4.25 新機能】ロードの高速化機能「IOStore」について
【UE4.25 新機能】ロードの高速化機能「IOStore」について
 
UE4でAIとビヘイビアツリーと-基礎-
UE4でAIとビヘイビアツリーと-基礎-UE4でAIとビヘイビアツリーと-基礎-
UE4でAIとビヘイビアツリーと-基礎-
 
なぜなにFProperty - 対応方法と改善点 -
なぜなにFProperty - 対応方法と改善点 -なぜなにFProperty - 対応方法と改善点 -
なぜなにFProperty - 対応方法と改善点 -
 
UE4 MultiPlayer Online Deep Dive 実践編2 (ソレイユ株式会社様ご講演) #UE4DD
UE4 MultiPlayer Online Deep Dive 実践編2 (ソレイユ株式会社様ご講演) #UE4DDUE4 MultiPlayer Online Deep Dive 実践編2 (ソレイユ株式会社様ご講演) #UE4DD
UE4 MultiPlayer Online Deep Dive 実践編2 (ソレイユ株式会社様ご講演) #UE4DD
 
UE4 MultiPlayer Online Deep Dive 基礎編2 -Traveling- (historia様ご講演) #ue4dd
UE4 MultiPlayer Online Deep Dive 基礎編2 -Traveling-  (historia様ご講演)  #ue4ddUE4 MultiPlayer Online Deep Dive 基礎編2 -Traveling-  (historia様ご講演)  #ue4dd
UE4 MultiPlayer Online Deep Dive 基礎編2 -Traveling- (historia様ご講演) #ue4dd
 
はりぼて OS で ELF なアプリを起動してみた
はりぼて OS で ELF なアプリを起動してみたはりぼて OS で ELF なアプリを起動してみた
はりぼて OS で ELF なアプリを起動してみた
 
初心者向け UE4 映像制作での シーケンサー と Movie Render Queue の使い方
初心者向け UE4 映像制作での シーケンサー と Movie Render Queue の使い方初心者向け UE4 映像制作での シーケンサー と Movie Render Queue の使い方
初心者向け UE4 映像制作での シーケンサー と Movie Render Queue の使い方
 
UE4 MultiPlayer Online Deep Dive: 実践編1 (Byking様ご講演) #UE4DD
UE4 MultiPlayer Online Deep Dive: 実践編1 (Byking様ご講演)  #UE4DDUE4 MultiPlayer Online Deep Dive: 実践編1 (Byking様ご講演)  #UE4DD
UE4 MultiPlayer Online Deep Dive: 実践編1 (Byking様ご講演) #UE4DD
 
UE4のモバイル開発におけるコンテンツアップデートの話 - Chunk IDとの激闘編 -
UE4のモバイル開発におけるコンテンツアップデートの話 - Chunk IDとの激闘編 -UE4のモバイル開発におけるコンテンツアップデートの話 - Chunk IDとの激闘編 -
UE4のモバイル開発におけるコンテンツアップデートの話 - Chunk IDとの激闘編 -
 
猫でも分かる Control Rig UE4.25 版
猫でも分かる Control Rig UE4.25 版猫でも分かる Control Rig UE4.25 版
猫でも分かる Control Rig UE4.25 版
 
Online MultiPlay Game Design
Online MultiPlay Game DesignOnline MultiPlay Game Design
Online MultiPlay Game Design
 
わからないまま使っている?UE4 の AI の基本的なこと
わからないまま使っている?UE4 の AI の基本的なことわからないまま使っている?UE4 の AI の基本的なこと
わからないまま使っている?UE4 の AI の基本的なこと
 
UE4ローカライズ事例 (UE4 Localization Deep Dive)
UE4ローカライズ事例 (UE4 Localization Deep Dive)UE4ローカライズ事例 (UE4 Localization Deep Dive)
UE4ローカライズ事例 (UE4 Localization Deep Dive)
 
UE4とUnrealC++について
UE4とUnrealC++についてUE4とUnrealC++について
UE4とUnrealC++について
 
[IGF2018] UE4でAndroidアプリを開発する際に知っておきたいパフォーマンス改善テクニック + INDIE GAMES FESTIVAL 2...
[IGF2018] UE4でAndroidアプリを開発する際に知っておきたいパフォーマンス改善テクニック + INDIE GAMES FESTIVAL 2...[IGF2018] UE4でAndroidアプリを開発する際に知っておきたいパフォーマンス改善テクニック + INDIE GAMES FESTIVAL 2...
[IGF2018] UE4でAndroidアプリを開発する際に知っておきたいパフォーマンス改善テクニック + INDIE GAMES FESTIVAL 2...
 
UE4.25 Update - Unreal Insights -
UE4.25 Update - Unreal Insights -UE4.25 Update - Unreal Insights -
UE4.25 Update - Unreal Insights -
 
脱! 俺たちは雰囲気でBPをいじっている
脱! 俺たちは雰囲気でBPをいじっている脱! 俺たちは雰囲気でBPをいじっている
脱! 俺たちは雰囲気でBPをいじっている
 

Viewers also liked

Thong bao thi tuyen chuc danh 2015
Thong bao thi tuyen chuc danh 2015Thong bao thi tuyen chuc danh 2015
Thong bao thi tuyen chuc danh 2015
tuyencongchuc
 
Thesis Project Luke Morton 2016
Thesis Project Luke Morton 2016Thesis Project Luke Morton 2016
Thesis Project Luke Morton 2016
Luke Morton
 
2 2-making greatdecisions
2 2-making greatdecisions2 2-making greatdecisions
2 2-making greatdecisions
uploadlessons
 
Managing stress levels
Managing stress levelsManaging stress levels
Managing stress levels
OMODAN ISIBOR
 

Viewers also liked (16)

Thong bao thi tuyen chuc danh 2015
Thong bao thi tuyen chuc danh 2015Thong bao thi tuyen chuc danh 2015
Thong bao thi tuyen chuc danh 2015
 
Document Freedom Day & Mongo Summer Festival 2014 / DFDと納涼もんご祭り2014の宣伝
Document Freedom Day & Mongo Summer Festival 2014 / DFDと納涼もんご祭り2014の宣伝Document Freedom Day & Mongo Summer Festival 2014 / DFDと納涼もんご祭り2014の宣伝
Document Freedom Day & Mongo Summer Festival 2014 / DFDと納涼もんご祭り2014の宣伝
 
doshkolenok
 doshkolenok doshkolenok
doshkolenok
 
Prospectiva
ProspectivaProspectiva
Prospectiva
 
Cien consejos para ganar elecciones
Cien consejos para ganar eleccionesCien consejos para ganar elecciones
Cien consejos para ganar elecciones
 
InvestHK - Services for Indian businesses
InvestHK - Services for Indian businessesInvestHK - Services for Indian businesses
InvestHK - Services for Indian businesses
 
#IT fest 2013 - Co to jest RWD? I kiedy warto myśleć o nim w kontekście aplik...
#IT fest 2013 - Co to jest RWD? I kiedy warto myśleć o nim w kontekście aplik...#IT fest 2013 - Co to jest RWD? I kiedy warto myśleć o nim w kontekście aplik...
#IT fest 2013 - Co to jest RWD? I kiedy warto myśleć o nim w kontekście aplik...
 
One Library Per Village
One Library Per Village One Library Per Village
One Library Per Village
 
Primary vlan
Primary vlanPrimary vlan
Primary vlan
 
Thesis Project Luke Morton 2016
Thesis Project Luke Morton 2016Thesis Project Luke Morton 2016
Thesis Project Luke Morton 2016
 
Industrial Attachment Program (IAP) Report
Industrial Attachment Program (IAP) ReportIndustrial Attachment Program (IAP) Report
Industrial Attachment Program (IAP) Report
 
Sasha latypovaonprospectingforstartups
Sasha latypovaonprospectingforstartupsSasha latypovaonprospectingforstartups
Sasha latypovaonprospectingforstartups
 
Translation #9 cello poem no.3 (chinese and malay)
Translation #9 cello poem no.3 (chinese and malay)Translation #9 cello poem no.3 (chinese and malay)
Translation #9 cello poem no.3 (chinese and malay)
 
Samsung EP96-02787B
Samsung EP96-02787BSamsung EP96-02787B
Samsung EP96-02787B
 
2 2-making greatdecisions
2 2-making greatdecisions2 2-making greatdecisions
2 2-making greatdecisions
 
Managing stress levels
Managing stress levelsManaging stress levels
Managing stress levels
 

Similar to Transferring Changes Between Perforce Servers

[MathWorks] Versioning Infrastructure
[MathWorks] Versioning Infrastructure[MathWorks] Versioning Infrastructure
[MathWorks] Versioning Infrastructure
Perforce
 
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdfHashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
ssuser705051
 

Similar to Transferring Changes Between Perforce Servers (20)

LAB - Perforce Large Scale & Multi-Site Implementations
LAB - Perforce Large Scale & Multi-Site ImplementationsLAB - Perforce Large Scale & Multi-Site Implementations
LAB - Perforce Large Scale & Multi-Site Implementations
 
Five Real-World Strategies for Perforce Streams
Five Real-World Strategies for Perforce StreamsFive Real-World Strategies for Perforce Streams
Five Real-World Strategies for Perforce Streams
 
Perforce Administration: Optimization, Scalability, Availability and Reliability
Perforce Administration: Optimization, Scalability, Availability and ReliabilityPerforce Administration: Optimization, Scalability, Availability and Reliability
Perforce Administration: Optimization, Scalability, Availability and Reliability
 
3 Ways to Improve Performance from a Storage Perspective
3 Ways to Improve Performance from a Storage Perspective3 Ways to Improve Performance from a Storage Perspective
3 Ways to Improve Performance from a Storage Perspective
 
[MathWorks] Versioning Infrastructure
[MathWorks] Versioning Infrastructure[MathWorks] Versioning Infrastructure
[MathWorks] Versioning Infrastructure
 
LAB - Component Based Development
LAB - Component Based DevelopmentLAB - Component Based Development
LAB - Component Based Development
 
Multi-Site Perforce at NetApp
Multi-Site Perforce at NetAppMulti-Site Perforce at NetApp
Multi-Site Perforce at NetApp
 
Using R on High Performance Computers
Using R on High Performance ComputersUsing R on High Performance Computers
Using R on High Performance Computers
 
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
 
White Paper: Perforce Administration Optimization, Scalability, Availability ...
White Paper: Perforce Administration Optimization, Scalability, Availability ...White Paper: Perforce Administration Optimization, Scalability, Availability ...
White Paper: Perforce Administration Optimization, Scalability, Availability ...
 
Application Caching: The Hidden Microservice (SAConf)
Application Caching: The Hidden Microservice (SAConf)Application Caching: The Hidden Microservice (SAConf)
Application Caching: The Hidden Microservice (SAConf)
 
Graphing Nagios services with pnp4nagios
Graphing Nagios services with pnp4nagiosGraphing Nagios services with pnp4nagios
Graphing Nagios services with pnp4nagios
 
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdfHashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
 
Terraform-2.pdf
Terraform-2.pdfTerraform-2.pdf
Terraform-2.pdf
 
Scaling Servers and Storage for Film Assets
Scaling Servers and Storage for Film Assets  Scaling Servers and Storage for Film Assets
Scaling Servers and Storage for Film Assets
 
Comparative Performance Analysis of AWS EC2 Instance Types Commonly Used for ...
Comparative Performance Analysis of AWS EC2 Instance Types Commonly Used for ...Comparative Performance Analysis of AWS EC2 Instance Types Commonly Used for ...
Comparative Performance Analysis of AWS EC2 Instance Types Commonly Used for ...
 
From Windows to Linux: Converting a Distributed Perforce Helix Infrastructure
From Windows to Linux: Converting a Distributed Perforce Helix InfrastructureFrom Windows to Linux: Converting a Distributed Perforce Helix Infrastructure
From Windows to Linux: Converting a Distributed Perforce Helix Infrastructure
 
Extending OpenShift Origin: Build Your Own Cartridge with Bill DeCoste of Red...
Extending OpenShift Origin: Build Your Own Cartridge with Bill DeCoste of Red...Extending OpenShift Origin: Build Your Own Cartridge with Bill DeCoste of Red...
Extending OpenShift Origin: Build Your Own Cartridge with Bill DeCoste of Red...
 
Lcna tutorial-2012
Lcna tutorial-2012Lcna tutorial-2012
Lcna tutorial-2012
 
Lcna 2012-tutorial
Lcna 2012-tutorialLcna 2012-tutorial
Lcna 2012-tutorial
 

More from Perforce

More from Perforce (20)

How to Organize Game Developers With Different Planning Needs
How to Organize Game Developers With Different Planning NeedsHow to Organize Game Developers With Different Planning Needs
How to Organize Game Developers With Different Planning Needs
 
Regulatory Traceability: How to Maintain Compliance, Quality, and Cost Effic...
Regulatory Traceability:  How to Maintain Compliance, Quality, and Cost Effic...Regulatory Traceability:  How to Maintain Compliance, Quality, and Cost Effic...
Regulatory Traceability: How to Maintain Compliance, Quality, and Cost Effic...
 
Efficient Security Development and Testing Using Dynamic and Static Code Anal...
Efficient Security Development and Testing Using Dynamic and Static Code Anal...Efficient Security Development and Testing Using Dynamic and Static Code Anal...
Efficient Security Development and Testing Using Dynamic and Static Code Anal...
 
Understanding Compliant Workflow Enforcement SOPs
Understanding Compliant Workflow Enforcement SOPsUnderstanding Compliant Workflow Enforcement SOPs
Understanding Compliant Workflow Enforcement SOPs
 
Branching Out: How To Automate Your Development Process
Branching Out: How To Automate Your Development ProcessBranching Out: How To Automate Your Development Process
Branching Out: How To Automate Your Development Process
 
How to Do Code Reviews at Massive Scale For DevOps
How to Do Code Reviews at Massive Scale For DevOpsHow to Do Code Reviews at Massive Scale For DevOps
How to Do Code Reviews at Massive Scale For DevOps
 
How to Spark Joy In Your Product Backlog
How to Spark Joy In Your Product Backlog How to Spark Joy In Your Product Backlog
How to Spark Joy In Your Product Backlog
 
Going Remote: Build Up Your Game Dev Team
Going Remote: Build Up Your Game Dev Team Going Remote: Build Up Your Game Dev Team
Going Remote: Build Up Your Game Dev Team
 
Shift to Remote: How to Manage Your New Workflow
Shift to Remote: How to Manage Your New WorkflowShift to Remote: How to Manage Your New Workflow
Shift to Remote: How to Manage Your New Workflow
 
Hybrid Development Methodology in a Regulated World
Hybrid Development Methodology in a Regulated WorldHybrid Development Methodology in a Regulated World
Hybrid Development Methodology in a Regulated World
 
Better, Faster, Easier: How to Make Git Really Work in the Enterprise
Better, Faster, Easier: How to Make Git Really Work in the EnterpriseBetter, Faster, Easier: How to Make Git Really Work in the Enterprise
Better, Faster, Easier: How to Make Git Really Work in the Enterprise
 
Easier Requirements Management Using Diagrams In Helix ALM
Easier Requirements Management Using Diagrams In Helix ALMEasier Requirements Management Using Diagrams In Helix ALM
Easier Requirements Management Using Diagrams In Helix ALM
 
How To Master Your Mega Backlog
How To Master Your Mega Backlog How To Master Your Mega Backlog
How To Master Your Mega Backlog
 
Achieving Software Safety, Security, and Reliability Part 3: What Does the Fu...
Achieving Software Safety, Security, and Reliability Part 3: What Does the Fu...Achieving Software Safety, Security, and Reliability Part 3: What Does the Fu...
Achieving Software Safety, Security, and Reliability Part 3: What Does the Fu...
 
How to Scale With Helix Core and Microsoft Azure
How to Scale With Helix Core and Microsoft Azure How to Scale With Helix Core and Microsoft Azure
How to Scale With Helix Core and Microsoft Azure
 
Achieving Software Safety, Security, and Reliability Part 2
Achieving Software Safety, Security, and Reliability Part 2Achieving Software Safety, Security, and Reliability Part 2
Achieving Software Safety, Security, and Reliability Part 2
 
Should You Break Up With Your Monolith?
Should You Break Up With Your Monolith?Should You Break Up With Your Monolith?
Should You Break Up With Your Monolith?
 
Achieving Software Safety, Security, and Reliability Part 1: Common Industry ...
Achieving Software Safety, Security, and Reliability Part 1: Common Industry ...Achieving Software Safety, Security, and Reliability Part 1: Common Industry ...
Achieving Software Safety, Security, and Reliability Part 1: Common Industry ...
 
What's New in Helix ALM 2019.4
What's New in Helix ALM 2019.4What's New in Helix ALM 2019.4
What's New in Helix ALM 2019.4
 
Free Yourself From the MS Office Prison
Free Yourself From the MS Office Prison Free Yourself From the MS Office Prison
Free Yourself From the MS Office Prison
 

Recently uploaded

Recently uploaded (20)

AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 

Transferring Changes Between Perforce Servers

  • 1. # Sven Erik Technical Marketing Robert Cowham Professional Services
  • 2. # • Background • Algorithm • Configuration • Adapting for continuous transfer • Customer Case Study
  • 3. # Author of P4Python. Started as Lead Consultant at Perforce. Regular presenter at Perforce and other conferences. API experience includes P4OFC (P4COM) and P4Python. Author of 'Learning Perforce SCM' by PACKT Publishing, Sep 2013.
  • 4. #
  • 5. # • One project in two separate Perforce Servers? – e.g. Public Depot and Master Depot Source P4D Target P4D ?
  • 6. # • Git? SHAs do not match. • Sandbox? Can only talk to one server. • Replication? Not practical. • Reconcile? Changes? Integrations? • Replay changes one by one ... ?
  • 7. # • Transfer workspace sharing the same root Source Target transfer
  • 8. # • One workspace on each server with shared root • Client views have to match – Depot views don’t have to match – Filter projects you want to transfer • Need to set options to allwrite Client: src-trans Root: /Users/sknop/perforce/transfer Options: allwrite View: //source/project1/... //src-trans/... Client: target-trans Root: /Users/sknop/perforce/transfer Options: allwrite View: //target/external/... //target-trans/...
  • 9. # • Written in Python (2.6+ and 3.3+) using P4Python • Makes use of P4::Map and P4::Resolver – Use Map instead of “p4 where” – Resolver allows scripting of resolve results
  • 10. # counter = getCounter() changes = p4 –p source changes ...@counter,#head for change in changes: filterChangeByClientView(change) p4 –p source sync if add: p4 –p target add if delete: p4 –p target delete -v if edit: p4 –p target sync –k ; p4 –p target edit if move: p4 –p target sync –f old; p4 –p target edit old; p4 –p target move old new integrate?
  • 11. # • Integrations within workspace view are transferred – Resolve records match source records (details later) • Integrations from outside the view are downgraded – integrate  add/edit/delete • Use P4::Resolver to preserve resolve outcome
  • 12. # Client: src-trans View: //depot/inside/... //src-trans/... Client: target-trans View: //target/... //target-trans/...
  • 13. # • usage: P4Transfer.py [-h] [-n] [-c CONFIG] [-m MAXIMUM] [-k] [-p] [-r] [-s] • [--sample_config] [-i] • P4Transfer • optional arguments: • -h, --help show this help message and exit • -n, --preview Preview only, no transfer • -c CONFIG, --config CONFIG Default is transfer.cfg • -m MAXIMUM, --maximum MAXIMUM Maximum number of changes to transfer • -k, --nokeywords Do not expand keywords and remove +k from filetype • -p, --preflight Run a sanity check first to ensure target is empty • -r, --repeat Repeat transfer in a loop - for continuous transfer • -s, --stoponerror Stop on any error even if --repeat has been specified • --sample_config Print an example config file and exit • -i, --ignore Treat integrations as adds and edits
  • 14. # • [general] • counter_name = p4transfer_counter • [source] • p4port = source.perforce.com:1666 • p4user = sknop • p4client = source_transfer • [target] • p4port = target.perforce.com:1777 • p4user = sknop • p4client = target_transfer P4Transfer.py --sample_config
  • 15. # • How do we test P4Transfer with two servers? • Use the “rsh trick” – Spawn a local p4d but without consuming port P4PORT=rsh:/bin/p4d -r /path/to/target.root –i • Tests: – Inject changes into source – Transfer – Verify result in target
  • 16. #
  • 17. # • Experience based on source code migrations – which can take days • We want to keep an eye on things – But have a life at the same time  • Reliability/robustness in the face of (communication) errors • Status / Error reporting to support the above
  • 18. # • Customer working with multiple third parties • Provide some level of backup/DR • Limited access to remote repositories – Replicas considered but rejected – Basically only read-only access • Data size/connectivity issues
  • 19. # • Volume / connectivity bandwidth – 280 Gb of data • Seeding via offline backup would have been ideal – 1Gb per hour transfer rate – Single (early) changelist ~120Gb! • We wanted – Handle/report VPN disconnects – Peace of mind…!
  • 20. # • Use standard Python logging module – Subclass for custom behavior – Beware of Python 2.x/3.x compatibility issues • Custom logging enhancements – Use circular buffer to remember last 50 lines – Automatically notify users via email, including those lines
  • 21. # Transferring 16 changes Syncing 16 changes, files 5375, size 11.2 GB Processing : 87370 "Removed unused physx files from filelist." source = 87370 : target = 460 Processing : 87377 "Copying //depot/stable to live (//depot/live) various hotfixes" source = 87377 : target = 461 Synced 8/16 changes, files 676/5375 (12.6 %), size 482.8 MB/11.2 GB (4.3 %) Synced 8/16 changes, files 940/5375 (17.5 %), size 1.2 GB/11.2 GB (10.7 %)
  • 22. # • P4API / P4Python has callback options # Report status per change self.progress.ReportChangeSync() # Create a custom callback object (next slide) mycallback = SyncOutput(self.progress) # Pass it to the P4 sync command self.p4.run('sync', '...@{},{}'.format(change, change), handler=mycallback )
  • 23. # class SyncOutput(P4.OutputHandler): def __init__(self, progress): P4.OutputHandler.__init__(self) self.progress = progress # Save reporting object def outputStat(self, stat): # Function called by P4API if 'fileSize' in stat: # Report how much data synced for current file self.progress.ReportFileSync(int(stat['fileSize'])) return P4.OutputHandler.HANDLED
  • 24. # • What happens when the Dragon King is: – Der Drachenkönig.jpg • Windows servers (not in Unicode mode) handle (some) Unicode filenames happily – no P4CHARSET required, but… • On Mac/Unix - UTF8 does the job • On Windows: – Python 2.7 fine / Python 3.x requires work…
  • 25. # • On Windows run as a service – Install: srvcinst.exe – Run service: srvany.exe (or other equivalents)
  • 26. # • Basic algorithm unchanged – Fixed a couple of bugs – TDD => Test Harness • Added repeat/polling options • Enhanced Robustness – Logging / Status reporting – Error handling
  • 27. # Sven Erik Knop sknop@perforce.com Robert Cowham rcowham@perforce.com @robertcowham
  • 28. # RESOURCES Public Depot: swarm.workshop.perforce.com/projects/perforce-software-p4transfer/

Editor's Notes

  1. JournalReader started in the public depot, but needed to be kept in sync with the master depot.
  2. Configuration options to decide how frequently to report, e.g. every 0.5 Gb – depends on connectivity speed.
  3. Main difference is that Python 3 all strings are unicode
  4. Didn’t have to do too much for the customization As all these things, the devil is in the details
  5. Didn’t have to do too much for the customization As all these things, the devil is in the details