-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Persist data #35
Comments
I could try to work on this, if it is fine for you. |
@brancz, actually I see from code that, when a table block is rotated, the old one is simply discarded, and queries only act on the current active block for each table. |
@ostafen Hello! We're actually working on this issue right now! Stay tuned! |
Okay, if you need help, I would be happy to participate on this :=) |
Awesome! I hope to have something that's at least compiling :) very soon |
Okay, I'll stay tuned on this :) |
I've pushed a very WIP branch |
Gave a look at the code. |
Those all sound like reasonable approaches to me |
If you want, I could try to provide a PR addressing these points |
I think there is a potential problem arising from the fact that the block is written to disk in the background by a separate goroutine. To solve this problem, when a query try to iterate on the set of table blocks of the database, the following property should be satisfied: all blocks which have been created before the current active block should be correctly synced to disk. |
I was thinking we'd likely want to drop a metadata file alongside blocks that informs us about their contents and potentially validity. We could update it on successful block rights to avoid reading an incomplete block. If we use a ULID for the block name we could implement the sequence number you've described to determine last valid block. |
The problem is that if a query is submitted while you are writing a block to disk, you have to wait for the incomplete block to be written on disk. If you simply detect that a block is invalid on disk and skip it, you may end with an incomplete result set because the block may contain rows satisfying the query. |
Yea definitely agree. What if we read from the in-memory block that is actively being written to disk? So in our table we have something like
so on read we query from both active and any pending blocks (maybe we only ever keep a single pending block?) and once that pending block has been successfully written to disk, we can remove it from in memory pending list. |
This is a valid alternative I also was thinking about. There is only a drawback with this approach. Under a very high write pressure, several block could be queued in the pending list (keeping only one pending block is not enought in the worst case), thus there could be situtations where the memory limit imposed by activeMemorySize is by far excedeed. However, if this could be acceptable for your purposes, we could go with this solution :=) |
I think we would have to do something like this to avoid temporarily not finding data during queries when a block is being written. |
Good, I'll go for this solution. I'll wait for #60 to be merged before opening a PR. |
Currently, once the configured size of data is reached the active-append table-block is swapped out for a new one and the old one is thrown away. We of course want to persist data in some way. Since we already keep the data in parquet format in memory, it would be great to write that out and memory map it.
The text was updated successfully, but these errors were encountered: