diff --git a/ReleaseNotes.md b/ReleaseNotes.md
index 25bbef3563e89d8cb05fa4c2a81ae45416f1d314..6225aa8c2bf6f0693f06190bdad2653bf61aa6bb 100644
--- a/ReleaseNotes.md
+++ b/ReleaseNotes.md
@@ -5,6 +5,7 @@
 ### Upgrade Instructions
 
 ### Features
+- cta/CTA#1117 - Update masterDataInBytes when writting files to tape.
 
 ### Bug fixes
 
diff --git a/catalogue/CatalogueTest.cpp b/catalogue/CatalogueTest.cpp
index c5211837269c4a7ccaa1cdc1bcb044bd03ad1925..1a18dd5863f667694fe30fdcd7d8fc4bbfa25afb 100644
--- a/catalogue/CatalogueTest.cpp
+++ b/catalogue/CatalogueTest.cpp
@@ -5440,6 +5440,7 @@ TEST_P(cta_catalogue_CatalogueTest, deleteNonEmptyTape) {
     ASSERT_EQ(m_vo.name, tape.vo);
     ASSERT_EQ(m_mediaType.capacityInBytes, tape.capacityInBytes);
     ASSERT_EQ(fileSize, tape.dataOnTapeInBytes);
+    ASSERT_EQ(fileSize, tape.masterDataInBytes);
     ASSERT_EQ(m_tape1.full, tape.full);
 
     ASSERT_FALSE(tape.isFromCastor);
@@ -16229,6 +16230,7 @@ TEST_P(cta_catalogue_CatalogueTest, reclaimTape_full_lastFSeq_1_one_tape_file) {
     ASSERT_EQ(m_tape1.mediaType, tape.mediaType);
     ASSERT_EQ(m_tape1.vendor, tape.vendor);
     ASSERT_EQ(file1Written.size, tape.dataOnTapeInBytes);
+    ASSERT_EQ(file1Written.size, tape.masterDataInBytes);
     ASSERT_EQ(1, tape.lastFSeq);
     ASSERT_EQ(m_tape1.logicalLibraryName, tape.logicalLibraryName);
     ASSERT_EQ(m_tape1.tapePoolName, tape.tapePoolName);
diff --git a/catalogue/RdbmsCatalogue.cpp b/catalogue/RdbmsCatalogue.cpp
index 3b5d2d89a53e2ac627a1989918286cbf3f0ec524..9f650a17fe07bdca07ae28e1df1837dad3d51996 100644
--- a/catalogue/RdbmsCatalogue.cpp
+++ b/catalogue/RdbmsCatalogue.cpp
@@ -8536,15 +8536,16 @@ void RdbmsCatalogue::updateTape(
       "UPDATE TAPE SET "
         "LAST_FSEQ = :LAST_FSEQ,"
         "DATA_IN_BYTES = DATA_IN_BYTES + :DATA_IN_BYTES,"
+        "MASTER_DATA_IN_BYTES = MASTER_DATA_IN_BYTES + :MASTER_DATA_IN_BYTES,"
         "LAST_WRITE_DRIVE = :LAST_WRITE_DRIVE,"
-        "LAST_WRITE_TIME = :LAST_WRITE_TIME,"
-        "DIRTY='1' "
+        "LAST_WRITE_TIME = :LAST_WRITE_TIME "
       "WHERE "
         "VID = :VID";
     auto stmt = conn.createStmt(sql);
     stmt.bindString(":VID", vid);
     stmt.bindUint64(":LAST_FSEQ", lastFSeq);
     stmt.bindUint64(":DATA_IN_BYTES", compressedBytesWritten);
+    stmt.bindUint64(":MASTER_DATA_IN_BYTES", compressedBytesWritten);
     stmt.bindString(":LAST_WRITE_DRIVE", tapeDrive);
     stmt.bindUint64(":LAST_WRITE_TIME", now);
     stmt.executeNonQuery();