How can I perform hot reload code in tarantool cartridge without restarting application ?
How can I perform hot reload code in tarantool cartridge?
459 views Asked by Aleksey Budaev At
1
There are 1 answers
Related Questions in TARANTOOL
- Is it possible to use derived methods like findById when working with tarantool without lua scripts?
- Tarantool Cartridge "Memory is highly fragmented" errors
- error: Can't create or modify index in space: index id too big
- How to pack correctly Tarantool iproto SQL bind custom type?
- How to deserialize Decimal of Tarantool 2.10+ response in Rust?
- How to encode messagepack DateTime, UUI for Tarantool 2.10+?
- Adding a new field to each array element in .lua
- How to rename fields in array in .lua
- How to use tarantool command <cartridge replicasets join> in docker with multi container?
- Helm install tarantool-operator 0.0.10 problem: 404 not found
- How to migrate Tarantool tables in the presence of foreign keys?
- Communication between to goland services
- Tarantool Error - Procedure 'vshard.storage.buckets_count' is not defined
- What is the best way to upload large data set to tarantool
- How do I compare arrays or box.tuple objects In Tarantool?
Related Questions in TARANTOOL-CARTRIDGE
- Tarantool Cartridge "Memory is highly fragmented" errors
- Adding a new field to each array element in .lua
- How to rename fields in array in .lua
- How to use tarantool command <cartridge replicasets join> in docker with multi container?
- Helm install tarantool-operator 0.0.10 problem: 404 not found
- Tarantool cartridge-springdata(spring data for tarantool) does not work when language is kotlin
- Why does my Tarantool Cartridge retrieve data from router instance sometimes?
- Evolving Tarantool instance
- Get 1 random record from Tarantool space
- How to config Tarantool Cartridge cluster automatically?
- Q: How to change cluster_cookie in bootstrapped Tarantool Cartridge cluster?
- How to setup cartridge applications replication between few Tarantool routers?
- Using Tarantool http as Nginx upstream server - got error 13: Permission denied
- icu_date gives an error message attempt to index a number value
- Custom response from Tarantool + Nginx
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
In order to find the best solution to your problem it is important to understand what you are trying to achieve. There are 2 possible scenarios:
The first one can be done by unloading a module and loading it again. All modules, when loaded, place themselves to the 'package.loaded' table. So all you need is to update it:
This is a low-level approach that you can generalize: loop over contents of 'package.loaded', unload everything and load it back again. You need to be careful here to not unload the modules that are not present on a filesystem. There is a module that can help you with this: https://github.com/moonlibs/package-reload
While that module will help you with the basics, there are other things you need to consider. In Lua it is very easy to store function pointers inside global objects. If you reload the function itself, you won't magically update all the places that have the pointer to the old function. For example, let's consider the http server:
If you reload mymodule.lua, and not call the router:route again to re-register the handler, HTTP requests will still call the old function.
In cartridge, you usually register functions in apply_config() or init(). See here for example. In order to re-register the callbacks you need to call init() or apply_config() of your roles again. To get a list of roles, you can use cartridge.roles.get_known_roles() . You need to loop over them and re-init them.
In order to call the function that reloads the code, you'll either need to connect through the binary protocol, or use admin socket. Admin socket allows you to write a simple shell script for that. You can get the idea by looking at the tarantool_is_up script . It demonstrates the approach that you can adapt for your use-case.
The second way to achieve this will be to use cartridge-extensions that allows you to push new code through network. It already has some niceties like simplified binding to the public endpoints.