Add a flyweight copy() to SwhGraphProperties to make it threadsafe
3 unresolved threads
3 unresolved threads
Merge request reports
Activity
Build is green
Patch application report for D8191 (id=29562)
Rebasing onto 555e3b6d...
Current branch diff-target is up to date.
Changes applied before test
commit 66e94bc43d9e3ba4323b71166082c04672bc1388 Author: Antoine Pietri <antoine.pietri1@gmail.com> Date: Thu Aug 4 18:06:10 2022 +0200 Add a flyweight copy() to SwhGraphProperties to make it threadsafe
See https://jenkins.softwareheritage.org/job/DGRPH/job/tests-on-diff/214/ for more details.
48 50 } 49 51 } 50 52 53 public NodeTypesMap(LongBigList nodeTypesMap) { 54 this.nodeTypesMap = nodeTypesMap; 55 } 56 57 @Override 58 public NodeTypesMap copy() { 59 return new NodeTypesMap( 60 (nodeTypesMap instanceof LongMappedBigList) ? ((LongMappedBigList) nodeTypesMap).copy() : nodeTypesMap); 61 } 150 150 @Override 151 151 public SwhUnidirectionalGraph copy() { 152 152 return new SwhUnidirectionalGraph(this.graph.copy(), 153 this.labelledGraph != null ? this.labelledGraph.copy() : null, this.properties); 153 this.labelledGraph != null ? this.labelledGraph.copy() : null, this.properties.copy()); I'm not sure it matters, but because this.graph can refer to the underlying graph of this.labelledGraph (Line 71, inside loadLabelledGraphOnly), that would result in double-copying. (When you first wrote the copy function, we hadn't yet found the need to assign the underlying to graph) I'm sure it is low overhead, but would it be better to first copy this.labelledGraph and then assign g.g again if labelledGraph exists?
68 69 this.nodeTypesMap = nodeTypesMap; 69 70 } 70 71 72 protected SwhGraphProperties(String path, NodeIdMap nodeIdMap, NodeTypesMap nodeTypesMap, 73 LongBigList authorTimestamp, ShortBigList authorTimestampOffset, LongBigList committerTimestamp, 74 ShortBigList committerTimestampOffset, LongBigList contentLength, LongArrayBitVector contentIsSkipped, 75 IntBigList authorId, IntBigList committerId, ByteBigList messageBuffer, LongBigList messageOffsets, 76 ByteBigList tagNameBuffer, LongBigList tagNameOffsets, MappedFrontCodedStringBigList edgeLabelNames) { 77 this.path = path; 78 this.nodeIdMap = nodeIdMap; 79 this.nodeTypesMap = nodeTypesMap; 80 this.authorTimestamp = authorTimestamp; 81 this.authorTimestampOffset = authorTimestampOffset; 82 this.committerTimestamp = committerTimestamp; 83 this.committerTimestampOffset = committerTimestampOffset; 84 this.contentLength = contentLength; mentioned in issue #4759 (closed)
mentioned in merge request !253 (merged)
Merged via !253 (merged)
Please register or sign in to reply