Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error "Missing ids" does not provide enough information for debugging #96

Closed
Tracked by #27
jordanpadams opened this issue Jul 13, 2022 · 14 comments
Closed
Tracked by #27
Assignees
Labels
B13.0 bug Something isn't working invalid This doesn't seem right s.medium

Comments

@jordanpadams
Copy link
Member

jordanpadams commented Jul 13, 2022

🐛 Describe the bug

Identified by ATM:

[SUMMARY] Output format: json 
[SUMMARY] Reading configuration from /home/itrejo/jnogrv_1001.cfg
[SUMMARY] Elasticsearch URL: https://search-atm-prod-mkvgzojag2ta65bnotqdpopzju.us-west-2.es.amazonaws.com:443, index: registry
[INFO] Reading registry schema from Elasticsearch
[INFO] Processing bundle directory /PDS/data/anonymous/PDS/data/jnogrv_1001
[INFO] Processing bundle /PDS/data/anonymous/PDS/data/jnogrv_1001/bundle_juno_grav.xml
[INFO] Processing collection /PDS/data/anonymous/PDS/data/jnogrv_1001/DOCUMENT/collection_document.xml
[ERROR] Missing ids

🕵️ Expected behavior

Error message includes much more useful information

📚 Version of Software Used

v3.6.0

🩺 Test Data / Additional context

TBD download from ATM


🦄 Related requirements

⚙️ Engineering Details

Looks like issue is here: https://github.com/NASA-PDS/harvest/blob/main/src/main/java/gov/nasa/pds/harvest/dao/EsRequestBuilder.java#L58

For whatever reason, the software is unable to read the LIDs from the collection inventory.

Tightly coupled with #97

@ramesh-maddegoda
Copy link
Contributor

@jordanpadams, I am wondering if they are using an older version of the harvest.

Because in the latest source code of harvest,

  1. The createSearchIdsRequest(Collection ids, int pageSize) is called by searchIds(Collection ids)

  2. The searchIds(Collection ids) is called by getNonExistingIds(Collection ids)

  3. In getNonExistingIds(Collection ids), there is a check for null and empty IDs and it should not call searchIds(ids), if the IDs are missing.

 public Set<String> getNonExistingIds(Collection<String> ids) throws Exception
    {
        if(ids == null || ids.isEmpty()) return null;
        Response resp = searchIds(ids);

I think in the latest code, this Exception("Missing ids") cannot be thrown, when the IDs are empty or null.

@jordanpadams
Copy link
Member Author

@ramesh-maddegoda copy thanks. Waiting onto he version info to come back from Irma. Stand by.

Thanks for looking into this!

@ramesh-maddegoda
Copy link
Contributor

@tloubrieu-jpl, may be this is another related problem.

In the following code it returns null when (ids == null || ids.isEmpty()).

public Set<String> getNonExistingIds(Collection<String> ids) throws Exception
    {
        if(ids == null || ids.isEmpty()) return null;
        Response resp = searchIds(ids);

        NonExistingIdsResponse idsResp = new NonExistingIdsResponse(ids);
        parser.parseResponse(resp, idsResp);

        return idsResp.getIds();
    }

However, above method is called by idExists(String id) and it is expecting to have a non-null retIds object to call retIds.isEmpty();.

public boolean idExists(String id) throws Exception
    {
        List<String> ids = new ArrayList<>(1);
        ids.add(id);
        
        Collection<String> retIds = getNonExistingIds(ids);
        return retIds.isEmpty();
    }

I think the getNonExistingIds(Collection<String> ids) should return an empty Set<String> instead of null, when (ids == null || ids.isEmpty()).

What do you think?

@jordanpadams
Copy link
Member Author

@ramesh-maddegoda making that change sounds good to me.

@jordanpadams
Copy link
Member Author

@ramesh-maddegoda and maybe we can update that error message to say something like "Error reading bundle/collection references. Verify the bundle is valid prior to loading the data." or something like that?

ramesh-maddegoda added a commit that referenced this issue Jul 21, 2022
… idExists(String id)

UPDATE error message in createSearchIdsRequest() method when ids == null || ids.isEmpty()

Refer to the issue #96
@ramesh-maddegoda
Copy link
Contributor

Created pull request #99 with the changes proposed above.

ramesh-maddegoda added a commit that referenced this issue Jul 22, 2022
… idExists(String id)

ADD InvalidPDS4ProductException (to throw when there is an error reading bundle/collection references)

Refer to the issue #96
jordanpadams pushed a commit that referenced this issue Jul 27, 2022
…eSearchIdsRequest() (#99)

* FIX Possible null pointer exception, when calling retIds.isEmpty() in idExists(String id)
UPDATE error message in createSearchIdsRequest() method when ids == null || ids.isEmpty()

Refer to the issue #96

* FIX Possible null pointer exception, when calling retIds.isEmpty() in idExists(String id)
ADD InvalidPDS4ProductException (to throw when there is an error reading bundle/collection references)

Refer to the issue #96
@jordanpadams
Copy link
Member Author

Closed per #99

@tloubrieu-jpl
Copy link
Member

@gxtchen this need to be tested from the latest snapshot version https://github.com/NASA-PDS/harvest/releases/tag/v3.7.0-SNAPSHOT

@gxtchen
Copy link

gxtchen commented Aug 15, 2022

@jimmie Can you show me how to reproduce this issue? thx.

@jimmie
Copy link

jimmie commented Aug 15, 2022

@ramesh-maddegoda - do you have a test case for this or access to the originally failing ATM dataset?

@ramesh-maddegoda
Copy link
Contributor

@jimmie and @gxtchen, There was another issue related to this #97 (comment)

We found that user was using an older version harvest.

@jordanpadams, verified this with the user and closed the issue as follows.

user verified they were using 3.6.0-SNAPSHOT, and once they upgraded to 3.6.0 this issue was fixed

This issue should be also closed with #97 (comment)

@ramesh-maddegoda
Copy link
Contributor

@jimmie and @gxtchen , the data set they had this issue was https://atmos.nmsu.edu/PDS/data/jnogrv_1001/DOCUMENT/

@jordanpadams jordanpadams added the invalid This doesn't seem right label Aug 16, 2022
@jordanpadams
Copy link
Member Author

thanks @ramesh-maddegoda. agreed.

@jordanpadams
Copy link
Member Author

added invalid label to ticket so this can be avoided in the future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B13.0 bug Something isn't working invalid This doesn't seem right s.medium
Projects
None yet
Development

No branches or pull requests

5 participants