Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a deadlock when leader change if enable leader-only option. #390

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

halfcrazy
Copy link
Contributor

@halfcrazy halfcrazy commented Sep 27, 2024

ovsdbClient.connect and ovsdbClient.update3 share the same monitorsMutex mutex.
When client.WithLeaderOnly(true) is enabled, the client will monitor an extra _Server db and a monitor_cond rpc call will be sent to the server. If another db sends an update3 notification to the client, the client will hold the lock, and reconnect will be trapped.

Example

Send:
{"method":"monitor_cond","params":["_Server",{"databaseName":"_Server","id":"4f28761d-af23-4319-932d-575ecdd42490"},{"Database":{"columns":["connected","name","leader","schema","model","cid","sid","index"],"select":{"initial":true,"insert":true,"delete":true,"modify":true}}}],"id":6}

Receive:
{"method":"update3","params":[{"databaseName":"OVN_Southbound","id":"ed31e0c7-e8e2-4cfc-a0a0-406c9101e10c"},"3632aaa0-0f7a-4ace-bc83-c92c11721b5a",{"Port_Binding":{"77189bff-b4e3-4c15-9967-4518036b9a11":{"modify":{"virtual_parent":"06:73:24:4c:a3:97~2024-09-25 08:02:04.295"}}}}],"id":null}

Receive:
{"method":"update3","params":[{"databaseName":"OVN_Southbound","id":"ed31e0c7-e8e2-4cfc-a0a0-406c9101e10c"},"d5cd59ad-9b93-45b0-aae1-49aba76c8bfa",{"Port_Binding":{"d4c91e40-87e1-42e0-833f-65d283f82774":{"modify":{"tag":["set",[]]}}}}],"id":null}

