lamp-town-guy

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

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

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()}"

Where Next?

Popular in Questions Top

RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New

Other popular topics Top

joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
saif
Hello everyone, Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
274 42716 114
New

We're in Beta

About us Mission Statement