GitHub user younghwan91 added a comment to the discussion: Data Sync with 
different TTL from Local to Remote IoTDB instance

Yes, you can set a different TTL on the remote. The TTL is only sent through 
the pipe if the pipe's `source.inclusion` covers `schema.ttl`.

- The default `source.inclusion` is `data.insert` 
([PipeSourceConstant.java#L43-L44](https://github.com/apache/iotdb/blob/7aa0826e656bb0b3e473f441866dfb81aa783348/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/config/constant/PipeSourceConstant.java#L43-L44)).
 A pipe with default settings sends only inserted data, no TTL. The remote 
keeps whatever TTL you set there.
- TTL is a separate option, `schema.ttl` 
([PipeInclusionOptions.java#L77](https://github.com/apache/iotdb/blob/7aa0826e656bb0b3e473f441866dfb81aa783348/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/datastructure/options/PipeInclusionOptions.java#L77)).
 It is synced only when the inclusion is `schema`, `all`, or `schema.ttl` 
itself.

So either keep the default (data only):

```sql
-- remote
SET TTL TO root.db.** 94608000000;   -- 3 years in ms (default time precision)

-- local
CREATE PIPE to_remote
WITH SOURCE ('source.inclusion'='data.insert')
WITH SINK ('sink'='iotdb-thrift-sink', 'sink.node-urls'='<remote-ip>:6667');
```

or, if you also want databases and timeseries schema synced, include schema and 
exclude only the TTL:

```sql
WITH SOURCE ('source.inclusion'='data, schema', 
'source.inclusion.exclusion'='schema.ttl')
```

Set the 3-year TTL on the remote before the pipe starts. The 1-year TTL on the 
local side then only expires local data. The remote keeps what it received 
until its own TTL expires it.

If this solves it, please mark it as the answer so others with the same problem 
can find it.


GitHub link: 
https://github.com/apache/iotdb/discussions/17258#discussioncomment-19897233

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to