Nebula3.4.1图库数据丢失

边上有设定TTL,过期时间为1年,最近在对数发现一个特别奇怪的问题。有的边过期时间还没到,但没有了,没有删除动作的。


比如这条数据,一段时间之后,不见了

这张图什么时候执行截图的。

建space和edge是18号,发现有数据无故消失后,今天23号show create查看建表语句,然后手动执行insert edge,

insert edge e_receiver_phone(description, buss_time, upd_time) values "uid_14122917"->"phone_xxxxx":("afi_loan_iou", 1701269632, 1701269632111)

上午建完之后能查到边,下午2点发现查不到这条边了

你查询的那条 match 语句有创建相关的索引么?有的话,试试 rebuild index 下,看看数据是不是能出来。

该space,没有建索引。 CREATE SPACE xxx_commu_graph (partition_num = 5, replica_factor = 1, vid_type = FIXED_STRING(110));

我们还有别的点和边,发现只有加了TTL的边会有这个情况,别的边数据能对上,比如这种边

CREATE EDGE e_apv_phone(description string, buss_time int64, upd_time int64);

这个数据量多么,你试试对这个 receiver_phone 创建个索引,再 rebuild 看下能不能出来数据。

或者你试试 show stats 看下数据量统计,是不是数据其实没变化(不过这个要求你知道之前数据量的具体条数)

刚统计show stats;数据在变化,一直在新增


image

receiver_phone 对这个创建索引,加到哪个字段上去?

这条边你常用的筛选字段,创建下索引。

盲猜一下,你会不会集群配置里面把ttl改成毫秒了?

没有的,这个集群我在维护,这个边类型有很多数据的,单位都是秒

问下,你有 create space as 操作吗?

话说你是一边发烧一边看帖子么。 :laughing:

另外,你用 fetch语句看下是不是可以查出来
FETCH PROP ON <edge_type> <src_vid> → <dst_vid>[@] [, <src_vid> → <dst_vid> …]
YIELD ;

没有的

我是指storaged.conf里的ttl_use_ms,不过你的buss_time的单位是秒,也不太像这个原因
这种现象大概率还是和ttl有关,你可以把这个边的ttl关了试试看还会少数据吗

加上索引,昨天上午插入的数据,下午还在,今天早上看不见了。 我有两套环境,一个加了索引,一个没加,都不见了,用了match、fetch prop、go查询都不在

你好,storaged.conf里默认没有配置ttl_use_ms,我用ttl特性之前有试过这个功能的,一个edge type,有uid->phone很多条边,根据ttl_duration数据能正常过期,但现在是没到过期时间的边,也不见了。。。

想起来个事…… 系统时间是多少

检查了五台机器,是当前时间(0时区)

bool CommonUtils::checkDataExpiredForTTL(const meta::NebulaSchemaProvider* schema,
                                         const Value& v,
                                         const std::string& ttlCol,
                                         int64_t ttlDuration) {
  const auto& ftype = schema->getFieldType(ttlCol);
  if (ftype != nebula::cpp2::PropertyType::TIMESTAMP &&
      ftype != nebula::cpp2::PropertyType::INT64) {
    return false;
  }

  int64_t now;
  // The unit of ttl expiration unit is controlled by user, we just use a gflag here.
  if (!FLAGS_ttl_use_ms) {
    now = std::time(nullptr);
  } else {
    auto t = std::chrono::system_clock::now();
    now = std::chrono::duration_cast<std::chrono::milliseconds>(t.time_since_epoch()).count();
  }

  if (v.isInt() && (now > (v.getInt() + ttlDuration))) {
    VLOG(2) << "ttl expired";
    return true;
  }
  return false;
}

代码其实没多少,根据你的现象来说,大概率还是TTL的问题。

有一些危险区域:1. 修改过ttl字段的过期时间长短 2. 修改过ttl_use_ms