You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

写入模块设计

写入整体模块交互时序图

Memtable

为节省内存空间,不保留device全路径,而是使用其ID作为HashMap的key

// device ID -> (measurement name -> IWritableMemChunk)
Map<DeviceID, <String, IWritableMemChunk>> memTableMap;

StorageGroupProcessor关于每个设备flush时间的四个map

在海量时间序列场景下,保存不同时间分区下设备的最后刷盘时间内存空间开销大,且其场景为实时写入,对时间分区依赖性不强,故使用ID表保存每个时间序列最新时间分区的最后刷盘时间:

需要被替换的已有结构:

// 记录最后写入时间
private Map<Long, Map<String, Long>> latestTimeForEachDevice = new HashMap<>();
  
// 记录最后刷盘时间 
private Map<Long, Map<String, Long>> partitionLatestFlushedTimeForEachDevice = new HashMap<>();
  
// 升级时使用
private Map<Long, Map<String, Long>> newlyFlushedPartitionLatestFlushedTimeForEachDevice = new HashMap<>();
  
// 全局刷盘时间
private Map<String, Long> globalLatestFlushedTimeForEachDevice = new HashMap<>();


  • No labels