tinyid icon indicating copy to clipboard operation
tinyid copied to clipboard

ID Generator id生成器 分布式id生成系统,简单易用、高性能、高可用的id生成系统

Results 33 tinyid issues
Sort by recently updated
recently updated
newest added

class IdGeneratorFactoryClient extends AbstractIdGeneratorFactory{ ....省略 @Override protected IdGenerator createIdGenerator(String bizType) { return new CachedIdGenerator(bizType, new HttpSegmentIdServiceImpl()); } ....省略 } 是不是有点问题,需要手动改一下,将HttpSegmentIdServiceImpl改为DbSegmentIdServiceImpl,但改为DbSegmentIdServiceImpl不就引用了tinyId-server工程了吗

1. 假设当前使用的号段为① 1. 调用`nextId`多次后,会走进`loadNext`, 假设`next = querySegmentId()`里的`querySegmentId`已经执行完了,等待赋值给next - 假设这时候查到的号段为② 1. 继续调用`nextId`直到用完,会走进`loadCurrent`。然后因为上面的next还没赋值,所以会走进`querySegmentId` - 假设这时候查到的号段为③ https://github.com/didi/tinyid/blob/49976d37222ab1089a8c413b4520cc55d105d428/tinyid-base/src/main/java/com/xiaoju/uemc/tinyid/base/generator/impl/CachedIdGenerator.java#L36 https://github.com/didi/tinyid/blob/49976d37222ab1089a8c413b4520cc55d105d428/tinyid-base/src/main/java/com/xiaoju/uemc/tinyid/base/generator/impl/CachedIdGenerator.java#L69 造成的结果: ①号段使用完了,③号段接着用,然后才可能用到②号段

已经通过max_id判断是否发生过改变,就没必要再增加一个version作为乐观锁了吧?

https://github.com/didi/tinyid/blob/49976d37222ab1089a8c413b4520cc55d105d428/tinyid-server/db.sql#L9C20-L9C20

如何解决同一类型流水同时更新version超过最大次数问题,可能有100个服务同时使用一个类型流水,同时获取 超过最大次数 抛出异常,怎么解决

这个ID生成器,已经长期没人维护了,只能说能用,要用最好fork改一份,否则挺多陈旧的代码。 如果要用的,几个要点需要改下: 1. Server 端 数据库不支持mysql8.x 及以上的 2. 最好升级下springboot 版本,1.x 过于陈旧,升级时,需要改动一下代码 3. 使用 hikari. 连接池替换 tomcat 自带连接池,提高性能 4. 升级为 springboot 2.x 及以上,server.context-path 需要 更改为 server.servlet.context-path 5. Client 端,默认硬编码读取resource 下的 tinyid_client.properties...

如果有一台tinyserver挂掉, tinyclient的router不是会出问题吗? 我看router的逻辑很简单, 从配置文件拉取tinyserver的地址集合放入容器, 然后根据随机去取一台服务。

DbSegmentIdServiceImpl类查询db最新号段 `@Transactional(isolation = Isolation.READ_COMMITTED) public SegmentId getNextSegmentId(String bizType) { // 获取nextTinyId的时候,有可能存在version冲突,需要重试 for (int i = 0; i < Constants.RETRY; i++) { TinyIdInfo tinyIdInfo = tinyIdInfoDAO.queryByBizType(bizType); ...... int row = tinyIdInfoDAO.updateMaxId(tinyIdInfo.getId(),...

Bumps [mysql-connector-java](https://github.com/mysql/mysql-connector-j) from 5.1.44 to 8.0.28. Changelog Sourced from mysql-connector-java's changelog. Changelog https://dev.mysql.com/doc/relnotes/connector-j/8.0/en/ Version 8.0.29 Fix for Bug#21978230, COMMENT PARSING NOT PROPER IN PREPSTMT.EXECUTEBATCH(). Fix for Bug#81468 (23312764), MySQL server...

dependencies

Bumps [spring-boot-starter-web](https://github.com/spring-projects/spring-boot) from 1.5.9.RELEASE to 2.5.12. Release notes Sourced from spring-boot-starter-web's releases. v2.5.12 :lady_beetle: Bug Fixes MustacheAutoConfiguration in a Servlet web application fails with a ClassNotFoundException when Spring MVC is...

dependencies