Comments (4)
//根据消息的延时时间(scheduleTime),计算该消息应该落在schedule log的哪个分片(segment)
long baseOffset = resolveSegment(scheduleTime, segmentScale);
//如果该分片的偏移比当前正在投递的分片偏移小,则立即添加进内存时间轮
if (baseOffset < currentBaseOffset) return true;
//如果该消息正好需要落在当前时间片
if (baseOffset == currentBaseOffset) {
//则判断该消息在当前schedule log segment里的偏移是否大于正在加载的最大偏移
//如果大的话则立即加载到内存时间轮。
//这里要注意的是,当加载任务决定要加载某个segment的时候,
//就会立即固定住当时该segment的最大偏移,也就是currentOffset,
//所以这样就不会将消息重复的加载
return currentOffset <= offset;
}
from qmq.
不会的
// 这里的loadingCursor.cursor() 是返回的一个新实例的,所以currentCursor只在当前线程可见的,别的线程不会修改它的
WheelLoadCursor.Cursor currentCursor = loadingCursor.cursor();
int currentBaseOffset = currentCursor.getBaseOffset();
long currentOffset = currentCursor.getOffset();
from qmq.
这个里面,多线程好像会有问题
在第一行如果是获取到的是比如,2019040219这个小时是baseOffset,如果在极端情况下
假如2019040219 的offset为1500,2019040220这个小时的写入offset为1600
在执行第二句代码的时候,load任务改成了2019040220,offset变成了1600,第二行获取到的就是1600,
long currentOffset = currentCursor.getOffset();
会导致有些消息索引,没有写入时间轮
from qmq.
恩恩,是一个新实例,确实不会有多线程问题
from qmq.
Related Issues (20)
- 1.1.30 版本中非Spring环境手动pull时 空指针异常 HOT 1
- Cross-Site Scripting: Reflected
- There is a vulnerability in Apache Tomcat 7.0.30,upgrade recommended
- There is a vulnerability in Spring Framework 4.2.3.RELEASE,upgrade recommended
- There is a vulnerability in Apache Commons Collections 3.2.1 ,upgrade recommended
- There is a vulnerability in jackson-databind 2.9.9,upgrade recommended
- There is a vulnerability in Simple Logging Facade for Java (SLF4J) 1.7.25,upgrade recommended
- There is a vulnerability in Jetty: Java based HTTP/1.x, HTTP/2, Servlet, WebSocket Server 9.4.17.v20190418,upgrade recommended
- There is a vulnerability in MySQL Connector/J 5.1.39,upgrade recommended
- 运行qmq-demo控制台报错【meta server return empty broker】 HOT 7
- 咨询! HOT 1
- QMQ 跨地域复制方案 HOT 1
- 请教下consumer扩容的问题 HOT 2
- 贵司Q三剑客-QScheduler有没有开源计划 HOT 1
- QMQ版本计划 HOT 1
- init.sql 缺少字段,本地代码启动报错 HOT 2
- 有k8s部署方案吗
- centos系统日志框架堆栈溢出
- 同一个消费者组的多个实例 并发拉取消息时,是否存在重复消费的问题?
- [want] Go语言支持
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qmq.