asxtray commented on issue #144: NIFIREG-209 Rebuild metadata DB from 
FlowPersistenceProvider when emp…
URL: https://github.com/apache/nifi-registry/pull/144#issuecomment-474788717
 
 
   It seems that flow folder(s) (bucket) must be the only top level folders in 
git. Now it grabs the bucket but skips the flows. I had to debug 
GitFlowMetaData to discover the problem. Lines 317, 318:
   `final File flowSnapshotFile = new File(new 
File(backetFilePath).getParent(), flowSnapshotFilename);
   final ObjectId objectId = 
flowSnapshotObjectIds.get(flowSnapshotFile.getPath());`
   It relies on java.io.File object to construct flowSnapshot file git key, but 
the problem is that java.io.File is platform specific and delegates path 
construction to the internal file system abstraction. So for Linux it would be 
bucketName/flowfile.snapshot which is okay but for Windows it would be 
bucketName\flowfile.snapshot and it doesn't match the git key as it's unix 
style. What I did:
   1. Provided bucketDirName as String backetFilePath into loadFlows
   2. Replaced java.io.File manipulations with simple String concatenation:
   `final String flowSnapshotFileGitKey = bucketDirName != null ? 
bucketDirName.concat("/").concat(flowSnapshotFilename) : flowSnapshotFilename;
   final ObjectId objectId = flowSnapshotObjectIds.get(flowSnapshotFileGitKey);`
   
   And that helped. Currently I don't have much time to submit a PR, but if I 
do I will, no guarantees.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to