-
Notifications
You must be signed in to change notification settings - Fork 479
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
Influx db java client batch does not write to DB #378
Comments
of course, because: // Flush every 2000 Points, at least every 100ms
influxDB.enableBatch(2000, 100, TimeUnit.MILLISECONDS); Will tell influxdb-java to wait 100ms or 2000Points, whichever occurs first before sending the points to influxdb. |
@majst01 Sorry but I dont understand:
After another 100ms it should have flushed the points already. we were waiting couple of seconds after the .write() method and even invoked write() couple of times but still the database remains empty. |
ok, add more logging, set: influxDB.setLogLevel(Level.Debug) and post the output of you run. |
Hello, I am working with @IdanFridman. These are the logs. I also printed the result after querying:
Second point is the same:
|
I can only see selects in the logs, no writes ! So no surprise that not result returns. |
what about? |
And if there are no writes, what did we do wrong in the code? |
influxdb.flush() was not fired because either 100ms, nor 2000 points have been passed. |
How can it be... I waited some times before sending events - 100MS must have passed. I retried now. It creates the MEASUREMENT CPU but it inserts nothing.
|
Can you add
|
Added the Thread.sleep(200). `Oct 25, 2017 10:59:38 AM okhttp3.internal.platform.Platform log Oct 25, 2017 10:59:38 AM okhttp3.internal.platform.Platform log Oct 25, 2017 10:59:38 AM okhttp3.internal.platform.Platform log |
I found out that the batch-API doesnt fully work. you can use batch insert but its configuration isnt really working. it wont affect anything. the only way the batch is working would be when you execute influxDB.write(batchPoints); |
The batch API works as expected for me. Just reporting. |
Guys, I found the issue. and I couldnt find it documented anywhere.. you have 2 methods that will actually use the batching API(if enable) 1.public void write(final String database, final String retentionPolicy, final Point point); only those has inside (InfluxDBImpl) this line: if (this.batchEnabled.get()) in your document you specify only that write() method doesnt really queue anything in it and therefor no usage of: at all! |
I agree with you the current documentation is not clear enough about what will happen when you You are also correct when you say that not all methods will use the "batching mechanism": there is no mention to it on javadocs and you have to inspect the source-code (as you did) to understand how to properly use the built-in batching mechanism. Do you think you could make a pull-request with some documentation improvements? About the log output that was posted here:
|
@fmachado I dont think it's just document. I would change the interface. (e.g writeBatch or something similar). people who using that code should understand according the methods the expected behavior |
I think that batching should be a configuration option only - it would be nice if the user's code would work independently on the fact batching was enabled or not. |
You have the choice, if do not call |
That is true. On the other hand, you may call influxdb.enableBatch() but some write calls would be always executed synchronously. The mentioned write(batchPoints) and the writes that consume directly line protocol lines are the case. I am not saying it is big deal but you can see that some people might get confused. |
That's why I've already mentioned before about simplifying our API, including deprecation of |
I am trying to write points to influxDB using their Java client.
Batch is important to me.
If I use the influxDB.enableBatch with influxDB.write(Point) no data is inserted.
If I use the BatchPoints and influxDB.write(batchPoints) - data is inserted successfully.
Both code samples are taken from: https://github.com/influxdata/influxdb-java/tree/influxdb-java-2.7
Returns nothing.
This returns data successfully.
As mentioned, I need the first way to function.
How can I achieve that?
versions:
influxdb-1.3.6
influxdb-java:2.7
Thanks
The text was updated successfully, but these errors were encountered: