"targetWriter" is a method parameter, and should not be used for synchronization.
- Ngôn ngữ chính
- Java
- Star
- 6.4k
- Fork
- 1.2k
- Merge trung bình
- 1 ngày 23 giờ
- Pull request đã merge (30 ngày)
- 115
Mô tả
Code Path:server/src/main/java/org/apache/iotdb/db/engine/compaction/writer/AbstractCompactionWriter.java
Synchronizing on a class field synchronizes not on the field itself, but on the object assigned to it. So synchronizing on a non-final field makes it possible for the field’s value to change while a thread is in a block synchronized on the old value. That would allow a second thread, synchronized on the new value, to enter the block at the same time.
The story is very similar for synchronizing on parameters; two different threads running the method in parallel could pass two different object instances in to the method as parameters, completely undermining the synchronization.
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu tại server/src/main/java/org/apache/iotdb/db/engine/compaction/writer/AbstractCompactionWriter.java và kiểm tra phương thức sử dụng targetWriter để đồng bộ hóa. Xác nhận cách các lệnh gọi đồng thời có thể nhận các phiên bản tham số khác nhau. Công việc hoàn tất khi việc đồng bộ hóa không còn phụ thuộc vào tham số phương thức đó và hành vi hiện tại vẫn an toàn đối với các lệnh gọi đồng thời.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- java
- Lĩnh vực
- databases
- Loại issue
- Lỗi
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100