dmwm / PHEDEX

CMS data-placement suite
8 stars 18 forks source link

Iss948 #953

Closed alberto-sanchez closed 10 years ago

alberto-sanchez commented 10 years ago

That should change the se_name for node requested, issue #948. If not please do not merge and leave me know m¡to make the appropriate changes.

TonyWildish commented 10 years ago

Hi ALberto,

Thanks for this! I've had a look, and I'm not sure if the SQL is right. I see a condition where br.node_files = b.files, which will only select complete blocks. We may not want to do that, I also see t_xfer_replica in there, and the txfer* tables are not normally used in conditions like this. They're for files that are in transit, and we avoid touching them in contexts other than the actual transfers.

If I look at the FileReplicas API, and tease apart the SQL, I think the query below will do the job. Can you please try and see if it works for you? It actually returns the same number of files for your site, but it may not for others, I don't know.

You can use the FileReplicas API for a cross-reference, if you feel keen :-) Maybe check a few T3 sites, since they won't have so many files, and it won't put too much load on the database to test with them.

select f.logical_name from t_dps_block b join t_dps_dataset d on b.dataset = d.id join t_dps_file f on f.inblock = b.id join t_adm_node ns on ns.id = f.node join t_dps_block_replica br on br.block = b.id left join t_xfer_replica xr on xr.node = br.node and xr.fileid = f.id left join t_adm_node n on ((br.is_active = 'y' and n.id = xr.node) or (br.is_active = 'n' and n.id = br.node)) where (br.node_files != 0 or br.dest_files != 0) and n.name = :node;

Natalia, it occurs to me only now to ask if we really do want to replace the se_name option with the node name, or if there's a case for supporting both? Can you comment please?

Cheers, Tony.

TonyWildish commented 10 years ago

Oops, just noticed that this pull request has been sitting here for almost 7 months :-( Sorry about that...