meetup Erlang实战踩过的 5 个坑
2020-03-01 164浏览
- 1.Erlang 实战填过的 5 个坑 - IoT 项目 郎哲
- 2.
- 3.Erlang 实战填过的 5 个坑 1. Mnesia 实战索引一(数据读不出来) 2. Mnesia 实战索引二(数据删除巨慢) 3. Supervisor one for one 拖垮系统 4. message_queue_len 堆积 拖慢系统 5. 小心使用 gen_server 否则会成为瓶颈 -gen_server 监控监监程 监监用 6. 设备连接次数
- 4.Mnesia 实战索引一(数据读不出来) 远程无法控制设备 不 收 用户 锁 开 锁 门 到 子 孩 ( 知 通 贼 有 或 家 回 ) 侵 入 门 破 我可以啊
- 5.Mnesia 实战索引一(数据读不出来) delete_object(Tab, Record, LockKind) -> transaction abort ok If a table is of type bag, it can sometimes be needed to delete only some of the records with a certain key. This can be done with the function delete_object/3. A complete record must be supplied to this function. 问题:根据索引查不出数据来, 但是根据 key 能查到数据。数 据重新 write 也无法恢复。 write_test() -> ( 1 ) Id = <<"id">>, Mac = <<"Mac">>, Session = #ws_session{idr = {Id, Mac}, id = Id, type = <<"hub">> = pid},mnesia:dirty_write(Session).原因: delete_object 删除数据 不是 complete record ,程序 运行中修改过其中一个值。 read_test() -> ( 2 ) Pid = pid,mnesia:dirty_index_read(ws_session,'>mnesia:dirty_index_read(ws_session,