Skip to content

Stuck with "primary_when_safe" #2002

Closed
Closed

Description

@neumino

I started two servers, then switched the number of replicas between 2 and 1 to test backfilling.
Then I killed a server, declared it dead, lowered the number of required replicas.
At that moment, I was expecting to the table to be available again, but it was not.

I used a branch based on commit 5ceb5ae

Content of http://localhost:8080/ajax

{
    "auth": {
        "auth_key": ""
    },
    "directory":    {
        "720507fe-80ae-4f53-9e5e-98df6e0934c1": {
            "dummy_namespaces": {
                "reactor_bcards":   {
                }
            },
            "ips":  ["127.0.0.1", "192.168.42.93", "::1", "::ffff:192.168.42.93", "fe80::2ed0:5aff:fe6e:473f%3"],
            "machine_id":   "720507fe-80ae-4f53-9e5e-98df6e0934c1",
            "memcached_namespaces": {
                "reactor_bcards":   {
                }
            },
            "peer_id":  "ed6c2566-fecc-4698-addc-99c5dc1c82b2",
            "peer_type":    "server",
            "rdb_namespaces":   {
                "reactor_bcards":   {
                    "dc85ca94-ad17-49b4-880b-e43a83515be0": {
                        "activity_map": {
                            "1616c94b-5099-47c6-a75a-f63f045ed6c8": ["[\"\",null]", {
                                    "backfillers":  [],
                                    "type": "primary_when_safe"
                                }],
                            "2d082947-e006-49b7-9e5e-f04fabe5d559": ["[\"\",null]", {
                                    "backfillers":  [],
                                    "type": "primary_when_safe"
                                }],
                            "3b696d18-1c61-40b5-8949-18d35e80a840": ["[\"\",null]", {
                                    "backfillers":  [],
                                    "type": "primary_when_safe"
                                }],
                            "470b266f-bfb4-492b-adb1-27f7fcb64443": ["[\"\",null]", {
                                    "backfillers":  [],
                                    "type": "primary_when_safe"
                                }],
                            "92b52c6e-db41-4dce-a44b-7f0e9a847946": ["[\"\",null]", {
                                    "backfillers":  [],
                                    "type": "primary_when_safe"
                                }],
                            "af985f05-f899-4623-9dd4-38dfd8f03f7e": ["[\"\",null]", {
                                    "backfillers":  [],
                                    "type": "primary_when_safe"
                                }],
                            "c4a93f65-a5e5-4f0a-b1ee-ab46e44a7a7a": ["[\"\",null]", {
                                    "backfillers":  [],
                                    "type": "primary_when_safe"
                                }],
                            "e2451e6e-78bb-4cbd-b469-46e243f872d1": ["[\"\",null]", {
                                    "backfillers":  [],
                                    "type": "primary_when_safe"
                                }]
                        }
                    }
                }
            }
        }
    },
    "issues":   [],
    "last_seen":    {
    },
    "semilattice":  {
        "databases":    {
            "52c171e7-37a6-46a7-bd63-1234bf45d4fd": {
                "name": "test"
            }
        },
        "datacenters":  {
        },
        "dummy_namespaces": {
        },
        "machines": {
            "53b4aad6-1b2a-43bf-8922-1bb9242bba8a": null,
            "720507fe-80ae-4f53-9e5e-98df6e0934c1": {
                "datacenter_uuid":  "00000000-0000-0000-0000-000000000000",
                "name": "Lapetus"
            }
        },
        "me":   "720507fe-80ae-4f53-9e5e-98df6e0934c1",
        "memcached_namespaces": {
        },
        "rdb_namespaces":   {
            "dc85ca94-ad17-49b4-880b-e43a83515be0": {
                "ack_expectations": {
                    "00000000-0000-0000-0000-000000000000": {
                        "expectation":  1,
                        "hard_durability":  true
                    }
                },
                "blueprint":    {
                    "peers_roles":  {
                        "720507fe-80ae-4f53-9e5e-98df6e0934c1": {
                            "[\"\",null]":  "role_primary"
                        }
                    }
                },
                "cache_size":   1073741824,
                "database": "52c171e7-37a6-46a7-bd63-1234bf45d4fd",
                "name": "test",
                "port": 28015,
                "primary_key":  "id",
                "primary_pinnings": {
                    "[\"\",null]":  "00000000-0000-0000-0000-000000000000"
                },
                "primary_uuid": "00000000-0000-0000-0000-000000000000",
                "replica_affinities":   {
                    "00000000-0000-0000-0000-000000000000": 0
                },
                "secondary_pinnings":   {
                    "[\"\",null]":  []
                },
                "shards":   ["[\"\",null]"]
            }
        }
    }
}

Log from the terminal

