Skip to content

Commit

Permalink
Fix errors with SQL constraints for rmt-Journal records
Browse files Browse the repository at this point in the history
Note this may create problems when parsing older p4d logs which
did not have completion records for rmt-Journal.
  • Loading branch information
rcowham committed Aug 23, 2024
1 parent 9659e4c commit 7dce8d2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion p4dlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -1277,7 +1277,7 @@ func (fp *P4dFileParser) addCommand(newCmd *Command, hasTrackInfo bool) {
func cmdHasNoCompletionRecord(cmdName string) bool {
return cmdName == "rmt-FileFetch" ||
cmdName == "rmt-FileFetchMulti" ||
cmdName == "rmt-Journal" ||
// cmdName == "rmt-Journal" ||
cmdName == "rmt-JournalPos" ||
cmdName == "pull"
}
Expand Down
4 changes: 2 additions & 2 deletions p4dlog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -958,9 +958,9 @@ Perforce server info:
output := parseLogLines(testInput)
assert.Equal(t, 3, len(output))
//assert.Equal(t, "", output[2])
assert.JSONEq(t, cleanJSON(`{"processKey":"b9ec8da8ea642419a06f8ac4060f261c","cmd":"rmt-Journal","pid":17916,"lineNo":4,"user":"svc_p4d_ha_chi","workspace":"unknown","completedLapse":0.202,"ip":"10.5.70.41","app":"p4d/2019.2/LINUX26X86_64/1908095","args":"","startTime":"2020/03/11 06:08:16","endTime":"2020/03/11 06:08:16","running":1,"rpcMsgsOut":1,"rpcHimarkFwd":280100,"rpcHimarkRev":278660,"cmdError":false,"tables":[{"tableName":"counters","pagesIn":6,"pagesCached":2,"readLocks":6,"getRows":6}]}`),
assert.JSONEq(t, cleanJSON(`{"processKey":"b9ec8da8ea642419a06f8ac4060f261c","cmd":"rmt-Journal","pid":17916,"lineNo":4,"user":"svc_p4d_ha_chi","workspace":"unknown","completedLapse":0.202,"ip":"10.5.70.41","app":"p4d/2019.2/LINUX26X86_64/1908095","args":"","startTime":"2020/03/11 06:08:16","endTime":"2020/03/11 06:08:16","running":2,"rpcMsgsOut":1,"rpcHimarkFwd":280100,"rpcHimarkRev":278660,"cmdError":false,"tables":[{"tableName":"counters","pagesIn":6,"pagesCached":2,"readLocks":6,"getRows":6}]}`),
cleanJSON(output[0]))
assert.JSONEq(t, cleanJSON(`{"processKey":"b9ec8da8ea642419a06f8ac4060f261c.12","cmd":"rmt-Journal","pid":17916,"lineNo":12,"user":"svc_p4d_ha_chi","workspace":"unknown","completedLapse":0.001,"ip":"10.5.70.41","app":"p4d/2019.2/LINUX26X86_64/1908095","args":"","startTime":"2020/03/11 06:08:16","endTime":"2020/03/11 06:08:16","running":1,"rpcMsgsOut":1,"rpcHimarkFwd":280100,"rpcHimarkRev":278660,"cmdError":false,"tables":[{"tableName":"counters","pagesIn":1,"pagesCached":2,"readLocks":1,"getRows":1}]}`),
assert.JSONEq(t, cleanJSON(`{"processKey":"b9ec8da8ea642419a06f8ac4060f261c.12","cmd":"rmt-Journal","pid":17916,"lineNo":12,"user":"svc_p4d_ha_chi","workspace":"unknown","completedLapse":0.001,"ip":"10.5.70.41","app":"p4d/2019.2/LINUX26X86_64/1908095","args":"","startTime":"2020/03/11 06:08:16","endTime":"2020/03/11 06:08:16","running":2,"rpcMsgsOut":1,"rpcHimarkFwd":280100,"rpcHimarkRev":278660,"cmdError":false,"tables":[{"tableName":"counters","pagesIn":1,"pagesCached":2,"readLocks":1,"getRows":1}]}`),
cleanJSON(output[1]))
assert.JSONEq(t, cleanJSON(`{"processKey":"b9f9aee10027df004a0e35a3c9931e27","cmd":"user-change","pid":15855,"lineNo":2,"user":"fred","workspace":"fred_ws","completedLapse":0.276,"ip":"10.1.4.213/10.1.3.243","app":"Helix P4V/NTX64/2019.2/1904275/v86","args":"-i","startTime":"2020/03/11 06:08:16","endTime":"2020/03/11 06:08:17","running":1,"uCpu":4,"sCpu":4,"diskIn":256,"diskOut":240,"maxRss":9212,"rpcMsgsIn":3,"rpcMsgsOut":5,"rpcHimarkFwd":280100,"rpcHimarkRev":280100,"rpcRcv":0.19,"cmdError":false,"tables":[{"tableName":"counters","pagesIn":7,"pagesOut":6,"pagesCached":2,"readLocks":1,"writeLocks":2,"getRows":3,"putRows":2},{"tableName":"monitor","pagesIn":2,"pagesOut":4,"pagesCached":256,"writeLocks":2,"putRows":2},{"tableName":"protect","pagesIn":9,"pagesCached":7,"readLocks":1,"posRows":1,"scanRows":345,"peekCount":1},{"tableName":"storagemasterup_R","totalReadWait":1,"totalReadHeld":2,"totalWriteWait":3,"totalWriteHeld":4},{"tableName":"storageup_R","totalReadWait":1,"totalReadHeld":2,"totalWriteWait":3,"totalWriteHeld":4},{"tableName":"trigger_swarm.changesave","triggerLapse":0.076}]}`),
cleanJSON(output[2]))
Expand Down

0 comments on commit 7dce8d2

Please sign in to comment.