0

Not seeing the QLDB history reflecting all updates being made to a single document.

When running multiple updates to a single document within a single execution of the QLDB console, only the last update is recorded in the history.

However, when running the multiple updates in separate executions, all the updates are recorded in the history.

An example when running queries directly in the QLDB console:

Setup:

CREATE TABLE T;

CREATE INDEX ON T (uid);

INSERT INTO T VALUE
{
  'status' : 'NEW',
  'uid' : '1401149b-a7ea-4f17-bebc-7cbe48847cde'
};

Then when executing multiple update statements sequentially in the console in a single execution:

UPDATE T SET status = 'IN_PROGRESS' WHERE uid = '1401149b-a7ea-4f17-bebc-7cbe48847cde';
UPDATE T SET status = 'COMPLETED' WHERE uid = '1401149b-a7ea-4f17-bebc-7cbe48847cde';

The history only shows 2 document versions, with the latest version (version: 1) having status: COMPLETED:

select * from history(T) AS h where h.data.uid = '1401149b-a7ea-4f17-bebc-7cbe48847cde';

Note, the history does record all 3 versions when running the update statements one at a time in separate executions.

sambogoat
  • 1
  • 2

1 Answers1

0

Thanks @sambogoat for the question. There seems to be differences between the QLDB console query editor, and the information in the user guide in console slide out.

What I verified by observing the http requests in the browser console:

The console, will use the qldb session flow on your behalf. When you press the Run button, it will StartTransaction 1 time and get a transactionId, then ExecuteStatement call per statement in editor, and CommitTransaction. Each ExecuteStatementRequest has the same transactionID and there is 1 CommitTransaction call with the same transactionID, so I expect 1 commit history object per transaction. Currently, each statement present in the editor box gets an ExecuteStatement http call, however they all have the same transactionId, and therefore have 1 commit history.

bwinchester
  • 91
  • 1
  • 5