Closed rishiloyola closed 6 years ago
Hi Valentin, I submitted this request after testing it properly. But somehow I forgot to check whether it is correctly updating the destination's catalog or not.
It is not filling up information related to blocks and files simply because of missing dataset and block parameter's value over here. link I need to pass their values too instead of just passing the file details.
It is successfully passing all the tests for the push model. Proof - link
Rishi, test failed period. It means that you didn't test it fully. We need to support both models, so test should pass for both of them.
Now, I provided you the pointer to wrong if/else if/else statement. It mixed two different conditions, the RouterModel and TransferType. You CANNOT put them in a single if/else if/else statment, it is plain wrong. You may have if RouterMode block where you can check TransferType but you can't mix them up in a single if/else if/else statement.
I don't know if code will work if you'll fill out missing block/dataset info. But as I said you MUST resolve all parameters in RequestTransfer before passing it around to src/dst agents. Agents should just take request and perform action. The request should contains all info about files, blocks, dataset, agent URLs and its aliases, etc.
Let me know when you'll fix all problem that I can review the PR.
Regarding if/else statement,
The logic is
if routerModel == true {
- Resolve request through router for both the model (push or pull model) // roter = true, model = push or pull
} else {
if (model == "pull") {
- resolve request and send it to destination // router = false, model = pull
} else {
- Its push model do not resolve request directly send it to the source. // router = false, model = push
}
}
Instead of writing this way I just combined else
with if
. If you think this can be the flaw or bad coding style then let me know I will shift that condition in else
block instead of writing else if model == "pull"
.
ok, code works now. Please do few things before the merge:
@vkuznet made necessary changes. You can now merge this.
Rishi, please, please test your code BEFORE you submit PR. I already provided a test/run.sh script which does everything. Just use it. I tried to apply your PR and it fails.
It means that your code only transferred files, but it didn't updated properly meta-data, see that block and dataset tables are empty at destination.
The problem seems to be at line 225 of core/request.go where you mixed logic in if statement. Removing that line will fix test/run.sh test.
Please apply requested changes, TEST YOURSELF that it works with the following commands:
and then let me know that I can review this PR again.
Once it is working, I can later take care of code-refactoring.
You may also try to change test/run.sh (see where config files are created) and change router usage. Ultimately, we need to extend test/run.sh to accept third parameter to accept usage of router, e.g.
test/run.sh pull dataset router
will enable router, whiletest/run.sh pull dataset
will run without router (right now router is enabled by default). And, later we can extend test/run.sh to setup another source to provide tests to transfer partial dataset via multiple sources.