Clarification needed: DB.Tables API

(Kevin Yang) #1

Hey, badger team:

I’m playing with a badger table (managed DB, if that matters). The db is quite small, ~40 rows for now.

However, if I use db.Tables(true), it gives me nothing.

I’m a bit confused, there is no Tables?
Can anyone explain? thanks.

(Ashish) #2

@yangzh Since data in DB is quite small, all of it might be in memory(skiplists). Hence db.Tables() is returning nothing. You might be having single .vlog file.

(Kevin Yang) #3

@ashishgoswami, thanks for the response, it might be totally true.

However, I was not comfortable with the convention:

I did put some stuff in the DB, and Tables returns me nothing? What should I do if I want to do some key split, similar to Stream does?

On the other hand, ff DB.Tables() does return anything, does that includes keys in memory skip lists?

(Kevin Yang) #4

Hey, @ashishgoswami, do you have any answer for my questions? thanks.

(Ashish) #5

Hey @yangzh, db.Tables() returns data related to persisted tables. It does not include data about skip lists.
It is mostly used in info tool and stream framework(used for backup).

Let know me what are you trying to do.

(Kevin Yang) #6

So suppose I want to consume all key-value pairs from a table in a way similar to the Stream framework, with proper split among them, for load balancing, (I noticed Stream uses db.Tables under the hood), if db.Tables only gives me persisted tables (instead of memory table), do I have to have special treatment for memory tables?

(Ashish) #7

Stream framework has single table iterator as the smallest unit for which it iterates in parallel. I am not sure if you can do something similar for a single table.