-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
influxdb write api not correctly handle time field #1020
Comments
update: I changed the code to use unix mili for the -SetTimestamp(time.Now().UnixNano())
+SetTimestamp(time.Now().UnixMilli()) drop the table and regenerate the demo data (since I can not remove the the error is gone. but the |
Arrow error: Compute error: Overflow happened ...
@ttys3 Thanks for your report. After the vacation, I guess @jiacai2050 will help solve this issue. |
update again: if I use mili seconds in
but in influxdb, this is OK:
we got the expected result:
|
Hi, thanks for reporting. For your case 1 and 2, currently only ms precision is supported by CeresDB, other precision will convert to ms when write. But in order to convert time, users need to set
Of course this will lost time precision if converted from ns, but this is how ceresdb is implemented now, if you want ns precision, welcome to open another issue, tell us your usercase.
For your case 3, I need more time to reproduce this, will update here when I have more context. |
case 3 is reproducable. I tested again, this time it uses about 19.7GB memory: mysql> SELECT * FROM "system" order by time desc limit 5;
+----------------------+---------------+----------+--------------------+---------------+----------+--------+----------------------+----------------+--------------------+--------+
| tsid | time | api_type | disk_free | disk_total | hostname | id | mem_free | mem_total | temperature | vendor |
+----------------------+---------------+----------+--------------------+---------------+----------+--------+----------------------+----------------+--------------------+--------+
| 16783440087510120366 | 1790316217186 | blocking | 575.0676008151054 | 9999996000000 | host_58 | rack_8 | 8613071225237535455 | 10000000000000 | 37.376148430256194 | AWS |
| 14903144881462136102 | 1790316057393 | blocking | 185.71644931843477 | 9999997000000 | host_60 | rack_0 | 12336037372503751218 | 10000000000000 | 15.41807464592409 | AWS |
| 18036101797844328737 | 1790315980444 | blocking | 323.1994394796841 | 9999948000000 | host_71 | rack_1 | 5277818915129357015 | 9999950000000 | 3.0270463604499485 | AWS |
| 3146672079379267971 | 1790315975444 | blocking | 712.1429296004604 | 9999981000000 | host_8 | rack_8 | 17916653639169366056 | 9999990000000 | 50.668711268872215 | AWS |
| 7443242848413171290 | 1790315969714 | blocking | 762.1131729883782 | 9999942000000 | host_15 | rack_5 | 9737001516229547025 | 9999950000000 | 17.12921532169998 | AWS |
+----------------------+---------------+----------+--------------------+---------------+----------+--------+----------------------+----------------+--------------------+--------+
5 rows in set (5.65 sec) and, it generate lots of small sst files, is this expected? yes, I use iotop to check and wait the compact done. ❯ ls -1 /var/lib/ceresdb/store/2/2199023255553 | wc -l
17881
❯ sudo du -sh /var/lib/ceresdb/store/2/2199023255553
4.5G /var/lib/ceresdb/store/2/2199023255553 .rw-r--r-- root root 328 KB Sun Jun 25 00:21:19 2023 9865.sst
.rw-r--r-- root root 343 KB Sun Jun 25 00:21:19 2023 9866.sst
.rw-r--r-- root root 337 KB Sun Jun 25 00:21:19 2023 9867.sst |
This depends on table's write buffer(default 32M), however there is a bug in 1.2.0, which cause flush too frequently, would you mind try latest version? we have nightly image here:
As for high memory consumption, it's mostly caused by too many small sst files, since there is a merge sort process inside one query, which will read head of all sst files. Related issue: |
tried latest sst file still small:
write speed becomes slower and slower |
Actually, we found the massive small sst will be generated too when large small string or null values are inserted. The problem is introduced by the current memtable implementation, and #1029 is one solution to it. As for the null values, another fix I'm working on will use bitmap to reduce the memory consumption. Finally, we are planning to replace the current memtable with a brand new one, but the work is still in design stage and will take some time to be delivered. |
so, curently, sst flush when table's write buffer(default 32M) is full. currently the test data is like
which has string "blocking", "host_xx", "rack_xx" and "AWS" so this is the reason why sst flush so fast ? this seems not too much string |
I will try to reproduce your case 3 today, I have one question for your code:
It seems you use ns to set timestamp, do you change to ms in your later tests? |
Hi, after some tests on my local dev, I found why there are so many small sst in your benchmark. Your original code have lots of duplicated rows since you have code like this
For now, memtable will save all duplicated rows in memory(tracked in #1035), and do the dedup when flush to SST, so you have got lots of small SST file. After change your code like this, SST size is expected. point, err := ceresdb.NewPointBuilder("system").
SetTimestamp(time.Now().UnixNano()/1e6).
AddTag("id", ceresdb.NewStringValue(fmt.Sprintf("rack_%v", i))).
AddTag("vendor", ceresdb.NewStringValue("AWS")).
AddTag("hostname", ceresdb.NewStringValue(fmt.Sprintf("host_%v", i))).
AddTag("api_type", ceresdb.NewStringValue("blocking")).
AddField("temperature", ceresdb.NewDoubleValue(rand.Float64()*80.0)).
AddField("disk_free", ceresdb.NewDoubleValue(rand.Float64()*1000.0)).
AddField("disk_total", ceresdb.NewInt64Value((int64(i/10+1)*1000000))).
AddField("mem_total", ceresdb.NewInt64Value((int64(i/100+1)*10000000))).
AddField("mem_free", ceresdb.NewUint64Value(rand.Uint64())).
Build()
|
After fix the too many small SST issue, I try execute your query SELECT * FROM "system" order by timestamp desc limit 5; It will cost memory(res) up to 13G, and we optimize those query in those issue: |
Closed since the original issue is explained above, feel free to open new issue when you have more questions. |
Describe this problem
doc issue: seems the document did not explicitly mention that users from inlfuxdb, should use unix
mili
for the time field.but influxdb uses
nano
time for this (ref to https://docs.influxdata.com/influxdb/v1.7/write_protocols/line_protocol_reference/Unix nanosecond timestamp
).the db does not support store
nano
as time field. but when we dothe data is in valid influx line protocol, and the time is always nano, like
1687513104655044842
ceresdb should auto convert this to
1687513104655044842/1000000
or throw an errorref to https://github.com/CeresDB/ceresdb/blob/9a9c0f79116dff6df2a09fc8766e6952fd5f4432/proxy/src/influxdb/types.rs#L483C47-L483C47
but if we only support mili seconds, which will make the write api not fully compatible with influxdb, and even will cause the lost of data. see #1020 (comment)
SELECT * FROM "system" order by time desc limit 5;
for10000 * 10000
rows data.after fixed the write using unix
mili
, the memory usage decreased to 3GB but this is only because we only got9981906
rows inserted now (I was so glad at first, but reality drove me into the abyss again).got error:
the data is like this:
Server version
Steps to reproduce
default_timestamp_column_name = "time"
configconfig file:
the auto created schema should like:
check what we got:
note that, the time is in nano:
1687513104655044842
and without touched.Expected behavior
SELECT * FROM "system" order by time desc limit 5;
)Additional Information
see
#1020 (comment)
and
#1020 (comment)
The text was updated successfully, but these errors were encountered: