Skip to content

r.whoami() #3934

Closed
Closed

Description

@neumino

It's similar to what was mentioned in #2979 but my use case is a bit different. I'm trying to have the connection pool in rethinkdbdash automatically populates connections to all the servers listed in the table server_status.

And one problem that surfaces is that people may try to populate the pool from localhost. I have one pool per server (and a "master" that manage all these pools). Since localhost will match all the servers, I can't know exactly in which pool I should put these connections.

I'm working around this by opening new connection to not localhost (by picking up the "wider" address and closing the one to localhost, but being able to run r.whoami() and get a server id would make the code way more simple.
If the server id can be returned at the end of the handshake, that would also work for me.

Activity

  1. deontologician commented on Mar 18, 2015

    @deontologician
    Contributor

    +1 this is the last special /ajax functionality the webui is using (beyond the http reql connections)

  2. added this to the 2.1 milestone on Mar 18, 2015
  3. mlucy commented on Mar 18, 2015

    @mlucy
    Member

    @danielmewes -- putting this in 2.1 so it's in a milestone and we don't forget about it, but feel free to move it out if there isn't room.

  4. danielmewes commented on Mar 18, 2015

    @danielmewes
    Member

    There was some relevant discussion about this in #2979

    We should consider exposing this functionality as a function on the connection object instead of a ReQL term I think, like discussed over there.

  5. timmaxw commented on Apr 21, 2015

    @timmaxw
    Member

    Yeah, I definitely think this should be a method or variable on the connection rather than a ReQL term.

  6. danielmewes commented on Apr 21, 2015

    @danielmewes
    Member

    To bring something else over from the other thread: I really prefer the name conn.server_uuid() over conn.whoami().

  7. timmaxw commented on Apr 21, 2015

    @timmaxw
    Member

    I think server_id is better, for consistency with the system tables.

  8. danielmewes commented on Apr 21, 2015

    @danielmewes
    Member

    Sure, server_id sounds good.

  9. coffeemug commented on Apr 21, 2015

    @coffeemug
    Contributor

    👍 for conn.server_id()

  10. deontologician commented on Apr 22, 2015

    @deontologician
    Contributor

    to clarify, will this return the uuid of the server, the server name, or the hostname of the server?

  11. timmaxw commented on Apr 22, 2015

    @timmaxw
    Member

    This will return the UUID of the server as a string.

  12. timmaxw commented on Apr 22, 2015

    @timmaxw
    Member

    Also, it's not a query. So if you run >>> conn.server_id() in the Python console, it just returns the UUID as a string. You don't write conn.server_id().run(conn) or anything like that.

  13. deontologician commented on Apr 22, 2015

    @deontologician
    Contributor

    It'd be super super nice if I could get the server name as well without having to query server_config

  14. mlucy commented on Apr 22, 2015

    @mlucy
    Member

    What if we had conn.server() and it returned {name: X, id: Y}?

  15. 9 remaining items

  16. danielmewes commented on Apr 28, 2015

    @danielmewes
    Member

    Marking settled with conn.server_id(), or conn.server() if it's similarly easy to implement.

  17. mglukhovsky commented on Aug 3, 2015

    @mglukhovsky
    Member

    This would be really useful for the web UI, and for rethinkdb import (see #4617).

  18. dancannon commented on Aug 3, 2015

    @dancannon

    Would also be really useful for gorethink, currently the way I am checking host status is a bit hacky.

  19. self-assigned this
    on Nov 3, 2015
  20. encryptio commented on Nov 9, 2015

    @encryptio
    Contributor

    in review with @VeXocide, CR 3317

  21. dancannon commented on Nov 9, 2015

    @dancannon

    This is great, Thanks for the work guys!

  22. encryptio commented on Nov 10, 2015

    @encryptio
    Contributor

    Done in next, will be in 2.2.

  23. modified the milestones: 2.2-polish, 2.2 on Nov 11, 2015
  24. added a commit that references this issue on Aug 7, 2026
    e6c7f1d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions