Skip to content

Document (or increase) database size limit #940

Closed

Description

@danielmewes

From config/args.hpp:

// We assume there will never be more than this many blocks. The value
// is computed by dividing 1 TB by the smallest reasonable block size.
// This value currently fits in 32 bits, and so block_id_t is a uint32_t.
#define MAX_BLOCK_ID                              (TERABYTE / KILOBYTE)

This limits the size of one shard to 4 TB, if not even the size of all the data for the whole table residing on a single node. (are all shards of a certain table stored in the same file?)

This should be documented somewhere.

Also, the limit should be increased.

The maximal value that can be stored in a uint32_t = block_id_t is 4 * TERABYTE / KILOBYTE - 1, which would allow for 16 TB of data per shard. One more value has to be reserved for NULL_BLOCK_ID, so we would end up with MAX_BLOCK_ID = 4 * TERABYTE / KILOBYTE - 2 (assuming MAX_BLOCK_ID is inclusive, I have not checked).

Changing this will have an effect on both the on-disk and in-memory LBA index structures in the serializer. I'll have to check the code to find out what kind of effect.

Activity

  1. danielmewes commented on Jun 3, 2013

    @danielmewes
    MemberAuthor

    For what's much much worse, I actually cannot find any place where this is checked.

    The cache's free list seems to happily generate higher and higher block ids (see array_free_list_t::gen_block_id()). The segmented_vector, for which the MAX_BLOCK_ID is actually used, has an rassert, but no guarantee to check for illegal resizing values either (see segmented_vector_t::set_size()), so it will happily write into unallocated or otherwise-allocated memory (say a dirty data page in the cache, shudder. Even though probably, it will just overwrite the size variable of the segmented_vector_t, with potentially other serious side-effects) .

    While checking for this in the cache might not be trivial due to the serializer multiplexing layer, the log serializer should at least panic if this condition occurs.

  2. danielmewes commented on Jun 3, 2013

    @danielmewes
    MemberAuthor

    Also marking this as high priority, as I see a significant chance of silent data corruption.

  3. ghost assigned on Jun 3, 2013
  4. srh commented on Jun 3, 2013

    @srh
    Contributor

    With #939 there is a higher, quite realistic chance of overflowing the limit. I'm working on this in branch sam_939.

  5. danielmewes commented on Jun 3, 2013

    @danielmewes
    MemberAuthor

    If the real fix doesn't make it into 1.6, I suggest adding a simple guarantee() to check for a block id overflow to the in-memory LBA code as a temporary work around. Crashing "cleanly" on an overflow is a lot better than quietly corrupting memory and potentially on-disk data.

    With more people evaluating RethinkDB on real data, there's a chance that they hit this limit even without #939 (which would not do anything to the number of blocks used for storing a given amount of data anyways, would it?).

  6. coffeemug commented on Jun 10, 2013

    @coffeemug
    Contributor

    Talked to @srh. This should be ~three days away, but requires a bit of testing. Moving to 1.7.

  7. danielmewes commented on Jun 10, 2013

    @danielmewes
    MemberAuthor

    That makes sense. Please consider my previous post.

  8. coffeemug commented on Jun 18, 2013

    @coffeemug
    Contributor

    Since @srh pointed out that he's on top of it and considers it to be a part of #939, I'm closing this issue. Consider it merged into #939.

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