Receive:
{"error":null,"result":{"Database":{"567d36ac-96f8-4c84-b75a-2d50e4d83899":{"initial":{"cid":["uuid","fd210308-efda-4b70-bcba-1fe783bfbb8b"],"connected":true,"index":13418638,"leader":true,"model":"clustered","name":"OVN_Southbound","schema":"{\"cksum\":\"2434354435 32938\",\"name\":\"OVN_Southbound\",\"tables\":{\"Address_Set\":{\"columns\":{\"addresses\":{\"type\":{\"key\":\"string\",\"max\":\"unlimited\",\"min\":0}},\"name\":{\"type\":\"string\"}},\"indexes\":[[\"name\"]],\"isRoot\":true},\"BFD\":{\"columns\":{\"detect_mult\":{\"type\":\"integer\"},\"disc\":{\"type\":\"integer\"},\"dst_ip\":{\"type\":\"string\"},\"external_ids\":{\"type\":{\"key\":\"string\",\"max\":\"unlimited\",\"min\":0,\"value\":\"string\"}},\"logical_port\":{\"type\":\"string\"},\"min_rx\":{\"type\":\"integer\"},\"min_tx\":{\"type\":\"integer\"},\"options\":{\"type\":{\"key\":\"string\",\"max\":\"unlimited\",\"min\":0,\"value\":\"string\"}},\"src_port\":{\"type\":{\"key\":{\"maxInteger\":65535,\"minInteger\":49152,\"type\":\"integer\"}}},\"status\":{\"type\":{\"key\":{\"enum\":[\"set\",[\"admin_down\",\"down\",\"init\",\"up\"]],\"type\":\"string\"}}}},\"indexes\":[[\"logical_port\",\"dst_ip\",\"src_port\",\"disc\"]],\"isRoot\":true},\"Chassis\":{\"columns\":{\"encaps\":{\"type\":{\"key\":{\"refTable\":\"Encap\",\"type\":\"uuid\"},\"max\":\"unlimited\"}},\"external_ids\":{\"type\":{\"key\":\"string\",\"max\":\"unlimited\",\"min\":0,\"value\":\"string\"}},\"hostname\":{\"type\":\"string\"},\"name\":{\"type\":\"string\"},\"nb_cfg\":{\"type\":\"integer\"},\"other_config\":{\"type\":{\"key\":\"string\",\"max\":\"unlimited\",\"min\":0,\"value\":\"string\"}},\"transport_zones\":{\"type\":{\"key\":\"string\",\"max\":\"unlimited\",\"min\":0}},\"vtep_logical_switches\":{\"type\":{\"key\":\"string\",\"max\":\"unlimited\",\"min\":0}}},\"indexes\":[[\"name\"]],\"isRoot\":true},\"Chassis_Private\":{\"columns\":{\"chassis\":{\"type\":{\"key\":{\"refTable\":\"Chassis\",\"refType\":\"weak\",\"type\":\"uuid\"},\"min\":0}},\"external_ids\":{\"type\":{\"key\":\"string\",\"max\":\"unlimited\",\"min\":0,\"value\":\"string\"}},\"name\":{\"type\":\"string\"},\"nb_cfg\":{\"type\":\"integer\"},\"nb_cfg_timestamp\":{\"type\":\"integer\"}},\"indexes\":[[\"name\"]],\"isRoot\":true},\"Color\":{\"columns\":{\"external_ids\":{\"type\":{\"key\":\"string\",\"max\":\"unlimited\",\"min\":0,\"value\":\"string\"}},\"filter\":{\"type\":{\"key\":{\"enum\":[\"set\",[\"both\",\"from-lport\",\"to-lport\"]],\"type\":\"string\"}}},\"index\":{\"type\":\"integer\"},\"name\":{\"type\":\"string\"},\"seq_no\":{\"type\":{\"key\":{\"maxInteger\":4294967295,\"minInteger\":0,\"type\":\"integer\"}}},\"sink\":{\"type\":\"string\"},\"type\":{\"type\":{\"key\":{\"enum\":\"color\",\"type\":\"string\"}}}},\"indexes\":[[\"name\"]],\"isRoot\":true},\"Connection\":{\"columns\":{\"external_ids\":{\"type\":{\"key\":\"string\",\"max\":\"unlimited\",\"min\":0,\"value\":\"string\"}},\"inactivity_probe\":{\"type\":{\"key\":\"integer\",\"min\":0}},\"is_connected\":{\"type\":\"boolean\"},\"max_backoff\":{\"type\":{\"key\":{\"minInteger\":1000,\"type\":\"integer\"},\"min\":0}},\"other_config\":{\"type\":{\"key\":\"string\",\"max\":\"unlimited\",\"min\":0,\"value\":\"string\"}},\"read_only\":{\"type\":\"boolean\"},\"role\":{\"type\":\"string\"},\"status\":{\"type\":{\"key\":\"string\",\"max\":\"unlimited\",\"min\":0,\"value\":\"string\"}},\"target\":{\"type\":\"string\"}},\"indexes\":[[\"target\"]]},\"Controller_Event\":{\"columns\":{\"chassis\":{\"type\":{\"key\":{\"refTable\":\"Chassis\",\"refType\":\"weak\",\"type\":\"uuid\"},\"min\":0}},\"event_info\":{\"type\":{\"key\":\"string\",\"max\":\"unlimited\",\"min\":0,\"value\":\"string\"}},\"event_type\":{\"type\":{\"key\":{\"enum\":\"empty_lb_backends\",\"type\":\"string\"}}},\"seq_num\":{\"type\":\"integer\"}},\"isRoot\":true},\"DHCP_Options\":{\"columns\":{\"code\":{\"type\":{\"key\":{\"maxInteger\":254,\"minInteger\":0,\"type\":\"integer\"}}},\"name\":{\"type\":\"string\"},\"type\":{\"type\":{\"key\":{\"enum\":[\"set\",[\"bool\",\"domains\",\"host_id\",\"ipv4\",\"static_routes\",\"str\",\"uint16\",\"uint32\",\"uint8\"]],\"type\":\"string\"}}}},\"isRoot\":true},\"DHCPv6_Options\":{\"columns\":{\"code\":{\"type\":{\"key\":{\"maxInteger\":254,\"minInteger\":0,\"type\":\"integer\"}}},\"name\":{\"type\":\"string\"},\"type\":{\"type\":{\"key\":{\"enum\":[\"set\",[\"ipv6\",\"mac\",\"str\"]],\"type\":\"string\"}}}},\"isRoot\":true},\"DNS\":{\"columns\":{\"datapaths\":{\"type\":{\"key\":{\"refTable\":\"Datapath_Binding\",\"type\":\"uuid\"},\"max\":\"unlimited\"}},\"external_ids\":{\"type\":{\"key\":\"string\",\"max\":\"unlimited\",\"min\":0,\"value\":\"string\"}},\"records\":{\"type\":{\"key\":\"string\",\"max\":\"unlimited\",\"min\":0,\"value\":\"string\"}}},\"isRoot\":true},\"Datapath_Binding\":{\"columns\":{\"external_ids\":{\"type\":{\"key\":\"string\",\"max\":\"unlimited\",\"min\":0,\"value\":\"string\"}},\"load_balancers\":{\"type\":{\"key\":\"uuid\",\"max\":\"unlimited\",\"min\":0}},\"tunnel_key\":{\"type\":{\"key\":{\"maxInteger\":16777215,\"minInteger\":1,\"type\":\"integer\"}}}},\"indexes\":[[\"tunnel_key\"]],\"isRoot\":true},\"Encap\":{\"columns\":{\"chassis_name\":{\"type\":\"string\"},\"ip\":{\"type\":\"string\"},\"options\":{\"type\":{\"key\":\"string\",\"max\":\"unlimited\",\"min\":0,\"value\":\"string\"}},\"type\":{\"type\":{\"key\":{\"enum\":[\"set\",[\"geneve\",\"stt\",\"vxlan\"]],\"type\":\"string\"}}}},\"indexes\":[[\"type\",\"ip\"]]},\"FDB\":{\"columns\":{\"dp_key\":{\"type\":{\"key\":{\"maxInteger\":16777215,\"minInteger\":1,\"type\":\"integer\"}}},\"mac\":{\"type\":\"string\"},\"port_key\":{\"type\":{\"key\":{\"maxInteger\":16777215,\"minInteger\":1,\"type\":\"integer\"}}}},\"indexes\":[[\"mac\",\"dp_key\"]],\"isRoot\":true},\"Gateway_Chassis\":{\"columns\":{\"chassis\":{\"type\":{\"key\":{\"refTable\":\"Chassis\",\"refType\":\"weak\",\"type\":\"uuid\"},\"min\":0}},\"external_ids\":{\"type\":{\"key\":\"string\",\"max\":\"unlimited\",\"min\":0,\"value\":\"string\"}},\"name\":{\"type\":\"string\"},\"options\":{\"type\":{\"key\":\"string\",\"max\":\"unlimited\",\"min\":0,\"value\":\"string\"}},\"priority\":{\"type\":{\"key\":{\"maxInteger\":32767,\"minInteger\":0,\"type\":\"integer\"}}}},\"indexes\":[[\"name\"]]},\"HA_Chassis\":{\"columns\":{\"chassis\":{\"type\":{\"key\":{\"refTable\":\"Chassis\",\"refType\":\"weak\",\"type\":\"uuid\"},\"min\":0}},\"external_ids\":{\"type\":{\"key\":\"string\",\"max\":\"unlimited\",\"min\":0,\"value\":\"string\"}},\"priority\":{\"type\":{\"key\":{\"maxInteger\":32767,\"minInteger\":0,\"type\":\"integer\"}}}}},\"HA_Chassis_Group\":{\"columns\":{\"external_ids\":{\"type\":{\"key\":\"string\",\"max\":\"unlimited\",\"min\":0,\"value\":\"string\"}},\"ha_chassis\":{\"type\":{\"key\":{\"refTable\":\"HA_Chassis\",\"type\":\"uuid\"},\"max\":\"unlimited\",\"min\":0}},\"name\":{\"type\":\"string\"},\"ref_chassis\":{\"type\":{\"key\":{\"refTable\":\"Chassis\",\"refType\":\"weak\",\"type\":\"uuid\"},\"max\":\"unlimited\",\"min\":0}}},\"indexes\":[[\"name\"]],\"isRoot\":true},\"IGMP_Group\":{\"columns\":{\"address\":{\"type\":\"string\"},\"chassis\":{\"type\":{\"key\":{\"refTable\":\"Chassis\",\"refType\":\"weak\",\"type\":\"uuid\"},\"min\":0}},\"datapath\":{\"type\":{\"key\":{\"refTable\":\"Datapath_Binding\",\"refType\":\"weak\",\"type\":\"uuid\"},\"min\":0}},\"ports\":{\"type\":{\"key\":{\"refTable\":\"Port_Binding\",\"refType\":\"weak\",\"type\":\"uuid\"},\"max\":\"unlimited\",\"min\":0}}},\"indexes\":[[\"address\",\"datapath\",\"chassis\"]],\"isRoot\":true},\"IP_Multicast\":{\"columns\":{\"datapath\":{\"type\":{\"key\":{\"refTable\":\"Datapath_Binding\",\"refType\":\"weak\",\"type\":\"uuid\"}}},\"enabled\":{\"type\":{\"key\":\"boolean\",\"min\":0}},\"eth_src\":{\"type\":\"string\"},\"idle_timeout\":{\"type\":{\"key\":\"integer\",\"min\":0}},\"ip4_src\":{\"type\":\"string\"},\"ip6_src\":{\"type\":\"string\"},\"querier\":{\"type\":{\"key\":\"boolean\",\"min\":0}},\"query_interval\":{\"type\":{\"key\":\"integer\",\"min\":0}},\"query_max_resp\":{\"type\":{\"key\":\"integer\",\"min\":0}},\"seq_no\":{\"type\":\"integer\"},\"table_size\":{\"type\":{\"key\":\"integer\",\"min\":0}}},\"indexes\":[[\"datapath\"]],\"isRoot\":true},\"Load_Balancer\":{\"columns\":{\"datapaths\":{\"type\":{\"key\":{\"refTable\":\"Datapath_Binding\",\"type\":\"uuid\"},\"max\":\"unlimited\",\"min\":0}},\"external_ids\":{\"type\":{\"key\":\"string\",\"max\":\"unlimited\",\"min\":0,\"value\":\"string\"}},\"name\":{\"type\":\"string\"},\"options\":{\"type\":{\"key\":\"string\",\"max\":\"unlimited\",\"min\":0,\"value\":\"string\"}},\"protocol\":{\"type\":{\"key\":{\"enum\":[\"set\",[\"sctp\",\"tcp\",\"udp\"]],\"type\":\"string\"},\"min\":0}},\"vips\":{\"type\":{\"key\":\"string\",\"max\":\"unlimited\",\"min\":0,\"value\":\"string\"}}},\"isRoot\":true},\"Load_Balancer_Backend_Blacklist\":{\"columns\":{\"external_ids\":{\"type\":{\"key\":\"string\",\"max\":\"unlimited\",\"min\":0,\"value\":\"string\"}},\"ip\":{\"type\":\"string\"},\"logical_port\":{\"type\":\"string\"},\"port\":{\"type\":{\"key\":{\"maxInteger\":65535,\"minInteger\":0,\"type\":\"integer\"}}},\"protocol\":{\"type\":{\"key\":{\"enum\":[\"set\",[\"tcp\",\"udp\"]],\"type\":\"string\"},\"min\":0}},\"source_cell\":{\"type\":\"string\"}},\"indexes\":[[\"logical_port\",\"ip\",\"port\",\"protocol\"]],\"isRoot\":true},\"Load_Balancer_Backend_Whitelist\":{\"columns\":{\"external_ids\":{\"type\":{\"key\":\"string\",\"max\":\"unlimited\",\"min\":0,\"value\":\"string\"}},\"ip\":{\"type\":\"string\"},\"logical_port\":{\"type\":\"string\"},\"port\":{\"type\":{\"key\":{\"maxInteger\":65535,\"minInteger\":0,\"type\":\"integer\"}}},\"protocol\":{\"type\":{\"key\":{\"enum\":[\"set\",[\"tcp\",\"udp\"]],\"type\":\"string\"},\"min\":0}},\"source_cell\":{\"type\":\"string\"}},\"indexes\":[[\"logical_port\",\"ip\",\"port\",\"protocol\"]],\"isRoot\":true},\"Logical_DP_Group\":{\"columns\":{\"datapaths\":{\"type\":{\"key\":{\"refTable\":\"Datapath_Binding\",\"refType\":\"weak\",\"type\":\"uuid\"},\"max\":\"unlimited\",\"min\":0}}}},\"Logical_Flow\":{\"columns\":{\"actions\":{\"type\":\"string\"},\"controller_meter\":{\"type\":{\"key\":\"string\",\"min\":0}},\"external_ids\":{\"type\":{\"key\":\"string\",\"max\":\"unlimited\",\"min\":0,\"value\":\"string\"}},\"logical_datapath\":{\"type\":{\"key\":{\"refTable\":\"Datapath_Binding\",\"type\":\"uuid\"},\"min\":0}},\"logical_dp_group\":{\"type\":{\"key\":{\"refTable\":\"Logical_DP_Group\",\"type\":\"uuid\"},\"min\":0}},\"match\":{\"type\":\"string\"},\"pipeline\":{\"type\":{\"key\":{\"enum\":[\"set\",[\"egress\",\"ingress\"]],\"type\":\"string\"}}},\"priority\":{\"type\":{\"key\":{\"maxInteger\":65535,\"minInteger\":0,\"type\":\"integer\"}}},\"table_id\":{\"type\":{\"key\":{\"maxInteger\":32,\"minInteger\":0,\"type\":\"integer\"}}},\"tags\":{\"type\":{\"key\":\"string\",\"max\":\"unlimited\",\"min\":0,\"value\":\"string\"}}},\"isRoot\":true},\"MAC_Binding\":{\"columns\":{\"datapath\":{\"type\":{\"key\":{\"refTable\":\"Datapath_Binding\",\"type\":\"uuid\"}}},\"ip\":{\"type\":\"string\"},\"logical_port\":{\"type\":\"string\"},\"mac\":{\"type\":\"string\"}},\"indexes\":[[\"logical_port\",\"ip\"]],\"isRoot\":true},\"Meter\":{\"columns\":{\"bands\":{\"type\":{\"key\":{\"refTable\":\"Meter_Band\",\"type\":\"uuid\"},\"max\":\"unlimited\"}},\"name\":{\"type\":\"string\"},\"unit\":{\"type\":{\"key\":{\"enum\":[\"set\",[\"kbps\",\"pktps\"]],\"type\":\"string\"}}}},\"indexes\":[[\"name\"]],\"isRoot\":true},\"Meter_Band\":{\"columns\":{\"action\":{\"type\":{\"key\":{\"enum\":\"drop\",\"type\":\"string\"}}},\"burst_size\":{\"type\":{\"key\":{\"maxInteger\":4294967295,\"minInteger\":0,\"type\":\"integer\"}}},\"rate\":{\"type\":{\"key\":{\"maxInteger\":4294967295,\"minInteger\":1,\"type\":\"integer\"}}}}},\"Mirror\":{\"columns\":{\"external_ids\":{\"type\":{\"key\":\"string\",\"max\":\"unlimited\",\"min\":0,\"value\":\"string\"}},\"filter\":{\"type\":{\"key\":{\"enum\":[\"set\",[\"both\",\"from-lport\",\"to-lport\"]],\"type\":\"string\"}}},\"index\":{\"type\":{\"key\":{\"maxInteger\":4294967295,\"minInteger\":0,\"type\":\"integer\"}}},\"name\":{\"type\":\"string\"},\"output_port\":{\"type\":\"string\"},\"output_vlan\":{\"type\":{\"key\":{\"maxInteger\":4095,\"minInteger\":1,\"type\":\"integer\"},\"min\":0}},\"select_dst_port\":{\"type\":{\"key\":\"string\",\"max\":\"unlimited\",\"min\":0}},\"select_src_port\":{\"type\":{\"key\":\"string\",\"max\":\"unlimited\",\"min\":0}},\"select_vlan\":{\"type\":{\"key\":{\"maxInteger\":4095,\"minInteger\":0,\"type\":\"integer\"},\"max\":4096,\"min\":0}},\"sink\":{\"type\":\"string\"},\"snaplen\":{\"type\":{\"key\":{\"maxInteger\":65535,\"minInteger\":14,\"type\":\"integer\"},\"min\":0}},\"type\":{\"type\":\"string\"}},\"indexes\":[[\"name\"]],\"isRoot\":true},\"Multicast_Group\":{\"columns\":{\"datapath\":{\"type\":{\"key\":{\"refTable\":\"Datapath_Binding\",\"type\":\"uuid\"}}},\"name\":{\"type\":\"string\"},\"ports\":{\"type\":{\"key\":{\"refTable\":\"Port_Binding\",\"refType\":\"weak\",\"type\":\"uuid\"},\"max\":\"unlimited\",\"min\":0}},\"tunnel_key\":{\"type\":{\"key\":{\"maxInteger\":65535,\"minInteger\":32768,\"type\":\"integer\"}}}},\"indexes\":[[\"datapath\",\"tunnel_key\"],[\"datapath\",\"name\"]],\"isRoot\":true},\"Port_Binding\":{\"columns\":{\"additional_chassis\":{\"type\":{\"key\":{\"refTable\":\"Chassis\",\"refType\":\"weak\",\"type\":\"uuid\"},\"max\":\"unlimited\",\"min\":0}},\"additional_encap\":{\"type\":{\"key\":{\"refTable\":\"Encap\",\"refType\":\"weak\",\"type\":\"uuid\"},\"max\":\"unlimited\",\"min\":0}},\"chassis\":{\"type\":{\"key\":{\"refTable\":\"Chassis\",\"refType\":\"weak\",\"type\":\"uuid\"},\"min\":0}},\"color_rules\":{\"type\":{\"key\":{\"refTable\":\"Color\",\"refType\":\"weak\",\"type\":\"uuid\"},\"max\":\"unlimited\",\"min\":0}},\"datapath\":{\"type\":{\"key\":{\"refTable\":\"Datapath_Binding\",\"type\":\"uuid\"}}},\"encap\":{\"type\":{\"key\":{\"refTable\":\"Encap\",\"refType\":\"weak\",\"type\":\"uuid\"},\"min\":0}},\"external_ids\":{\"type\":{\"key\":\"string\",\"max\":\"unlimited\",\"min\":0,\"value\":\"string\"}},\"gateway_chassis\":{\"type\":{\"key\":{\"refTable\":\"Gateway_Chassis\",\"type\":\"uuid\"},\"max\":\"unlimited\",\"min\":0}},\"ha_chassis_group\":{\"type\":{\"key\":{\"refTable\":\"HA_Chassis_Group\",\"type\":\"uuid\"},\"min\":0}},\"logical_port\":{\"type\":\"string\"},\"mac\":{\"type\":{\"key\":\"string\",\"max\":\"unlimited\",\"min\":0}},\"nat_addresses\":{\"type\":{\"key\":\"string\",\"max\":\"unlimited\",\"min\":0}},\"options\":{\"type\":{\"key\":\"string\",\"max\":\"unlimited\",\"min\":0,\"value\":\"string\"}},\"parent_port\":{\"type\":{\"key\":\"string\",\"min\":0}},\"requested_additional_chassis\":{\"type\":{\"key\":{\"refTable\":\"Chassis\",\"refType\":\"weak\",\"type\":\"uuid\"},\"max\":\"unlimited\",\"min\":0}},\"requested_chassis\":{\"type\":{\"key\":{\"refTable\":\"Chassis\",\"refType\":\"weak\",\"type\":\"uuid\"},\"min\":0}},\"tag\":{\"type\":{\"key\":{\"maxInteger\":4095,\"minInteger\":1,\"type\":\"integer\"},\"min\":0}},\"tunnel_key\":{\"type\":{\"key\":{\"maxInteger\":32767,\"minInteger\":1,\"type\":\"integer\"}}},\"type\":{\"type\":\"string\"},\"up\":{\"type\":{\"key\":\"boolean\",\"min\":0}},\"virtual_parent\":{\"type\":{\"key\":\"string\",\"min\":0}}},\"indexes\":[[\"datapath\",\"tunnel_key\"],[\"logical_port\"]],\"isRoot\":true},\"Port_Group\":{\"columns\":{\"name\":{\"type\":\"string\"},\"ports\":{\"type\":{\"key\":\"string\",\"max\":\"unlimited\",\"min\":0}}},\"indexes\":[[\"name\"]],\"isRoot\":true},\"RBAC_Permission\":{\"columns\":{\"authorization\":{\"type\":{\"key\":\"string\",\"max\":\"unlimited\",\"min\":0}},\"insert_delete\":{\"type\":\"boolean\"},\"table\":{\"type\":\"string\"},\"update\":{\"type\":{\"key\":\"string\",\"max\":\"unlimited\",\"min\":0}}},\"isRoot\":true},\"RBAC_Role\":{\"columns\":{\"name\":{\"type\":\"string\"},\"permissions\":{\"type\":{\"key\":\"string\",\"max\":\"unlimited\",\"min\":0,\"value\":{\"refTable\":\"RBAC_Permission\",\"refType\":\"weak\",\"type\":\"uuid\"}}}},\"isRoot\":true},\"SB_Global\":{\"columns\":{\"connections\":{\"type\":{\"key\":{\"refTable\":\"Connection\",\"type\":\"uuid\"},\"max\":\"unlimited\",\"min\":0}},\"external_ids\":{\"type\":{\"key\":\"string\",\"max\":\"unlimited\",\"min\":0,\"value\":\"string\"}},\"ipsec\":{\"type\":\"boolean\"},\"nb_cfg\":{\"type\":\"integer\"},\"options\":{\"type\":{\"key\":\"string\",\"max\":\"unlimited\",\"min\":0,\"value\":\"string\"}},\"ssl\":{\"type\":{\"key\":{\"refTable\":\"SSL\",\"type\":\"uuid\"},\"min\":0}}},\"isRoot\":true,\"maxRows\":1},\"SSL\":{\"columns\":{\"bootstrap_ca_cert\":{\"type\":\"boolean\"},\"ca_cert\":{\"type\":\"string\"},\"certificate\":{\"type\":\"string\"},\"external_ids\":{\"type\":{\"key\":\"string\",\"max\":\"unlimited\",\"min\":0,\"value\":\"string\"}},\"private_key\":{\"type\":\"string\"},\"ssl_ciphers\":{\"type\":\"string\"},\"ssl_protocols\":{\"type\":\"string\"}},\"maxRows\":1},\"Service_Monitor\":{\"columns\":{\"external_ids\":{\"type\":{\"key\":\"string\",\"max\":\"unlimited\",\"min\":0,\"value\":\"string\"}},\"ip\":{\"type\":\"string\"},\"logical_port\":{\"type\":\"string\"},\"options\":{\"type\":{\"key\":\"string\",\"max\":\"unlimited\",\"min\":0,\"value\":\"string\"}},\"port\":{\"type\":{\"key\":{\"maxInteger\":65535,\"minInteger\":0,\"type\":\"integer\"}}},\"protocol\":{\"type\":{\"key\":{\"enum\":[\"set\",[\"tcp\",\"udp\"]],\"type\":\"string\"},\"min\":0}},\"src_ip\":{\"type\":\"string\"},\"src_mac\":{\"type\":\"string\"},\"status\":{\"type\":{\"key\":{\"enum\":[\"set\",[\"error\",\"offline\",\"online\"]],\"type\":\"string\"},\"min\":0}}},\"indexes\":[[\"logical_port\",\"ip\",\"port\",\"protocol\"]],\"isRoot\":true}},\"version\":\"20.21.9\"}","sid":["uuid","2c8b90a7-bfea-4c25-9e46-f030887412b3"]}},"f3f6c607-49fb-482f-afad-d32b42912db8":{"initial":{"connected":true,"leader":true,"model":"standalone","name":"_Server","schema":"{\"cksum\":\"3009684573 744\",\"name\":\"_Server\",\"tables\":{\"Database\":{\"columns\":{\"cid\":{\"type\":{\"key\":\"uuid\",\"min\":0}},\"connected\":{\"type\":\"boolean\"},\"index\":{\"type\":{\"key\":\"integer\",\"min\":0}},\"leader\":{\"type\":\"boolean\"},\"model\":{\"type\":{\"key\":{\"enum\":[\"set\",[\"clustered\",\"relay\",\"standalone\"]],\"type\":\"string\"}}},\"name\":{\"type\":\"string\"},\"schema\":{\"type\":{\"key\":\"string\",\"min\":0}},\"sid\":{\"type\":{\"key\":\"uuid\",\"min\":0}}}}},\"version\":\"1.2.0\"}"}}}},"id":6}

connect:

libovsdb/client/client.go

Lines 283 to 306 in ce19516

// if we're reconnecting, re-start all the monitors
if reconnect {
o.logger.V(3).Info("reconnected - restarting monitors")
for dbName, db := range o.databases {
db.monitorsMutex.Lock()
defer db.monitorsMutex.Unlock()
// Purge entire cache if no monitors exist to update dynamically
if len(db.monitors) == 0 {
db.cache.Purge(db.model)
continue
}
// Restart all monitors; each monitor will handle purging
// the cache if necessary
for id, request := range db.monitors {
err := o.monitor(ctx, MonitorCookie{DatabaseName: dbName, ID: id}, true, request)
if err != nil {
o.resetRPCClient()
return err
}
}
}
}

update3:

libovsdb/client/client.go

Lines 735 to 739 in ce19516

if err == nil {
db.monitorsMutex.Lock()
mon := db.monitors[cookie.ID]
mon.LastTransactionID = lastTransactionID
db.monitorsMutex.Unlock()

Edit: it's not easy to reproduce. We found this issue in a large cluster and sb has a lot of pressure.

@halfcrazy
Copy link
Contributor Author

@trozet PTAL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant