Skip to content

Commit d9ca853

Browse files
committed
Add space not found doc
Add page about solving space not found problem Closes #142
1 parent b78b06f commit d9ca853

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ If you use this code in another project don't forget to add `cartridge-driver` d
5656
Determining bucket id on java side to send requests directly on storage.
5757
* [Thread control](docs/ThreadControl.md)
5858
Specifying custom numbers of netty work threads.
59+
* [Space not found](docs/SpaceNotFound.md)
60+
The problem of getting metadata.
5961
* [SSL and mTLS usage examples (enterprise edition only)](docs/SslAndMtls.md)
6062
Connect to Tarantool instances over an SSL or mTLS channel.
6163

docs/SpaceNotFound.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[Main page](../README.md)
2+
3+
# How to set schema and do not get "space not found" error?
4+
5+
## About problem
6+
If you create spaces only on storages inside a storage role [like this](https://github.com/tarantool/cartridge-java/blob/ba6e8b248b6f448cc9f29e4d660a3d0a2f210ccd/src/test/resources/cartridge/app/roles/api_storage.lua#L12-L220)
7+
or any other way, and you want to get data using router. You will receive an error message like "space not found".
8+
This happens because router does not have information about this space.
9+
If you work directly with a storage you won't get this kind of error if spaces was created properly.
10+
But if you want to use [CRUD](https://github.com/tarantool/crud) to retrieve data from the router, there are some solutions.
11+
12+
## Migrations
13+
We recommend to set the scheme using migrations, they will be applied not only to storages, but also to routers.
14+
This way the router will be aware of the current scheme and such errors will not occur.
15+
Migrations will create spaces on both storages and routers.
16+
Tarantool CE supports migrations only since 2.2.x.
17+
[Tarantool Enterprise Edition](https://www.tarantool.io/ru/product/enterprise/) supports migrations since 1.10.x and 2.2.x.
18+
More information about migrations [tarantool/migrations](https://github.com/tarantool/migrations).
19+
20+
## Proxying ddl.get_schema
21+
If you want to create spaces only in storages, there is another solution.
22+
Set up proxying ddl.get_schema from storage to routers. You should add this function to router role:
23+
https://github.com/tarantool/cartridge-java/blob/ba6e8b248b6f448cc9f29e4d660a3d0a2f210ccd/src/test/resources/cartridge/app/roles/api_router.lua#L10-L14
24+
And make it global.
25+
https://github.com/tarantool/cartridge-java/blob/ba6e8b248b6f448cc9f29e4d660a3d0a2f210ccd/src/test/resources/cartridge/app/roles/api_router.lua#L228
26+
Or you can just remove word `local` from line 10. Effect will be the same.
27+
Now then cartridge-java tries to get schema from router

0 commit comments

Comments
 (0)