Skip to content
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

The library does not throw an exception when database is down #152

Closed
zambro opened this issue Mar 3, 2016 · 5 comments
Closed

The library does not throw an exception when database is down #152

zambro opened this issue Mar 3, 2016 · 5 comments

Comments

@zambro
Copy link

zambro commented Mar 3, 2016

Hi,

I am tried using batch processing as suggested in the README. It works fine but does not throw an exception when the database is down. The 'points' just seem to be lost. Am I missing something or is this a bug?

Thanks,
Zambro

@andrewdodd
Copy link
Contributor

Hi @zambro ,

I guess it is a bug for now. It is already under discussion at #148

Any chance you could try using changes from PR #108 (i.e. use DataRetentionEnhancement branch of andrewdodd/influxdb-java)?

If I can find one person for whom they work (apart from me), I would be keen to merge them.

@zambro
Copy link
Author

zambro commented Mar 4, 2016

@andrewdodd, yes i tried to use the branch you mentioned but do not see any data in the DB. May be I am not supplying the right parameters to the api. Right now I have,

influxDB.enableBatch(2, 2, 1, 2, TimeUnit.MINUTES, BufferFailBehaviour.THROW_EXCEPTION, Boolean.TRUE, 2);

capacity - 2
flushActions - 2 (dont understand the difference between this and capacity)
flushIntervalMin - 1 minute
flushIntervalMax - 2 minute
maxBatchWriteSize - 2

So I expected to find two points in the DB after i wrote my third point to write method, but it was not reflected in the DB (even after 2 minutes). Is my code/understanding wrong?

@andrewdodd
Copy link
Contributor

The difference between capacity and flushActions is to do with how 'soon' a batched write will fire.

capacity - total size of underlying buffer (e.g. 1000)
flushActions - number at which an 'immediate' write will be attempted (e.g. 10)
flushIntervalMin - the cadence at which to trigger a write (esp if the buffer is holding less than flushActions) (e.g. 10 secs)
flushIntervalMax - the upper limit on backoffs for reties (i.e. when buffered writes fail the retry can backoff) (e.g. 120 secs)
macBatchWriteSize - the max number of points to put in a single write attempt (e.g. 25). This is actually to do with selecting something that works well with network traffic etc.

So with the examples I gave above:
0s - Write `1 point
1s - Write 2 point (3 buffered)
2s - Write 1 point (4 buffered)
3-10s - Write 0 points (4 buffered)
10s - flushIntervalExpired - Write occurs (0 buffered)
11s - Write 4 points (4 buffered)
12s - Write 6 points (10 buffered)
flushActions reached - Write occurs but fails(10 buffered)
13s - Write 20 points (30 buffered)
14s-20s - Write 0 points (30 buffered)
20s - flushIntervalExpired - Write 25 occurs but fails (30 buffered)
... (retry interval expands to 20s)
40s - flushIntervalExpired - Write 25 occurs but fails (30 buffered)
... (retry interval expands to 40s)
80s - flushIntervalExpired - Write 25 occurs but fails (30 buffered)
You get the picture hopefully

@jiafu1115
Copy link
Contributor

jiafu1115 commented Nov 16, 2016

@andrewdodd I think we just add exception listener for user then we can let user to decide to ignore it or take other actions similar with spring batch. WDYT?
BTW I notice you hadn't focus on this project.

@lightningrob
Copy link

lightningrob commented Mar 2, 2017

I think the 2.5 release should throw an exception to the client if the server is down. Prior to that, it looks like exceptions were being ignored. We are using release 2.3 and are seeing sporadic event loss but no exceptions, so I checked the code we have, looked at the latest on git and noticed the added exception handling (hence we plan to upgrade).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants