Repository navigation
Replies: 4 comments 2 replies
|
Hi @princeavo a) UPDATE/DELETE Support
b) Actions ARE Tracked How Immutability Works:
c) Blocking UPDATE/DELETE Three Methods to Block These Operations:
How "Immutable Updates" Work: When you run UPDATE table1 SET col='new' WHERE id=1:
Proof Mechanism: Every change is tracked through:
|
|
First of all, thank you very much for your response and the help you provided regarding the previous questions. I really appreciate the time and effort you put into explaining everything and resolving that issue. I have another question now, this time about version management in immudb. What I would like to know is how to retrieve only the first versions of records, even if they have been modified or deleted afterwards. In other words, I want to make sure that, no matter what modifications or deletions happen, I will always be able to access the original revisions of the records. This includes not only modified data but also records that have been deleted. Could you please explain how this works in immudb and how I can specifically retrieve those first versions? Thanks again for your help! |
|
Hi @vchaindz and team, Following up on my previous discussion about retrieving original versions with ContextAs discussed in #2084, I successfully verified that this query works perfectly via CLI: SELECT * FROM (HISTORY OF audit_log_entry) WHERE _rev = 1;This retrieves all original versions of records, which is exactly what I need for my immutable audit trail. The ProblemHowever, when I execute the same query using the Java client (immudb4j 1.0.1), I get different results. Test 1: CLI Query (Works as Expected)Command: docker run --rm --network container:openmrs-immudb \
codenotary/immuclient:latest query \
'SELECT COUNT(*) FROM (HISTORY OF audit_log_entry) WHERE _rev = 1' \
--database openmrs_audit -a 127.0.0.1 -p 3322 \
--username immudb --password *********Result: ✅ CLI correctly returns 491 original records Test 2: Java Client Query (Unexpected Result)Code: ImmuClient client = ImmuClient.newBuilder()
.withServerUrl("openmrs-immudb")
.withServerPort(3322)
.build();
client.openSession("openmrs_audit", "immudb", "********");
// Transaction is REQUIRED by sqlQuery()
client.beginTransaction();
String sql = "SELECT COUNT(*) FROM (HISTORY OF audit_log_entry) WHERE _rev = 1";
SQLQueryResult result = client.sqlQuery(sql);
if (result != null && result.next()) {
long count = result.getLong(0);
System.out.println("Count: " + count);
}
client.commitTransaction();
client.closeSession();Result: ❌ Java client returns only 21 records instead of 491 Test 3: Verification - Current Table CountTo verify, I also checked the current table (without HISTORY OF): Query: SELECT COUNT(*) FROM audit_log_entryCLI Result: 21 entries ✅ Both return the same count for the current table Summary Table
ObservationThe Java client's My AnalysisThe Java client requires a transaction for
It seems the transaction snapshot only sees recent data, not the complete ImmuDB history that the CLI accesses. QuestionIs this the expected behavior of the Java client? Or is there a different way to query the complete history (all Specifically:
Use CaseAs mentioned in #2084, I'm building an immutable audit log system where I need to count/display all original audit entries ( The CLI proves the data is there (491 records), but I need to access it programmatically via the Java client for my application dashboard. Thank you for your continued support! Best regards |

Uh oh!
There was an error while loading. Please reload this page.
Hi everyone,
I’m currently working on an audit application that uses ImmuDB in SQL mode. I’ve come across a security issue where I can still run DELETE and UPDATE commands on the data, which means it’s possible to modify or delete records in the database.
This poses a significant risk to the integrity of the audit data because if someone can perform these actions, the audit records can be tampered with or lost.
I’m wondering if there’s a way to disable or restrict the usage of UPDATE and DELETE commands in ImmuDB when using SQL mode, in order to ensure that audit records cannot be modified or deleted, whether accidentally or maliciously.
Does anyone have suggestions or solutions for preventing these operations while still using ImmuDB with SQL?
All reactions