h9:~/projects/rethinkdb-all/rethinkdb/scripts$ ./spin_up_cluster 0 2 --keep
../build/debug/rethinkdb --directory cluster_directory_0 --machine-name Hephaestus --port-offset 0 --bind all
info: Running rethinkdb 1.11.3-567-g377515 (debug) (GCC 4.8.2)...
info: Running on Linux 3.13.4-1-ARCH x86_64
info: Loading data from directory /home/michel/projects/rethinkdb-all/rethinkdb/scripts/cluster_directory_0
info: Our machine ID is 720507fe-80ae-4f53-9e5e-98df6e0934c1
info: Listening for intracluster connections on port 29015
info: Listening for client driver connections on port 28015
info: Listening for administrative HTTP connections on port 8080
info: Listening on addresses: 127.0.0.1, 192.168.42.93, ::1, ::ffff:192.168.42.93, fe80::2ed0:5aff:fe6e:473f%3
info: Server ready
../build/debug/rethinkdb --directory cluster_directory_1 --machine-name Aphrodite --port-offset 1 --bind all --join h9:29015
info: Running rethinkdb 1.11.3-567-g377515 (debug) (GCC 4.8.2)...
info: Running on Linux 3.13.4-1-ARCH x86_64
info: Loading data from directory /home/michel/projects/rethinkdb-all/rethinkdb/scripts/cluster_directory_1
info: Our machine ID is 53b4aad6-1b2a-43bf-8922-1bb9242bba8a
info: Listening for intracluster connections on port 29016
info: Attempting connection to 1 peer...
info: Connected to server "Lapetus" 720507fe-80ae-4f53-9e5e-98df6e0934c1
info: Listening for client driver connections on port 28016
info: Listening for administrative HTTP connections on port 8081
info: Connected to server "Pontus" 53b4aad6-1b2a-43bf-8922-1bb9242bba8a
info: Listening on addresses: 127.0.0.1, 192.168.42.93, ::1, ::ffff:192.168.42.93, fe80::2ed0:5aff:fe6e:473f%3
info: Server ready
CTRL-C to kill me http requests can be sent to ports: 1 , 3 
info: Applying data {"rdb_namespaces":{"dc85ca94-ad17-49b4-880b-e43a83515be0":{"replica_affinities":{"00000000-0000-0000-0000-000000000000":1},"ack_expectations":{"00000000-0000-0000-0000-000000000000":{"expectation":1,"hard_durability":true}}}}}
info: Applying data {"rdb_namespaces":{"dc85ca94-ad17-49b4-880b-e43a83515be0":{"replica_affinities":{"00000000-0000-0000-0000-000000000000":0},"ack_expectations":{"00000000-0000-0000-0000-000000000000":{"expectation":1,"hard_durability":true}}}}}
info: Applying data {"rdb_namespaces":{"dc85ca94-ad17-49b4-880b-e43a83515be0":{"replica_affinities":{"00000000-0000-0000-0000-000000000000":1},"ack_expectations":{"00000000-0000-0000-0000-000000000000":{"expectation":1,"hard_durability":true}}}}}
info: Applying data {"rdb_namespaces":{"dc85ca94-ad17-49b4-880b-e43a83515be0":{"replica_affinities":{"00000000-0000-0000-0000-000000000000":0},"ack_expectations":{"00000000-0000-0000-0000-000000000000":{"expectation":1,"hard_durability":true}}}}}
info: Applying data {"rdb_namespaces":{"dc85ca94-ad17-49b4-880b-e43a83515be0":{"replica_affinities":{"00000000-0000-0000-0000-000000000000":1},"ack_expectations":{"00000000-0000-0000-0000-000000000000":{"expectation":1,"hard_durability":true}}}}}
info: Applying data {"rdb_namespaces":{"dc85ca94-ad17-49b4-880b-e43a83515be0":{"replica_affinities":{"00000000-0000-0000-0000-000000000000":0},"ack_expectations":{"00000000-0000-0000-0000-000000000000":{"expectation":1,"hard_durability":true}}}}}
info: Applying data {"rdb_namespaces":{"dc85ca94-ad17-49b4-880b-e43a83515be0":{"replica_affinities":{"00000000-0000-0000-0000-000000000000":1},"ack_expectations":{"00000000-0000-0000-0000-000000000000":{"expectation":1,"hard_durability":true}}}}}
info: Applying data {"rdb_namespaces":{"dc85ca94-ad17-49b4-880b-e43a83515be0":{"replica_affinities":{"00000000-0000-0000-0000-000000000000":0},"ack_expectations":{"00000000-0000-0000-0000-000000000000":{"expectation":1,"hard_durability":true}}}}}
info: Applying data {"rdb_namespaces":{"dc85ca94-ad17-49b4-880b-e43a83515be0":{"replica_affinities":{"00000000-0000-0000-0000-000000000000":1},"ack_expectations":{"00000000-0000-0000-0000-000000000000":{"expectation":1,"hard_durability":true}}}}}
info: Applying data {"rdb_namespaces":{"dc85ca94-ad17-49b4-880b-e43a83515be0":{"replica_affinities":{"00000000-0000-0000-0000-000000000000":0},"ack_expectations":{"00000000-0000-0000-0000-000000000000":{"expectation":1,"hard_durability":true}}}}}
info: Applying data {"rdb_namespaces":{"dc85ca94-ad17-49b4-880b-e43a83515be0":{"replica_affinities":{"00000000-0000-0000-0000-000000000000":1},"ack_expectations":{"00000000-0000-0000-0000-000000000000":{"expectation":1,"hard_durability":true}}}}}
info: Applying data {"rdb_namespaces":{"dc85ca94-ad17-49b4-880b-e43a83515be0":{"replica_affinities":{"00000000-0000-0000-0000-000000000000":0},"ack_expectations":{"00000000-0000-0000-0000-000000000000":{"expectation":1,"hard_durability":true}}}}}
info: Applying data {"rdb_namespaces":{"dc85ca94-ad17-49b4-880b-e43a83515be0":{"replica_affinities":{"00000000-0000-0000-0000-000000000000":1},"ack_expectations":{"00000000-0000-0000-0000-000000000000":{"expectation":1,"hard_durability":true}}}}}
info: Applying data {"rdb_namespaces":{"dc85ca94-ad17-49b4-880b-e43a83515be0":{"replica_affinities":{"00000000-0000-0000-0000-000000000000":0},"ack_expectations":{"00000000-0000-0000-0000-000000000000":{"expectation":1,"hard_durability":true}}}}}
info: Applying data {"rdb_namespaces":{"dc85ca94-ad17-49b4-880b-e43a83515be0":{"replica_affinities":{"00000000-0000-0000-0000-000000000000":1},"ack_expectations":{"00000000-0000-0000-0000-000000000000":{"expectation":1,"hard_durability":true}}}}}
info: Applying data {"rdb_namespaces":{"dc85ca94-ad17-49b4-880b-e43a83515be0":{"replica_affinities":{"00000000-0000-0000-0000-000000000000":0},"ack_expectations":{"00000000-0000-0000-0000-000000000000":{"expectation":1,"hard_durability":true}}}}}
info: Applying data {"rdb_namespaces":{"dc85ca94-ad17-49b4-880b-e43a83515be0":{"replica_affinities":{"00000000-0000-0000-0000-000000000000":1},"ack_expectations":{"00000000-0000-0000-0000-000000000000":{"expectation":1,"hard_durability":true}}}}}
info: Applying data {"rdb_namespaces":{"dc85ca94-ad17-49b4-880b-e43a83515be0":{"replica_affinities":{"00000000-0000-0000-0000-000000000000":0},"ack_expectations":{"00000000-0000-0000-0000-000000000000":{"expectation":1,"hard_durability":true}}}}}
info: Applying data {"rdb_namespaces":{"dc85ca94-ad17-49b4-880b-e43a83515be0":{"replica_affinities":{"00000000-0000-0000-0000-000000000000":1},"ack_expectations":{"00000000-0000-0000-0000-000000000000":{"expectation":1,"hard_durability":true}}}}}
info: Applying data {"rdb_namespaces":{"dc85ca94-ad17-49b4-880b-e43a83515be0":{"replica_affinities":{"00000000-0000-0000-0000-000000000000":0},"ack_expectations":{"00000000-0000-0000-0000-000000000000":{"expectation":1,"hard_durability":true}}}}}
info: Applying data {"rdb_namespaces":{"dc85ca94-ad17-49b4-880b-e43a83515be0":{"replica_affinities":{"00000000-0000-0000-0000-000000000000":1},"ack_expectations":{"00000000-0000-0000-0000-000000000000":{"expectation":1,"hard_durability":true}}}}}
info: Applying data {"rdb_namespaces":{"dc85ca94-ad17-49b4-880b-e43a83515be0":{"replica_affinities":{"00000000-0000-0000-0000-000000000000":0},"ack_expectations":{"00000000-0000-0000-0000-000000000000":{"expectation":1,"hard_durability":true}}}}}
info: Applying data {"rdb_namespaces":{"dc85ca94-ad17-49b4-880b-e43a83515be0":{"replica_affinities":{"00000000-0000-0000-0000-000000000000":1},"ack_expectations":{"00000000-0000-0000-0000-000000000000":{"expectation":1,"hard_durability":true}}}}}
info: Applying data {"rdb_namespaces":{"dc85ca94-ad17-49b4-880b-e43a83515be0":{"replica_affinities":{"00000000-0000-0000-0000-000000000000":0},"ack_expectations":{"00000000-0000-0000-0000-000000000000":{"expectation":1,"hard_durability":true}}}}}
info: Applying data {"rdb_namespaces":{"dc85ca94-ad17-49b4-880b-e43a83515be0":{"replica_affinities":{"00000000-0000-0000-0000-000000000000":1},"ack_expectations":{"00000000-0000-0000-0000-000000000000":{"expectation":1,"hard_durability":true}}}}}
info: Applying data {"rdb_namespaces":{"dc85ca94-ad17-49b4-880b-e43a83515be0":{"replica_affinities":{"00000000-0000-0000-0000-000000000000":0},"ack_expectations":{"00000000-0000-0000-0000-000000000000":{"expectation":1,"hard_durability":true}}}}}
info: Applying data {"rdb_namespaces":{"dc85ca94-ad17-49b4-880b-e43a83515be0":{"replica_affinities":{"00000000-0000-0000-0000-000000000000":1},"ack_expectations":{"00000000-0000-0000-0000-000000000000":{"expectation":1,"hard_durability":true}}}}}
Version: rethinkdb 1.11.3-567-g377515 (debug) (GCC 4.8.2)
error: Error in ./src/clustering/administration/http/cyanide.hpp at line 11:
error: Goodbye sweet world
error: Backtrace:
error: Sun Feb 23 21:35:15 2014

       1: rethinkdb_backtrace(void**, int) at rethinkdb_backtrace.cc:99
       2: backtrace_t::backtrace_t() at backtrace.cc:202 (discriminator 1)
       3: lazy_backtrace_formatter_t::lazy_backtrace_formatter_t() at backtrace.cc:282
       4: format_backtrace(bool) at backtrace.cc:197
       5: report_fatal_error(char const*, int, char const*, ...) at errors.cc:76 (discriminator 1)
       6: cyanide_http_app_t::handle(http_req_t const&, http_res_t*, signal_t*) at cyanide.hpp:11
       7: routing_http_app_t::handle(http_req_t const&, http_res_t*, signal_t*) at routing_app.cc:29 (discriminator 1)
       8: routing_http_app_t::handle(http_req_t const&, http_res_t*, signal_t*) at routing_app.cc:29 (discriminator 1)
       9: http_server_t::handle_conn(scoped_ptr_t<linux_tcp_conn_descriptor_t> const&, auto_drainer_t::lock_t) at http.cc:459
       10: boost::_mfi::mf2<void, http_server_t, scoped_ptr_t<linux_tcp_conn_descriptor_t> const&, auto_drainer_t::lock_t>::operator()(http_server_t*, scoped_ptr_t<linux_tcp_conn_descriptor_t> const&, auto_drainer_t::lock_t) const at mem_fn_template.hpp:280 (discriminator 4)
       11: void boost::_bi::list3<boost::_bi::value<http_server_t*>, boost::arg<1>, boost::_bi::value<auto_drainer_t::lock_t> >::operator()<boost::_mfi::mf2<void, http_server_t, scoped_ptr_t<linux_tcp_conn_descriptor_t> const&, auto_drainer_t::lock_t>, boost::_bi::list1<scoped_ptr_t<linux_tcp_conn_descriptor_t>&> >(boost::_bi::type<void>, boost::_mfi::mf2<void, http_server_t, scoped_ptr_t<linux_tcp_conn_descriptor_t> const&, auto_drainer_t::lock_t>&, boost::_bi::list1<scoped_ptr_t<linux_tcp_conn_descriptor_t>&>&, int) at bind.hpp:392 (discriminator 1)
       12: void boost::_bi::bind_t<void, boost::_mfi::mf2<void, http_server_t, scoped_ptr_t<linux_tcp_conn_descriptor_t> const&, auto_drainer_t::lock_t>, boost::_bi::list3<boost::_bi::value<http_server_t*>, boost::arg<1>, boost::_bi::value<auto_drainer_t::lock_t> > >::operator()<scoped_ptr_t<linux_tcp_conn_descriptor_t> >(scoped_ptr_t<linux_tcp_conn_descriptor_t>&) at bind_template.hpp:32
       13: boost::detail::function::void_function_obj_invoker1<boost::_bi::bind_t<void, boost::_mfi::mf2<void, http_server_t, scoped_ptr_t<linux_tcp_conn_descriptor_t> const&, auto_drainer_t::lock_t>, boost::_bi::list3<boost::_bi::value<http_server_t*>, boost::arg<1>, boost::_bi::value<auto_drainer_t::lock_t> > >, void, scoped_ptr_t<linux_tcp_conn_descriptor_t>&>::invoke(boost::detail::function::function_buffer&, scoped_ptr_t<linux_tcp_conn_descriptor_t>&) at function_template.hpp:154
       14: boost::function1<void, scoped_ptr_t<linux_tcp_conn_descriptor_t>&>::operator()(scoped_ptr_t<linux_tcp_conn_descriptor_t>&) const at function_template.hpp:767
       15: linux_nonthrowing_tcp_listener_t::handle(int) at network.cc:925 (discriminator 1)
       16: void std::_Mem_fn<void (linux_nonthrowing_tcp_listener_t::*)(int)>::operator()<int&, void>(linux_nonthrowing_tcp_listener_t*, int&) const at functional:601 (discriminator 3)
       17: void std::_Bind<std::_Mem_fn<void (linux_nonthrowing_tcp_listener_t::*)(int)> (linux_nonthrowing_tcp_listener_t*, int)>::__call<void, , 0ul, 1ul>(std::tuple<>&&, std::_Index_tuple<0ul, 1ul>) at functional:1296
       18: void std::_Bind<std::_Mem_fn<void (linux_nonthrowing_tcp_listener_t::*)(int)> (linux_nonthrowing_tcp_listener_t*, int)>::operator()<, void>() at functional:1355
       19: callable_action_instance_t<std::_Bind<std::_Mem_fn<void (linux_nonthrowing_tcp_listener_t::*)(int)> (linux_nonthrowing_tcp_listener_t*, int)> >::run_action() at callable_action.hpp:28
       20: callable_action_wrapper_t::run() at runtime_utils.cc:44
       21: coro_t::run() at coroutines.cc:198
       22: void coro_t::spawn_now_dangerously<std::_Bind<std::_Mem_fn<void (linux_nonthrowing_tcp_listener_t::*)(int)> (linux_nonthrowing_tcp_listener_t*, int)> >(std::_Bind<std::_Mem_fn<void (linux_nonthrowing_tcp_listener_t::*)(int)> (linux_nonthrowing_tcp_listener_t*, int)> const&) at coroutines.hpp:51
       23: linux_nonthrowing_tcp_listener_t::accept_loop(auto_drainer_t::lock_t) at network.cc:893 (discriminator 1)
       24: void std::_Mem_fn<void (linux_nonthrowing_tcp_listener_t::*)(auto_drainer_t::lock_t)>::operator()<auto_drainer_t::lock_t&, void>(linux_nonthrowing_tcp_listener_t*, auto_drainer_t::lock_t&) const at functional:601 (discriminator 4)
       25: void std::_Bind<std::_Mem_fn<void (linux_nonthrowing_tcp_listener_t::*)(auto_drainer_t::lock_t)> (linux_nonthrowing_tcp_listener_t*, auto_drainer_t::lock_t)>::__call<void, , 0ul, 1ul>(std::tuple<>&&, std::_Index_tuple<0ul, 1ul>) at functional:1296
       26: void std::_Bind<std::_Mem_fn<void (linux_nonthrowing_tcp_listener_t::*)(auto_drainer_t::lock_t)> (linux_nonthrowing_tcp_listener_t*, auto_drainer_t::lock_t)>::operator()<, void>() at functional:1355
       27: callable_action_instance_t<std::_Bind<std::_Mem_fn<void (linux_nonthrowing_tcp_listener_t::*)(auto_drainer_t::lock_t)> (linux_nonthrowing_tcp_listener_t*, auto_drainer_t::lock_t)> >::run_action() at callable_action.hpp:28
       28: callable_action_wrapper_t::run() at runtime_utils.cc:44
       29: coro_t::run() at coroutines.cc:198
       30: coro_t* coro_t::spawn_sometime<std::_Bind<std::_Mem_fn<void (linux_nonthrowing_tcp_listener_t::*)(auto_drainer_t::lock_t)> (linux_nonthrowing_tcp_listener_t*, auto_drainer_t::lock_t)> >(std::_Bind<std::_Mem_fn<void (linux_nonthrowing_tcp_listener_t::*)(auto_drainer_t::lock_t)> (linux_nonthrowing_tcp_listener_t*, auto_drainer_t::lock_t)> const&) at coroutines.hpp:57
       31: linux_nonthrowing_tcp_listener_t::begin_listening() at network.cc:674 (discriminator 1)
       32: linux_tcp_listener_t::linux_tcp_listener_t(std::set<ip_address_t, std::less<ip_address_t>, std::allocator<ip_address_t> > const&, int, boost::function<void (scoped_ptr_t<linux_tcp_conn_descriptor_t>&)> const&) at network.cc:958 (discriminator 1)
       33: http_server_t::http_server_t(std::set<ip_address_t, std::less<ip_address_t>, std::allocator<ip_address_t> > const&, int, http_app_t*) at http.cc:338 (discriminator 1)
       34: administrative_http_server_manager_t::administrative_http_server_manager_t(std::set<ip_address_t, std::less<ip_address_t>, std::allocator<ip_address_t> > const&, int, mailbox_manager_t*, metadata_change_handler_t<cluster_semilattice_metadata_t>*, metadata_change_handler_t<auth_semilattice_metadata_t>*, boost::shared_ptr<semilattice_readwrite_view_t<cluster_semilattice_metadata_t> >, clone_ptr_t<watchable_t<change_tracking_map_t<peer_id_t, cluster_directory_metadata_t> > >, namespace_repo_t<memcached_protocol_t>*, namespace_repo_t<rdb_protocol_t>*, admin_tracker_t*, http_app_t*, uuid_u, std::string) at server.cc:274 (discriminator 1)
       35: do_serve(io_backender_t*, bool, base_path_t const&, metadata_persistence::cluster_persistent_file_t*, metadata_persistence::auth_persistent_file_t*, peer_address_set_t const&, service_address_ports_t, std::string, os_signal_cond_t*, boost::optional<std::string> const&) at serve.cc:419 (discriminator 1)
       36: serve(io_backender_t*, base_path_t const&, metadata_persistence::cluster_persistent_file_t*, metadata_persistence::auth_persistent_file_t*, peer_address_set_t const&, service_address_ports_t, std::string, os_signal_cond_t*, boost::optional<std::string> const&) at serve.cc:498 (discriminator 1)
       37: run_rethinkdb_serve(base_path_t const&, serve_info_t const&, file_direct_io_mode_t, int, uuid_u const*, cluster_semilattice_metadata_t const*, directory_lock_t*, bool*) at command_line.cc:768 (discriminator 5)
       38: run_rethinkdb_porcelain(base_path_t const&, name_string_t const&, file_direct_io_mode_t, int, bool, serve_info_t const&, directory_lock_t*, bool*) at command_line.cc:791
       39: void std::_Bind<void (*(base_path_t, name_string_t, file_direct_io_mode_t, int, bool, serve_info_t, directory_lock_t*, bool*))(base_path_t const&, name_string_t const&, file_direct_io_mode_t, int, bool, serve_info_t const&, directory_lock_t*, bool*)>::__call<void, , 0ul, 1ul, 2ul, 3ul, 4ul, 5ul, 6ul, 7ul>(std::tuple<>&&, std::_Index_tuple<0ul, 1ul, 2ul, 3ul, 4ul, 5ul, 6ul, 7ul>) at functional:1296
       40: void std::_Bind<void (*(base_path_t, name_string_t, file_direct_io_mode_t, int, bool, serve_info_t, directory_lock_t*, bool*))(base_path_t const&, name_string_t const&, file_direct_io_mode_t, int, bool, serve_info_t const&, directory_lock_t*, bool*)>::operator()<, void>() at functional:1355
       41: std::_Function_handler<void (), std::_Bind<void (*(base_path_t, name_string_t, file_direct_io_mode_t, int, bool, serve_info_t, directory_lock_t*, bool*))(base_path_t const&, name_string_t const&, file_direct_io_mode_t, int, bool, serve_info_t const&, directory_lock_t*, bool*)> >::_M_invoke(std::_Any_data const&) at functional:2073
       42: std::function<void ()>::operator()() const at functional:2465
       43: starter_t::run_wrapper(std::function<void ()> const&) at runtime.cc:59
       44: void std::_Mem_fn<void (starter_t::*)(std::function<void ()> const&)>::operator()<std::function<void ()>&, void>(starter_t*, std::function<void ()>&) const at functional:601 (discriminator 3)
       45: void std::_Bind<std::_Mem_fn<void (starter_t::*)(std::function<void ()> const&)> (starter_t*, std::function<void ()>)>::__call<void, , 0ul, 1ul>(std::tuple<>&&, std::_Index_tuple<0ul, 1ul>) at functional:1296
       46: void std::_Bind<std::_Mem_fn<void (starter_t::*)(std::function<void ()> const&)> (starter_t*, std::function<void ()>)>::operator()<, void>() at functional:1355
       47: std::_Function_handler<void (), std::_Bind<std::_Mem_fn<void (starter_t::*)(std::function<void ()> const&)> (starter_t*, std::function<void ()>)> >::_M_invoke(std::_Any_data const&) at functional:2073
       48: std::function<void ()>::operator()() const at functional:2465
       49: callable_action_instance_t<std::function<void ()> >::run_action() at callable_action.hpp:28
       50: callable_action_wrapper_t::run() at runtime_utils.cc:44
       51: coro_t::run() at coroutines.cc:198
       52: coro_t* coro_t::spawn_sometime<std::function<void ()> >(std::function<void ()> const&) at coroutines.hpp:57
       53: starter_t::on_thread_switch() at runtime.cc:55
       54: linux_message_hub_t::on_event(int) at message_hub.cc:153
       55: epoll_event_queue_t::run() at epoll.cc:101
       56: linux_thread_pool_t::start_thread(void*) at thread_pool.cc:159
       57: /usr/lib/libpthread.so.0(+0x80a2) [0x7fb14a37b0a2] at 0x7fb14a37b0a2 (/usr/lib/libpthread.so.0)
       58: clone+0x6d at 0x7fb14a0b0d1d (/usr/lib/libc.so.6)
error: Exiting.
info: Disconnected from server "Pontus" 53b4aad6-1b2a-43bf-8922-1bb9242bba8a
info: Deleting /machines/53b4aad6-1b2a-43bf-8922-1bb9242bba8a
error: Namespace dc85ca94-ad17-49b4-880b-e43a83515be0 has unsatisfiable goals
info: Applying data {"rdb_namespaces":{"dc85ca94-ad17-49b4-880b-e43a83515be0":{"replica_affinities":{"00000000-0000-0000-0000-000000000000":0},"ack_expectations":{"00000000-0000-0000-0000-000000000000":{"expectation":1,"hard_durability":true}}}}}

Putting in 1.12.
Feel free to assign the issue or move it to a different milestone.

Activity

  1. added this to the 1.12 milestone on Feb 24, 2014
  2. danielmewes commented on Feb 24, 2014

    @danielmewes
    Member

    I saw this too while trying to reproduce #2003.

  3. danielmewes commented on Feb 24, 2014

    @danielmewes
    Member

    Will look into this today.

  4. self-assigned this
    on Feb 24, 2014
  5. coffeemug commented on Feb 24, 2014

    @coffeemug
    Contributor

    @danielmewes -- have you talked to @Tryneus? He might be helpful with this.

  6. Tryneus commented on Feb 24, 2014

    @Tryneus
    Member

    Working on this now.

  7. Tryneus commented on Feb 25, 2014

    @Tryneus
    Member

    Ok, so I have been able to reproduce this without too much trouble. For reference, here are the steps:

    1. Spin up a cluster with two nodes
    2. Populate a table with stress, 50k rows should be fine
    3. Set the replicas from 1 to 2
    4. Kill the server hosting the primary before backfilling completes
    5. Declare the killed server dead
    6. Set the replicas from 2 to 1

    At this point, the reactors for the shards should be observed to be stuck in the primary_when_safe state.

    It was not necessary to cyanide the server or kill -KILL it, a SIGINT followed by orderly shutdown worked fine. Any shards which have finished backfilling will properly enter the primary state.

  8. Tryneus commented on Feb 26, 2014

    @Tryneus
    Member

    Good news, everyone! This problem exists in 1.11.x as well, so it's not a result of anyone's recent refactors! Unfortunately, that means this has been in for god knows how long. After an inspection of the code, it appears that the metainfo block knows that there's a newer version out there, so it's trying to backfill it before becoming primary. Seeing as there is no newer version available in the cluster anymore, we need some way for the reactors to realize this. Investigating options.

  9. Tryneus commented on Feb 27, 2014

    @Tryneus
    Member

    So, I think there is only really one option we have in this case:

    When a reactor is starting a primary role, it has a list of latest branch versions it needs to backfill before it can begin serving data (this is the primary_when_safe state). I propose that if both:

    • All machines in the cluster (not just those connected to) have been checked for which version they have
    • The latest versions cannot be found elsewhere in the cluster

    Then there is no way to recover that data and we can go ahead with blowing away the data that we cannot find. The only foreseeable problem I can think of is that there may be other secondaries which contain metainfo saying that this missing 'latest version' exists somewhere, and we may need to clear that somehow (I'm mostly worried about this causing problems with branch history or something like that).

    I'll go ahead and implement this, then do some testing (it shouldn't be hard to trip that situation), and see what comes up.

  10. coffeemug commented on Feb 27, 2014

    @coffeemug
    Contributor

    Pinging @timmaxw. Could your review the proposed solution (in case @Tryneus missed something)?

  11. timmaxw commented on Feb 27, 2014

    @timmaxw
    Member

    I agree with the diagnosis, but not the proposed solution.

    I'd like to begin by providing a more detailed description of what's going on:

    The metainfo block associates a version_range_t with each range of keys on disk. The version_range_t consists of two version_ts. In normal operation, the two version_ts are equal, and they indicate whatever version of the data is currently present on the disk. During a backfill, the first version_ts is set to the version that we started the backfill from, and the second one is set to the version that the backfill ends at. When the two version_ts differ, the version_range_t is said to be "incoherent". In normal operation, they will both be set to the later version_t as soon as the backfill is over, and then things will proceed as normal.

    In this situation, the backfill is interrupted, so the data on disk is a partial copy of the data that the dead primary had. The version_range_t in the metainfo is left incoherent; its first version_t is the "zero" version_t, and its second version_t is the version_t that the former primary was at when the secondary began backfilling.

    When a node is trying to become primary, it determines the most recent version of the data, then tries to find a coherent copy of that most recent version. If it doesn't find one, then it blocks, as Michel discovered. This is intentional; we assumed something else would resolve the situation and allow the reactor to proceed. There are two ways for the cluster to resolve this situation, and neither is ideal:

    1. We can rewind to the last version for which a coherent copy is available. In practice, we would implement this by determining which version that is, and then blowing away any incoherent versions for which the second version_t is after the coherent version we are rewinding to. After the data is blown away, the coherent version will be the most recent version visible to the cluster, so the cluster will happily backfill from it and then proceed as normal.

      The obvious problem with this is that it destroys data. For example, in the particular situation that prompted this bug report, this would mean deleting all of the data.

    2. We can take whatever data is currently available, and declare it to be valid. In practice, we would implement this by constructing a new version_t that is the successor to the second version_t of the incoherent version_range_t, and then re-tagging whatever data that we have with that version_t. This will make it both coherent and a successor to every other version available, so the cluster will proceed normally.

      If we resolve the problem this way, we get to keep whatever data was successfully backfilled. But even so, we will lose some data. Also, we lose ordering guarantees. Normally, if a client makes a write, waits for an ack, then makes a second write, then it's impossible for the second write to be visible and the first not visible. But this re-tagging will break that guarantee, which might confuse some applications. So this method is not strictly better than the other for some applications; in particular, keep in mind that the most recent coherent version might only be a tiny bit out of data.

    Since we can't recover the data perfectly by either method, and neither method of recovery is strictly better than the other, I think we should require admin intervention. In fact, this is what we originally planned to implement, if I recall correctly; there are comments in reactor_t saying that the administrator should intervene if this happens.

    Here's how we would implement it: Any node can determine that there is a deadlock by examining the directory. It should then display an issue in the web UI. The admin should see an explanation of the problem. They should be able to choose between the two options above. We can show a message of the form, "If you choose to return to the most recent coherent version, you will lose the most recent X writes out of Y writes total." (X and Y can be computed by looking at the version_ts.) When the admin clicks the button, the node that is running the admin UI will send a message to the node(s) that need to blow away or re-tag their data. We could send this message via a mailbox in the reactor_business_card_t; or, there might be a way to send the message via the semilattices. The nodes react to the message by blowing away or re-tagging their data. When these changes are made, they are announced via the directory, so every machine can see that the problem has been resolved. Then the issue in the web UI goes away, the reactor_t unblocks itself, and the cluster proceeds as normal.

  12. coffeemug commented on Feb 27, 2014

    @coffeemug
    Contributor

    I think we should require admin intervention.

    Considering that:

    • This issue has been there all along
    • It's a rare enough thing
    • It's not even a thing if the server is configured well
    • To get it they have to declare a machine dead (which warns people in big bright red letters that they might lose data)
    • Both options are pretty bad and it's the best you can do
    • There are other important things to fix

    I think we should pick the easiest option, implement it for now, and then do the right thing in 2.x. Which of the options is easier to implement?

  13. 15 remaining items

  14. coffeemug commented on Feb 28, 2014

    @coffeemug
    Contributor

    Also, this is very important, but seems outside of scope of 1.12. Ok if I move it to subsequent?

  15. timmaxw commented on Feb 28, 2014

    @timmaxw
    Member

    We could do it by storing the information from the backfill on a secondary separately, and then either just dropping it all, or applying it all to the btree in a batch.

    This is easy if the backfill is small. If the backfill is large, we'll need another solution. We might be able to start by buffering the backfill, then revert to the current behavior if the buffer gets too big. Unfortunately, this only reduces the probability of the worst case; we still have to handle it if it happens. Another option is to implement persistent snapshotting (which would probably require serializer support): take a snapshot before starting the backfill, then revert to that snapshot if the backfill is cut short. There are also other solutions, like having the backfill and the old data coexist in the B-tree until the backfill is over, then deleting the old data.

    Perhaps a better approach is #1944. Suppose that we implement incremental backfilling that's guaranteed to proceed in lexicographical order. Then there's no such thing as an incoherent state; if the backfill is interrupted, some keys are in a coherent old state while the rest are in a coherent new state. There's no danger of randomly losing rows from a year ago. This can still lead to problems if there are rows that cross-reference each other, but the problems are now equivalent to #2039.

  16. coffeemug commented on Feb 28, 2014

    @coffeemug
    Contributor

    If the backfill is large, we'll need another solution.

    I meant create a new b-tree on disk for the backfill, dump the backfill in there, then if/when it's done, traverse the tree, update the "main" tree, and when that's done, delete the backfill tree.

    What you/@danielmewes are proposing (#1944) seems way better, though. I think we should do that.

  17. danielmewes commented on Feb 28, 2014

    @danielmewes
    Member

    @timmaxw 's suggestion about doing a continuous backfill in key-order sounds really good.

    Currently we have two relevant types of backfill chunks. key/value pairs and erase_range chunks. The erase_range ones are used if the backfiller encounters a leaf node and doesn't know for certain if some keys might have been deleted from it that the backfillee still has in its table. Then it sends the erase_range to delete essentially all keys in that leaf, followed by a couple of key/value chunks to restore all of the current key/value pairs in the leaf.

    We would have to combine both of them into a single (semantic) chunk. The backfillee would not process the erase_range before it hasn't got all relevant key/value pairs that are required to restore the correct content. Then it would execute both the erase followed by the key/value inserts in a single transaction.
    That way, we can make sure that the backfillee always has a consistent data state up to a certain well defined key.

  18. coffeemug commented on Mar 3, 2014

    @coffeemug
    Contributor

    Moving to subsequent -- this is very much outside of the scope of 1.12.

  19. modified the milestones: subsequent, 1.12 on Mar 3, 2014
  20. assigned and unassigned on Oct 28, 2014
  21. danielmewes commented on Mar 24, 2015

    @danielmewes
    Member

    Superseded by #3886, which is going to fix this,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions