Skip to content

Support binary data type #137

Closed
Closed

Description

@coffeemug

We need to ease the burden of storing binary data for people (saying 'encode it' into string isn't acceptable). We'd presumably do this by adding a BINARY term (as we discussed).

Obviously, in backlog.

Activity

  1. coffeemug commented on Jun 18, 2013

    @coffeemug
    ContributorAuthor

    Suggested by JulianMorrison on https://news.ycombinator.com/item?id=5886624:

    Take binary input in the form of a no-args generator function (called repeatedly, returns a series of binary blobs and then null as EOF) or where the language permits, allow a language specific abstraction of a read-once stream such as an IO in Ruby as a higher level wrapper for that. Return binary data in the same form.

  2. orthecreedence commented on Oct 9, 2013

    @orthecreedence

    Hey, I know you guys are super busy, but I wanted to bump this issue. I'm dealing with a lot of binary data at the moment, and while Base64-encoding everything is fine for now, eventually I'd really like a way to safely store blobs of binary data.

    Any thoughts on when this can make it in? Also, out of curiosity, what are the issues with just sending/storing binary data? I'm assuming it's not as easy as just shoving an array of binary data into the driver and sending it off otherwise you guys probably would have done this already.

    One more question: would it be possible to index on binary fields? Right now my IDs for everything are hex-string representations of binary data, and while I'm not in a hurry to convert my IDs to binary, I'm wondering if it would be possible once binary storage is implemented.

    Thanks!

  3. jdoliner commented on Oct 9, 2013

    @jdoliner
    Contributor

    The biggest issue with storing binary data right now is how we'd handle compatibility. Right now RethinkDB has the nice property that every value in it has an obvious representation as JSON. This means that driver developers don't have to think too hard about how to represent ReQL datatypes in their language. Most languages have a canonical JSON library and representing ReQL values the same way it represents JSON values serves as a very good baselines for an implementation. This is something that we're eventually going to have to do but because it'd be breaking one of our basic design assumptions it's a lot to think about so we're opting to put it off until we achieve production readiness. Sorry I can't be more helpful on this one we'll get it in as soon as possible.

    When we do have binary data types you will definitely be able to index on them.

  4. orthecreedence commented on Oct 9, 2013

    @orthecreedence

    Great answers, thanks.

  5. dhandeo commented on Nov 13, 2013

    @dhandeo

    I would like to see binary data support even without indexes supported on them. Thanks :)

  6. modified the milestones: , backlog on Feb 21, 2014
  7. coffeemug commented on Mar 11, 2014

    @coffeemug
    ContributorAuthor

    I just talked to some folks who wanted this feature. They use Rethink for a metadata store and like it because it's easier than other products. They thought "hey, may be we could use it for our real data", but discovered they can't.

    Adding a robust binary data support would likely be important for them.

  8. modified the milestones: 1.13, on Mar 26, 2014
  9. modified the milestones: 1.14, on Jun 11, 2014
  10. self-assigned this
    on Jun 18, 2014
  11. 83 remaining items

  12. coffeemug commented on Jul 7, 2014

    @coffeemug
    ContributorAuthor

    Tell us why you believe users need to be able to shard individual files.

    When I explain a feature/product X to people they typically go through the following two questions (in order):

    • What other thing Y is X closest to?
    • Oh, ok, and how is X better than/different from/not like Y?

    They ask the first question because people try to understand new things in terms of other things they already know. They ask the second question for the same reason, but also because their curiosity kicks in. They want to know about the differences for their own sake, and to see if the new thing is worth their attention.

    For new things to have sufficient activation energy so people use and understand them they either have to be unbelievably out of this world good, or they have to be explained in context of something that already exists. (Even VMWare, which was out of this world good, still struggled with having to answer these two questions)

    So now we have a dilemma. We could say "RethinkFS is like GridFS/HDFS, but you can't shard individual files". But sharding individual files is a defining feature of GridFS/HDFS, which will give people a sense of confusion about the whole thing. "It's like GridFS/HDFS, but without a defining feature of GridFS/HDFS, which means it's worse?"

    We could also compare to something else. "RethinkFS lets you store files across the cluster, like NFS." To which people will say "ah, it's not as powerful as GridFS/HDFS, which is ok because it isn't intended to be". But we'll still be bucketed as a product who has a less powerful file system.

    Dealing with these arguments is of course a losing proposition. It's much easier to say "It's like GridFS/HDFS, you can just store files across the cluster" and call it a day.

    Tell us why you think users think they need to be able to shard individual files.

    It's a strong intuitive feeling deduced from experiences described in part (1) above. I don't have hard data on the specific case because it's pretty hard to construct a good experiment -- this is the kind of thing where you can't get a proper reaction from people until you show them a complete thing. We could construct a couple of landing pages and see how people react, but running such an experiment is a lot of work.

    Explain in your own words the increase in technical difficulty of implementing this.

    I expect us to cut a lot of corners in the implementation in a way that people will find acceptable, such that the increase in technical difficulty is marginal. In particular, we won't give any ACID or state guarantees beyond what the user would get by writing the queries in the driver themselves to manipulate r.binary chunks. We'll just be offering porcelain commands for convenience, but will be offering no additional semantics.

    Explain in your own words the availability downsides and upsides.

    Assuming file commands aren't automatically set to read outdated by default, if a single master that holds some chunks of the file dies, the file will be partially inaccessible until the user fails over. (We might choose to switch to read outdated for files by default though, in which case files will be entirely available as long as replication factor is greater than one, and every machine where the chunk is stored isn't dead).

    EDIT: if machines holding the metadata are down, files may be partially or fully inaccessible too until service is restored.

    Explain in your own words the performance downsides and upsides.

    I suspect the sharded implementation will be slower (at least in terms of latency), though I can't speculate as to how much slower.

    Explain why the simpler task, that's nearly a subset of the work, of storing the files without breaking them up, shouldn't be implemented first with us then reevaluating the question of sharding individual files.

    I'm not sure it's a simpler task. Assuming all we're doing is adding porcelain commands on top of r.binary that the user could write themselves using the drivers, the tasks seem roughly comparable to me in the amount of work.

    Identify which features we're scheduling later to make room for the extra development effort for sharding individual files.

    See part (3). I don't think delays are necessary.

  13. danielmewes commented on Jul 7, 2014

    @danielmewes
    Member

    But sharding individual files is a defining feature of GridFS/HDFS

    Doubtlessly there will be many other features of either of those systems that we will not support. Are you sure that this one is especially relevant (actually or in people's minds)? I'm asking because your argument seems to build on that premise.

  14. coffeemug commented on Jul 7, 2014

    @coffeemug
    ContributorAuthor

    Are you sure that this one is especially relevant (actually or in people's minds)?

    I have a strong intuition for it, but I'm not absolutely certain it's as strong an assumption in people's minds as it is in my own. If we delay the spec until #2612 is done, I can reach out to people who use these systems and see what they say. (This takes a lot of time though, so I'll only do it if you guys really want me to)

  15. modified the milestones: , 1.14 on Jul 9, 2014
  16. hardkrash commented on Jul 11, 2014

    @hardkrash

    I recall bits of our conversation on this topic a while ago. The defining features that I want are the following. This should mostly be transparent as to blob/binary/file as file should be just porcelain on top of blob/binary.

    • Access to the data simply in the driver.
    • A mime type like interface/adapter.
      • Ability to extract file metadata from the file/binary/blob for database operations on the server.
        • e.g. exif data from a jpeg.
        • e.g. id3 from an mp3.
        • e.g. my custom adapter on the servers for my binary format.
        • I don't want to have to transmit a 10MiB jpeg to get the exif date from it for a join.
    • I couldn't care less on the pedantic issue of how the data is stored in the backend.
      • N.B. as long as it's reliable. If the file is shared it should be replicated. (belt & suspenders)
      • FAT32, NTFS, HDFS+, They are all databases for files breaking them onto sectors of hard drives.
      • Chunking should be invisible to the client.
      • If a shard of chunk is unavailable, fail lazily.
        • e.g. getting the exif data I only needed the first 1KiB and the unavailable data is after that data, then cause the error when you need the data, not when you try and "open" the file.
    • Lazy transfer of the data for larger files.
    • I want the files in the documents, not as a separate linked thing that I need to look up separately.
    • The json in the client could represent it as a file handle that the driver exposes on the side.
    • A way to backup the data.
    • A safety valve for very large files in documents.
      • e.g. a query returns 100 documents, and the first has a 1GiB file in it, I don't always want to have 1GiB transfer to the client without explicitly requesting it.
      • USB, FTP, and ZeroMQ kinda got it right with a control pipe as side band.
      • Thunderbolt and Ethernet did it right with packets and QOS.
    • Ability to store large blobs/binarys/files on a SAN/NAS different that the main database.

    I have a setup that is build with mongo and a net app filler, it sucks cause the client manages the files on the netapp filler and mongo manages the metadata. Synchronization is a pain, data retrieval is a pain, the system is a pain. HadoopFS is a pain. Relieve my pain. :-)

  17. coffeemug commented on Jul 11, 2014

    @coffeemug
    ContributorAuthor

    @hardkrash -- thank you for the feedback.

    I have a setup that is build with mongo and a net app filler, it sucks cause the client manages the files on the netapp filler and mongo manages the metadata.

    Could you talk about what prevents you from using GridFS?

  18. hardkrash commented on Jul 11, 2014

    @hardkrash

    After reading more on gridfs two things one that was misinformation from the contractor.

    • 16MiB limit, the misinformation.
    • ability to have files on a slow large SAN.

    On Jul 11, 2014, at 10:58 AM, Slava Akhmechet [email protected] wrote:

    @hardkrash -- thank you for the feedback.

    I have a setup that is build with mongo and a net app filler, it sucks cause the client manages the files on the netapp filler and mongo manages the metadata.

    Could you talk about what prevents you from using GridFS?

    —
    Reply to this email directly or view it on GitHub.

  19. modified the milestones: , on Aug 13, 2014
  20. coffeemug commented on Aug 14, 2014

    @coffeemug
    ContributorAuthor

    Closing -- this issue is superseded by #2647. Binary data type has been added in 1.14.

  21. modified the milestones: , 1.14 on Aug 14, 2014
  22. added a commit that references this issue on Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions