[ 
https://issues.apache.org/jira/browse/HADOOP-18087?focusedWorklogId=716171&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-716171
 ]

ASF GitHub Bot logged work on HADOOP-18087:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 27/Jan/22 03:23
            Start Date: 27/Jan/22 03:23
    Worklog Time Spent: 10m 
      Work Description: eubnara commented on pull request #3935:
URL: https://github.com/apache/hadoop/pull/3935#issuecomment-1022811323


   It fixes:
   
   - add missing chained CNAME records
     - e.g. when querying `repo.maven.apache.org.` for A record, chained CNAME 
records should be in answer section.
   ```
   ❯ dig @8.8.8.8 repo.maven.apache.org
   
   ; <<>> DiG 9.16.1-Ubuntu <<>> @8.8.8.8 repo.maven.apache.org
   ; (1 server found)
   ;; global options: +cmd
   ;; Got answer:
   ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 65465
   ;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 1
   
   ;; OPT PSEUDOSECTION:
   ; EDNS: version: 0, flags:; udp: 512
   ;; QUESTION SECTION:
   ;repo.maven.apache.org.              IN      A
   
   ;; ANSWER SECTION:
   repo.maven.apache.org.       20102   IN      CNAME   repo.apache.maven.org.
   repo.apache.maven.org.       21178   IN      CNAME   maven.map.fastly.net.
   maven.map.fastly.net.        4       IN      A       199.232.192.215
   maven.map.fastly.net.        4       IN      A       199.232.196.215
   
   ;; Query time: 148 msec
   ;; SERVER: 8.8.8.8#53(8.8.8.8)
   ;; WHEN: 목  1월 27 12:18:39 KST 2022
   ;; MSG SIZE  rcvd: 148
   ```
   
   - distinguish between NXDOMAIN and NOERROR + empty answer from upstream DNS 
server
     - e.g. when querying `repo.maven.apache.org.` for AAAA record, it should 
respond `NOERROR` with empty answer not `NXDOMAIN` because A record exists even 
though AAAA record does not exist.
     - Please note that `status: NOERROR` in result of `dig` command.
   
   ```
   ❯ dig @8.8.8.8 repo.maven.apache.org AAAA
   
   ; <<>> DiG 9.16.1-Ubuntu <<>> @8.8.8.8 repo.maven.apache.org AAAA
   ; (1 server found)
   ;; global options: +cmd
   ;; Got answer:
   ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 5782
   ;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 1, ADDITIONAL: 1
   
   ;; OPT PSEUDOSECTION:
   ; EDNS: version: 0, flags:; udp: 512
   ;; QUESTION SECTION:
   ;repo.maven.apache.org.              IN      AAAA
   
   ;; ANSWER SECTION:
   repo.maven.apache.org.       21161   IN      CNAME   repo.apache.maven.org.
   repo.apache.maven.org.       20107   IN      CNAME   maven.map.fastly.net.
   
   ;; AUTHORITY SECTION:
   fastly.net.          30      IN      SOA     ns1.fastly.net. 
hostmaster.fastly.com. 2017052201 3600 600 604800 30
   
   ;; Query time: 164 msec
   ;; SERVER: 8.8.8.8#53(8.8.8.8)
   ;; WHEN: 목  1월 27 12:20:47 KST 2022
   ;; MSG SIZE  rcvd: 177
   ```


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 716171)
    Time Spent: 2.5h  (was: 2h 20m)

> fix bugs when looking up record from upstream DNS servers.
> ----------------------------------------------------------
>
>                 Key: HADOOP-18087
>                 URL: https://issues.apache.org/jira/browse/HADOOP-18087
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: registry
>    Affects Versions: 3.1.2
>            Reporter: YUBI LEE
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 2.5h
>  Remaining Estimate: 0h
>
> When query A record which is chained by CNAME, YARN Registry DNS Server does 
> not properly respond. Some CNAME records are missing.
> For example, "repo.maven.apache.org" is chaned as follows:
> repo.maven.apache.org.        21317   IN      CNAME   repo.apache.maven.org.
> repo.apache.maven.org.        20114   IN      CNAME   maven.map.fastly.net.
> maven.map.fastly.net. 7       IN      A       199.232.192.215
> maven.map.fastly.net. 7       IN      A       199.232.196.215
> If ask A record for "repo.maven.apache.org" using "dig" or "nslookup", YARN 
> Registry DNS Server will give answers similar to this:
> (10.1.2.3, 10.8.8.8 IP is virtual)
> {code}
> $ nslookup repo.maven.apache.org 10.1.2.3
> Server:               10.1.2.3
> Address:      10.1.2.3#53
> Non-authoritative answer:
> repo.maven.apache.org canonical name = repo.apache.maven.org.
> Name: maven.map.fastly.net
> Address: 151.101.196.215
> ** server can't find repo.apache.maven.org: NXDOMAIN
> {code}
> The reason why you can see "NXDOMAIN", "nslookup" will query "A" & "AAAA" 
> records.
> If there is no answer from other dns server, "answers == null" but YARN 
> Registry DNS Server has a bug. There is no null handling.
> {code:java}
>     // Forward lookup to primary DNS servers
>     Record[] answers = getRecords(name, type);
>     try {
>       for (Record r : answers) {
>         if (!response.findRecord(r)) {
>           if (r.getType() == Type.SOA) {
>             response.addRecord(r, Section.AUTHORITY);
>           } else {
>             response.addRecord(r, Section.ANSWER);
>           }
>         }
>         if (r.getType() == Type.CNAME) {
>           Name cname = r.getName();
>           if (iterations < 6) {
>             remoteLookup(response, cname, type, iterations + 1);
>           }
>         }
>       }
>     } catch (NullPointerException e) {
>       return Rcode.NXDOMAIN;
>     } catch (Throwable e) {
>       return Rcode.SERVFAIL;
>     }
>     return Rcode.NOERROR;
> {code}
> It should be like this:
> {code}
> nslookup repo.maven.apache.org 10.8.8.8
> Server:               10.8.8.8
> Address:      10.8.8.8#53
> Non-authoritative answer:
> repo.maven.apache.org canonical name = repo.apache.maven.org.
> repo.apache.maven.org canonical name = maven.map.fastly.net.
> Name: maven.map.fastly.net
> Address: 151.101.196.215
> {code}
> I will make a pull request at https://github.com/apache/hadoop soon.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to