Skip to content

Distributed Memento with Libcluster {:no_exists, Schema} #34

@maheshreddyks

Description

@maheshreddyks

I have few issues rolling out Memento on my application.

Implementation

  1. Application has 3+ pods at any point of time and is connected with Libcluster.
  2. In application.ex children are listed as follows
    a. {Cluster.Supervisor, [get_topologies(), [name: MyApp.ClusterSupervisor]]}
    b. MyApp.Mnesia.MigrateTask.child_spec()
defmodule MyApp.Mnesia.MigrateTask do
  def child_spec() do
    %{
      id: MODULE,
      start: {Task, :start_link, [fn -> setup() end]},
      type: :worker,
      restart: :temporary
    }
  end
  
  def setup() do
    # I inspected here, all the nodes were connected here.  
    nodes = [node() | Node.list()]
    
    # Stop Memento all nodes
    :rpc.multicall(nodes, Memento, :stop, [])
    
    # Create schema on all nodes
    Memento.Schema.create(nodes)
    
    # Start Memento all nodes
    :rpc.multicall(nodes, Memento, :start, [])
    
    # Create ram copies on all nodes
    Memento.Table.create!(MyApp.MetaSchema, ram_copies: nodes)        
  end
end  

Table Schema

defmodule QueryQuest.Mnesia.MetaSchema do
  use Memento.Table, attributes: [:key, :value]
end
  1. After the pods are up, through remote console checked Mememto.info. I see all pods are on running db nodes.

Issue

But I queryall for the Table.

    Memento.transaction!(fn ->
      Memento.Query.all(MyApp.MetaSchema)
    end)

Error

** (Memento.Error) Transaction Failed with: {:no_exists, MyApp.MetaSchema}
    (memento 0.3.2) lib/memento/transaction.ex:178: Memento.Transaction.handle_result/1

I'm trying to debug it, but its not succesful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions