Code Monkey home page Code Monkey logo

flyfish's People

Contributors

sniperhw avatar yddeng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

flyfish's Issues

多条件操作、事务、sql回写错误怎么处理?

我是看了知乎的文章过来的,感谢你的分享。https://zhuanlan.zhihu.com/p/86545815
因为对冷热数据分离很有兴趣,有几点疑问想请教您,希望有时间的时候能回复一下。

1、在多条件查询时,如果key有多个,或者多个field组成的关联主键,这种情况下怎么设计key?假设有2个field组成的关联主键,我只用1个想要查询出多行记录,这个是不是只能用通配符遍历key,当key数量大时应该会影响性能吧。另外,如果我不想通主键查询,而是通过其他field查询该怎么办呢?那岂不是要遍历当前表的所有行了。再扩展到多表的查询,比如union,join这种,应该就只能自己在代码中实现了吧。
2、假设我的代码中有大量的db操作,需要改写成flyfish的api。1中的问题我想总归能解决的。可是因为redis事务的不完整,也就是后面操作失败的情况下,前面的操作不支持回滚,那怎么改写db事务呢。这一点我还没想通,能想到的就是完全回写。对于简单的事务,在开启multi后,保存住所有要操作数据的原始状态,捕获exec执行结果,exec失败后,再把所有数据根据原始状态重新写一遍。当然了,这里也有并发风险。
3、异步回写sql的过程中,如果发生了错误,比如人为编码错误,或者表格式约束,导致mysql提示错误,这时候即使有日志能错误捕获,但是也不能轻易尝试再次回写了。因为保不齐,下一个操作已经把当前数据改写掉了。想问下这种异常情况下,该怎么处理比较好呢?

因为还没有阅读兄弟的源码,如果你已经解释过的问题我还提了出来也请不要生气。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.