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

Is there a way to prevent data Overwrite #686

Open
biswaKL opened this issue Jan 5, 2024 · 4 comments
Open

Is there a way to prevent data Overwrite #686

biswaKL opened this issue Jan 5, 2024 · 4 comments

Comments

@biswaKL
Copy link

biswaKL commented Jan 5, 2024

Is there a way to prevent data Overwrite?

If I am doing a push say 45 for certain timestamp with certain tags,

Then I push 12 for same timestamp and same tags, then the value will get over written with 12.
Is there a way to stop that and retain the first value only? So subsequest requests with same Timestamp and same tags should get rejected.

@brianhks
Copy link
Member

brianhks commented Jan 7, 2024

At first I thought this wasn't possible, if kairos were to read data before each write it would slow things way down. But I think there is a way to get what you want.

When kairos writes a datapoint it specifies the timestamp of the write. This is kind of a historical thing why it does this. This timestamp determines what data overwrites what in Cassandra during a read and compaction. So it may be possible to run the timestamp backwards. Start with some fixed point in time and then calculate a number that always gets smaller. So new data will get inserted with an older write time than older data and cassandra will effectively throw it away.

I bet this can be done in the form of a plugin or configuration option to turn it on and off. And it won't adversely effect the speed.

@biswaKL
Copy link
Author

biswaKL commented Jan 8, 2024

Hi Brian, thats a nice idea. I can comeup with the logic to insert reverse timestamp,
But in the current API, we are not pushing the datawrite timestamp right? is it possible to send?

@brianhks
Copy link
Member

brianhks commented Jan 8, 2024

This will require code changes to implement. The timestamp I'm referring to is not exposed through any api.

@biswaKL
Copy link
Author

biswaKL commented Jan 8, 2024

ohk, I will check the code when I have time.
For now my data goes through kafka queue, so I think i can query the DB for now.

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

No branches or pull requests

2 participants