lamp-town-guy
Mnesia can't create disc copy
I’m running into problem with mnesia table creation. When I’ve called :mnesia.create_table/2 with option disc_only_copies: [Node.self()] I’ve got bad_type error. So I’ve tried :mnesia.change_table_copy_type/3. With bigger success. Now I’m getting {:aborted, {:has_no_disc, :nonode@nohost}} error.
I didn’t specify any host name.
Platform: Mac OS X, M2 CPU
Erlang: 26.0.2
Elixir: 1.15.5
Code snippet:
alias :mnesia, as: Mnesia
Mnesia.stop()
Mnesia.create_schema([Node.self()])
Mnesia.start()
Mnesia.create_table(Pulse,[
type: :set,
# disc_only_copies: [Node.self()],
record_name: Pulse,
attributes: @record_fields
])
Mnesia.change_table_copy_type(Pulse, Node.self(), :disc_copies)
Line commented out was used when I was creating table with disc persistence.
Most Liked
jchrist
Is the directory where you’re running mnesia writable?
You may also want to try running with the environment variable ERL_FLAGS="-mnesia debug trace" set. That way mnesia will give you information about what it’s doing. (-mnesia debug verbose will be less noisy)
lamp-town-guy
I’ve had this in my config. Which caused the bug. Right after I’ve removed mnesia config it just works. I’ve forgotten about it when I was testing elixir libraries interacting with mnesia.
config :mnesia,
dir: ".mnesia/#{Mix.env()}/#{node()}"
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









