You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@iotdb.apache.org by "Jialin Qiao (Jira)" <ji...@apache.org> on 2021/09/26 07:16:00 UTC

[jira] [Commented] (IOTDB-1726) Wrong hashCode() and equals() method in ChunkMetadata

    [ https://issues.apache.org/jira/browse/IOTDB-1726?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17420219#comment-17420219 ] 

Jialin Qiao commented on IOTDB-1726:
------------------------------------

(1) use fileVersion and chunkOffset in equals and hashCode methods

(2) Let all tsfiles in an instance to share one SimpleFileVersionController, not each partition+sg

> Wrong hashCode() and equals() method in ChunkMetadata
> -----------------------------------------------------
>
>                 Key: IOTDB-1726
>                 URL: https://issues.apache.org/jira/browse/IOTDB-1726
>             Project: Apache IoTDB
>          Issue Type: Bug
>          Components: Core/Engine
>            Reporter: Yuan Tian
>            Priority: Major
>
> {code:java}
> @Override
> public boolean equals(Object o) {
>   if (this == o) {
>     return true;
>   }
>   if (o == null || getClass() != o.getClass()) {
>     return false;
>   }
>   ChunkMetadata that = (ChunkMetadata) o;
>   return offsetOfChunkHeader == that.offsetOfChunkHeader
>       && version == that.version
>       && Objects.equals(measurementUid, that.measurementUid)
>       && tsDataType == that.tsDataType
>       && Objects.equals(deleteIntervalList, that.deleteIntervalList)
>       && Objects.equals(statistics, that.statistics);
> }
> @Override
> public int hashCode() {
>   return Objects.hash(
>       measurementUid, deleteIntervalList, tsDataType, statistics, version, offsetOfChunkHeader);
> }
> {code}
> We can see that chunkmetadata use version to  differentiate, however, in different storage groups, different file's version may be same. That means root.sg1.d1.s1 and root.sg2.d1.s1 may share the same cache entry in ChunkCache



--
This message was sent by Atlassian Jira
(v8.3.4#803005)