-
Notifications
You must be signed in to change notification settings - Fork 153
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
API question: cursors and databases #154
Comments
Hi, not quite sure what the issue in here. There is no way records can overlap this way, only if you use different db pointers during sp_document() creation. Are you sure it sets correct name for sp_getobject()? sophia.path specifies main directory, where all databases will be stored by name. For example, db.mydb will be placed in sophia.path/mydb |
Right, both the cursor-based "read" path and the transaction-based "write" path start with the same code (the first fragment). I do see per-database subdirectories created inside I know you have tests that cover multi-db mutations. Yet, do you have a multi-db cursor test? |
Could you please specify your work case you are trying to achieve? One cursor is designed to iterate only one database at a time. If you need to make a join between databases, you need to open a second cursor, and so on. |
Yes, that's what I expected. Yet the cursor returns keys from an adjacent DB, which is very surprising. |
Please see #156 for the repro - a cursor-based walk in DB2 should find no keys (yet it fetches everything from the DB1). |
Now i understand what you meant. This is known issue, which might be quite confusing. Sophia does not have persistent catalog of created databases, they must be predefined each time before Open procedure will find and recover every specified database directory by its name. After that it will reply write-ahead log records. To identify database in write-ahead log |
Umm... I don't follow. Is there a way for me do deal with this issue?
If this does not work, I will have to create distinct directories to isolate the DBs... Are there downsides? |
Sophia has a single write-ahead log which is shared between databases to efficient support cross-database transactions. To match a database in the log
Keep in mind, that open operation is very time consuming. Keep a database open, if you need good timing. |
OK, I've extended the code to set
Could you take a look at my second commit in #156 please? What am I missing? |
Also, let me use this comment to collect misc notes/comments:
|
My fault, sorry about that. I completely forgot that custom id generation scheme been removed in v2.2 (so recommended scheme was actual only for previous version). Right now, the only way to make this work is to always define same databases in same order. I was planning to completely remake it. It is also possible to force compaction and wait for its completion, this will guarantee that write-ahead records will not have database references. This will also increase open time dramatically. Could you describe your use-case in more details? i might have some thoughts how to make it in optimal way. |
Hi Dmitry, I've started stated testing Sophia and hit an issue: a cursor-based walk returns keys across databases. Assume two databases, "db1" and "db2". One of them is opened and keys are fetched using a cursor:
Am I missing something here? Do cursors go across databases? If so, how do I provide an additional filter to limit iteration to a single DB?
Basically, I can achieve the behavior I want by splitting the databases at a higher level this way:
Could you clarify the design behind the aforementioned "path "and "db" settings please?
Thanks a lot!
Oleg.
The text was updated successfully, but these errors were encountered: