trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sc...@apache.org
Subject [trafficserver] branch master updated: Fix lost fragments when update object
Date Sun, 26 Apr 2020 01:32:18 GMT
This is an automated email from the ASF dual-hosted git repository.

scw00 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new c35efb3  Fix lost fragments when update object
c35efb3 is described below

commit c35efb328a4052d368924b3d13901ba819d8a96e
Author: scw00 <scw00@apache.org>
AuthorDate: Wed Sep 11 16:30:31 2019 +0800

    Fix lost fragments when update object
---
 iocore/cache/CacheWrite.cc              | 4 +++-
 iocore/cache/test/test_Update_L_to_S.cc | 1 +
 iocore/cache/test/test_Update_S_to_L.cc | 1 +
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/iocore/cache/CacheWrite.cc b/iocore/cache/CacheWrite.cc
index c619592..cff1818 100644
--- a/iocore/cache/CacheWrite.cc
+++ b/iocore/cache/CacheWrite.cc
@@ -105,7 +105,9 @@ CacheVC::updateVector(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED
*/)
          called iff the update is a header only update so the fragment
          data should remain valid.
       */
-      if (alternate_index >= 0) {
+      // If we are not in header only updating case. Don't copy fragments.
+      if (alternate_index >= 0 &&
+          ((total_len == 0 && alternate.get_frag_offset_count() == 0) &&
!(f.allow_empty_doc && this->vio.nbytes == 0))) {
         alternate.copy_frag_offsets_from(write_vector->get(alternate_index));
       }
       alternate_index = write_vector->insert(&alternate, alternate_index);
diff --git a/iocore/cache/test/test_Update_L_to_S.cc b/iocore/cache/test/test_Update_L_to_S.cc
index 7ace4ac..9b4ea8e 100644
--- a/iocore/cache/test/test_Update_L_to_S.cc
+++ b/iocore/cache/test/test_Update_L_to_S.cc
@@ -51,6 +51,7 @@ public:
     switch (event) {
     case CACHE_EVENT_OPEN_READ:
       base->do_io_read();
+      REQUIRE(base->vc->alternate.get_frag_offset_count() < 5);
       break;
     case VC_EVENT_READ_READY:
       base->reenable();
diff --git a/iocore/cache/test/test_Update_S_to_L.cc b/iocore/cache/test/test_Update_S_to_L.cc
index def645d..5b0f6d1 100644
--- a/iocore/cache/test/test_Update_S_to_L.cc
+++ b/iocore/cache/test/test_Update_S_to_L.cc
@@ -51,6 +51,7 @@ public:
     switch (event) {
     case CACHE_EVENT_OPEN_READ:
       base->do_io_read();
+      REQUIRE(base->vc->alternate.get_frag_offset_count() > 8);
       break;
     case VC_EVENT_READ_READY:
       base->reenable();


Mime
View raw message