Skip to content

Commit

Permalink
fix: fixed issue with count of records after tx forward from replica …
Browse files Browse the repository at this point in the history
…to leader

Fixed issue #1182
  • Loading branch information
lvca committed Jul 24, 2023
1 parent 481b809 commit 2ed2834
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,11 @@ public void updateBucketRecordDelta(final int bucketId, final int delta) {
* Executes 1st phase from a replica.
*/
public void commitFromReplica(final WALFile.WALTransaction buffer,
final Map<String, TreeMap<TransactionIndexContext.ComparableKey, Map<TransactionIndexContext.IndexKey, TransactionIndexContext.IndexKey>>> keysTx)
throws TransactionException {
final Map<String, TreeMap<TransactionIndexContext.ComparableKey, Map<TransactionIndexContext.IndexKey, TransactionIndexContext.IndexKey>>> keysTx,
final Map<Integer, Integer> bucketRecordDelta) throws TransactionException {

for (Map.Entry<Integer, Integer> entry : bucketRecordDelta.entrySet())
this.bucketRecordDelta.put(entry.getKey(), new AtomicInteger(entry.getValue()));

final int totalImpactedPages = buffer.pages.length;
if (totalImpactedPages == 0 && keysTx.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public HACommand execute(final HAServer server, final String remoteServerName, f
db.begin(Database.TRANSACTION_ISOLATION_LEVEL.values()[isolationLevelIndex]);
final TransactionContext tx = db.getTransaction();

tx.commitFromReplica(walTx, keysTx);
tx.commitFromReplica(walTx, keysTx, bucketRecordDelta);

if (db.isTransactionActive())
throw new ReplicationException("Error on committing transaction in database '" + databaseName + "': a nested transaction occurred");
Expand Down

0 comments on commit 2ed2834

Please sign in to comment.