git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Erik Faye-Lund <kusmabite@gmail.com>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
	Jeff King <peff@peff.net>, Eric Wong <normalperson@yhbt.net>
Subject: Re: [PATCH 7/5] transport: optionally honor DNS SRV records
Date: Thu, 8 Mar 2012 17:18:49 +0100	[thread overview]
Message-ID: <CABPQNSYpRGfu7Ew+KstCFsG4YDSx+i-jzHS1Bw0BA4S2hoz4SA@mail.gmail.com> (raw)
In-Reply-To: <20120308132155.GG9426@burratino>

On Thu, Mar 8, 2012 at 2:21 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:
> Date: Mon, 6 Jun 2011 04:46:20 -0500
>
> SRV records are an extra layer of indirection on top of A/AAAA records
> mapping from domain names and service types to the hostnames of
> machines that offer that service.  That has a couple of nice effects:
>
>  - a single domain can use different hosts for different services
>  - a single domain can use multiple hosts for one service
>
> Teach git to perform a SRV lookup whenever resolving a git:// URL.
> This means:
>
>  - if your git server was previously the same machine as your wesnoth
>   server, you can move it to a separate machine without forcing
>   everyone to update their links to the old URLs
>
>  - if you have a primary git server and a backup machine that should
>   be used when the primary server goes down, the client can
>   automatically take care of it
>
>  - if you have multiple git servers and would like to spread load
>   between them, the client can automatically take care of it
>
> That is, SRV records let us ask the client to carry out various tasks
> that would require a proxy on the server side with traditional DNS.
> The client performs a SRV query to _git._tcp.<domain name> to receive
> its instructions.  RFC 2782 has details.
>
> Ideally reaping these benefits would just involve passing a special
> flag to getaddrinfo().  Since we don't live in such a world, this
> patch uses the BIND 8 API provided by libresolv to parse the response
> for ourselves.
>
> RFC 2782 requires some non-determinism in the order of hosts
> contacted; this patch uses drand48() for that.  To avoid causing
> trouble for platforms that lack the libbind ns_* functions or
> drand48(), the SRV support is only provided when requested by setting
> the USE_SRV_RR compile-time option.
>
> git servers must ensure that they can also be reached by a plain
> A/AAAA lookup to support git clients without SRV support, for example
> by proxying connections to an appropriate server:
>
>        # in inetd.conf
>        git stream tcp nowait.400 nobody /usr/sbin/tcpd \
>                /bin/nc -q0 gitserver.example.com git
>
> Regression: this uglifies error messages for connection errors a
> little.  It would probably be better to leave out the connection count
> when we are not trying more than one server.
>
> Based on a patch by Julien Cristau <jcristau@debian.org>.
>
> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
> ---
> As I mentioned at the gittogether, I think this would be a valuable
> feature in git.  You can test it out (though this is only the simple
> case, no load balancing or failover) by doing
>
>        git clone git://git.debian.org/~jrnieder-guest/git.git
>
> and watching what happens with wireshark.
>
> The patch needs documentation.  Maybe a howto and an addendum to the
> protocol docs would do.  Anyway, I hope it's at least entertaining in
> the current state.

It's an interesting feature, but I'm a little bit worried if this
promotes non-portable setups; won't these repos be unreachable (at
least without manually redirecting or also keeping a copy on the
advertised URL) on machines where libresolv is unavailable? I'm mainly
thinking about the "a single domain can use different hosts for
different services"-benefit you mentioned. Multiple hosts for one
service would probably be done by simply advertising one of the URLs,
and get some load-balancing from the clients that DOES have
libresolv...

  reply	other threads:[~2012-03-08 16:19 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-08 12:48 [PATCH 0/5] transport: unify ipv4 and ipv6 code paths Jonathan Nieder
2012-03-08 13:03 ` [PATCH 1/5] transport: expose git_tcp_connect() and friends in new tcp.h Jonathan Nieder
2012-03-08 15:28   ` Erik Faye-Lund
2012-03-08 13:05 ` [PATCH 2/5] daemon: make host resolution a separate function Jonathan Nieder
2012-03-08 13:06 ` [PATCH 3/5] daemon: move locate_host() to tcp lib Jonathan Nieder
2012-03-08 13:09 ` [PATCH 4/5] tcp: unify ipv4 and ipv6 code paths Jonathan Nieder
2012-03-08 15:39   ` Erik Faye-Lund
2012-03-08 21:10     ` Jonathan Nieder
2012-03-08 13:11 ` [PATCH 5/5] daemon: check for errors retrieving IP address Jonathan Nieder
2012-03-08 13:16 ` [PATCH 6/5] tcp: make dns_resolve() return an error code Jonathan Nieder
2012-03-08 13:21 ` [PATCH 7/5] transport: optionally honor DNS SRV records Jonathan Nieder
2012-03-08 16:18   ` Erik Faye-Lund [this message]
2012-03-08 21:35     ` Jonathan Nieder
2012-03-09  7:07       ` Johannes Sixt
2012-03-09  8:00         ` Jonathan Nieder
2012-03-08 13:23 ` [PATCH 8/5] srv: tolerate broken DNS replies Jonathan Nieder
2012-03-08 22:28   ` Richard Hartmann
2012-06-11 18:12 ` [PATCH 0/5] transport: unify ipv4 and ipv6 code paths Erik Faye-Lund
2012-06-11 18:59   ` Junio C Hamano
2012-06-14  5:02   ` Jonathan Nieder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CABPQNSYpRGfu7Ew+KstCFsG4YDSx+i-jzHS1Bw0BA4S2hoz4SA@mail.gmail.com \
    --to=kusmabite@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    --cc=normalperson@yhbt.net \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).