This is an automated email from the ASF dual-hosted git repository.

zwoop 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 5e72ad58a6 Revert "First cut at header heap genIDs and new API 
(#11780)" (#11853)
5e72ad58a6 is described below

commit 5e72ad58a6b9e82f3ee7b410cbb2de700c5beefb
Author: Leif Hedstrom <[email protected]>
AuthorDate: Fri Nov 15 08:46:18 2024 -0700

    Revert "First cut at header heap genIDs and new API (#11780)" (#11853)
    
    This reverts commit 8ecad69415a51d07c4b73f839b9b142fa536ca73.
    
    Cache compatibility issues.
---
 include/proxy/hdrs/HdrHeap.h |  4 +---
 include/ts/ts.h              |  6 ------
 src/api/InkAPI.cc            | 48 +-------------------------------------------
 src/proxy/hdrs/HdrHeap.cc    |  3 ---
 4 files changed, 2 insertions(+), 59 deletions(-)

diff --git a/include/proxy/hdrs/HdrHeap.h b/include/proxy/hdrs/HdrHeap.h
index 7357a76f8f..27f70248b4 100644
--- a/include/proxy/hdrs/HdrHeap.h
+++ b/include/proxy/hdrs/HdrHeap.h
@@ -274,7 +274,6 @@ public:
   char    *m_free_start;
   char    *m_data_start;
   uint32_t m_size;
-  uint32_t m_genid;
 
   bool m_writeable;
 
@@ -485,8 +484,7 @@ public:
   void        set(const HdrHeapSDKHandle *from);
   const char *make_sdk_string(const char *raw_str, int raw_str_len);
 
-  HdrHeap *m_heap  = nullptr;
-  uint32_t m_genid = 0;
+  HdrHeap *m_heap = nullptr;
 
   // In order to prevent gratitous refcounting,
   //  automatic C++ copies are disabled!
diff --git a/include/ts/ts.h b/include/ts/ts.h
index 6db04d894e..76030df541 100644
--- a/include/ts/ts.h
+++ b/include/ts/ts.h
@@ -332,12 +332,6 @@ TSMBuffer TSMBufferCreate(void);
  */
 TSReturnCode TSMBufferDestroy(TSMBuffer bufp);
 
-/**
-   Check to see if an MBuffer is still valid, from since the time
-   it was acquired.
- */
-bool TSMBufferIsValid(TSMBuffer bufp);
-
 /* --------------------------------------------------------------------------
    URLs */
 /**
diff --git a/src/api/InkAPI.cc b/src/api/InkAPI.cc
index d54b8038ff..8a2ffdd459 100644
--- a/src/api/InkAPI.cc
+++ b/src/api/InkAPI.cc
@@ -407,28 +407,9 @@ sdk_sanity_check_mbuffer(TSMBuffer bufp)
     return TS_ERROR;
   }
 
-  // ToDo: Can we safely check here that TSMbufferIsValid() is true?
-
   return TS_SUCCESS;
 }
 
-// This will reset the TSMBuffer's genid to the current genid of the heap. Any 
TS API
-// that returns a TSMBuffer should call this function before returning the 
buffer to the user.
-// The user (plugin) is responsible for calling TSMBufferIsValid() before 
using any previous
-// values returned by the TS API for the TSMBuffer.
-inline void
-sdk_revalidate_mbuffer(TSMBuffer bufp)
-{
-  HdrHeapSDKHandle *sdk_heap = (HdrHeapSDKHandle *)bufp;
-
-  // Lets not segfault in here, even though the bufp should have been 
validated before calling this function.
-  if (unlikely(bufp == nullptr || sdk_heap->m_heap == nullptr)) {
-    return;
-  }
-
-  sdk_heap->m_genid = sdk_heap->m_heap->m_genid;
-}
-
 TSReturnCode
 sdk_sanity_check_mime_hdr_handle(TSMLoc field)
 {
@@ -919,15 +900,6 @@ TSMBufferDestroy(TSMBuffer bufp)
   return TS_SUCCESS;
 }
 
-bool
-TSMBufferIsValid(TSMBuffer bufp)
-{
-  sdk_assert(sdk_sanity_check_mbuffer(bufp) == TS_SUCCESS);
-  HdrHeapSDKHandle *sdk_heap = (HdrHeapSDKHandle *)bufp;
-
-  return (sdk_heap->m_heap->m_genid == sdk_heap->m_genid);
-}
-
 ////////////////////////////////////////////////////////////////////
 //
 // URLs
@@ -3128,7 +3100,6 @@ TSCacheHttpInfoReqGet(TSCacheHttpInfo infop, TSMBuffer 
*bufp, TSMLoc *obj)
   *(reinterpret_cast<HTTPHdr **>(bufp)) = info->request_get();
   *obj                                  = 
reinterpret_cast<TSMLoc>(info->request_get()->m_http);
   sdk_assert(sdk_sanity_check_mbuffer(*bufp) == TS_SUCCESS);
-  sdk_revalidate_mbuffer(*bufp);
 }
 
 void
@@ -3139,7 +3110,6 @@ TSCacheHttpInfoRespGet(TSCacheHttpInfo infop, TSMBuffer 
*bufp, TSMLoc *obj)
   *(reinterpret_cast<HTTPHdr **>(bufp)) = info->response_get();
   *obj                                  = 
reinterpret_cast<TSMLoc>(info->response_get()->m_http);
   sdk_assert(sdk_sanity_check_mbuffer(*bufp) == TS_SUCCESS);
-  sdk_revalidate_mbuffer(*bufp);
 }
 
 time_t
@@ -3912,9 +3882,8 @@ TSHttpTxnClientReqGet(TSHttpTxn txnp, TSMBuffer *bufp, 
TSMLoc *obj)
     *obj                                  = 
reinterpret_cast<TSMLoc>(hptr->m_http);
     if (sdk_sanity_check_mbuffer(*bufp) == TS_SUCCESS) {
       hptr->mark_target_dirty();
-      sdk_revalidate_mbuffer(*bufp);
-
       return TS_SUCCESS;
+      ;
     }
   }
   return TS_ERROR;
@@ -3936,7 +3905,6 @@ TSHttpTxnPristineUrlGet(TSHttpTxn txnp, TSMBuffer *bufp, 
TSMLoc *url_loc)
     *url_loc                              = 
(TSMLoc)sm->t_state.unmapped_url.m_url_impl;
 
     if (sdk_sanity_check_mbuffer(*bufp) == TS_SUCCESS) {
-      sdk_revalidate_mbuffer(*bufp);
       if (*url_loc == nullptr) {
         *url_loc = (TSMLoc)hptr->m_http->u.req.m_url_impl;
       }
@@ -4022,8 +3990,6 @@ TSHttpTxnClientRespGet(TSHttpTxn txnp, TSMBuffer *bufp, 
TSMLoc *obj)
     *(reinterpret_cast<HTTPHdr **>(bufp)) = hptr;
     *obj                                  = 
reinterpret_cast<TSMLoc>(hptr->m_http);
     sdk_assert(sdk_sanity_check_mbuffer(*bufp) == TS_SUCCESS);
-    sdk_revalidate_mbuffer(*bufp);
-
     return TS_SUCCESS;
   }
 
@@ -4044,8 +4010,6 @@ TSHttpTxnServerReqGet(TSHttpTxn txnp, TSMBuffer *bufp, 
TSMLoc *obj)
     *(reinterpret_cast<HTTPHdr **>(bufp)) = hptr;
     *obj                                  = 
reinterpret_cast<TSMLoc>(hptr->m_http);
     sdk_assert(sdk_sanity_check_mbuffer(*bufp) == TS_SUCCESS);
-    sdk_revalidate_mbuffer(*bufp);
-
     return TS_SUCCESS;
   }
 
@@ -4066,8 +4030,6 @@ TSHttpTxnServerRespGet(TSHttpTxn txnp, TSMBuffer *bufp, 
TSMLoc *obj)
     *(reinterpret_cast<HTTPHdr **>(bufp)) = hptr;
     *obj                                  = 
reinterpret_cast<TSMLoc>(hptr->m_http);
     sdk_assert(sdk_sanity_check_mbuffer(*bufp) == TS_SUCCESS);
-    sdk_revalidate_mbuffer(*bufp);
-
     return TS_SUCCESS;
   }
 
@@ -4108,7 +4070,6 @@ TSHttpTxnCachedReqGet(TSHttpTxn txnp, TSMBuffer *bufp, 
TSMLoc *obj)
   *(reinterpret_cast<HdrHeapSDKHandle **>(bufp)) = *handle;
   *obj                                           = 
reinterpret_cast<TSMLoc>(cached_hdr->m_http);
   sdk_assert(sdk_sanity_check_mbuffer(*bufp) == TS_SUCCESS);
-  sdk_revalidate_mbuffer(*bufp);
 
   return TS_SUCCESS;
 }
@@ -4148,7 +4109,6 @@ TSHttpTxnCachedRespGet(TSHttpTxn txnp, TSMBuffer *bufp, 
TSMLoc *obj)
   *(reinterpret_cast<HdrHeapSDKHandle **>(bufp)) = *handle;
   *obj                                           = 
reinterpret_cast<TSMLoc>(cached_hdr->m_http);
   sdk_assert(sdk_sanity_check_mbuffer(*bufp) == TS_SUCCESS);
-  sdk_revalidate_mbuffer(*bufp);
 
   return TS_SUCCESS;
 }
@@ -4185,7 +4145,6 @@ TSHttpTxnCachedRespModifiableGet(TSHttpTxn txnp, 
TSMBuffer *bufp, TSMLoc *obj)
   *(reinterpret_cast<HTTPHdr **>(bufp)) = c_resp;
   *obj                                  = 
reinterpret_cast<TSMLoc>(c_resp->m_http);
   sdk_assert(sdk_sanity_check_mbuffer(*bufp) == TS_SUCCESS);
-  sdk_revalidate_mbuffer(*bufp);
 
   return TS_SUCCESS;
 }
@@ -4618,7 +4577,6 @@ TSHttpTxnTransformRespGet(TSHttpTxn txnp, TSMBuffer 
*bufp, TSMLoc *obj)
   if (hptr->valid()) {
     *(reinterpret_cast<HTTPHdr **>(bufp)) = hptr;
     *obj                                  = 
reinterpret_cast<TSMLoc>(hptr->m_http);
-    sdk_revalidate_mbuffer(*bufp);
     return sdk_sanity_check_mbuffer(*bufp);
   }
 
@@ -5552,7 +5510,6 @@ TSHttpAltInfoClientReqGet(TSHttpAltInfo infop, TSMBuffer 
*bufp, TSMLoc *obj)
 
   *(reinterpret_cast<HTTPHdr **>(bufp)) = &info->m_client_req;
   *obj                                  = 
reinterpret_cast<TSMLoc>(info->m_client_req.m_http);
-  sdk_revalidate_mbuffer(*bufp);
 
   return sdk_sanity_check_mbuffer(*bufp);
 }
@@ -5566,7 +5523,6 @@ TSHttpAltInfoCachedReqGet(TSHttpAltInfo infop, TSMBuffer 
*bufp, TSMLoc *obj)
 
   *(reinterpret_cast<HTTPHdr **>(bufp)) = &info->m_cached_req;
   *obj                                  = 
reinterpret_cast<TSMLoc>(info->m_cached_req.m_http);
-  sdk_revalidate_mbuffer(*bufp);
 
   return sdk_sanity_check_mbuffer(*bufp);
 }
@@ -5580,7 +5536,6 @@ TSHttpAltInfoCachedRespGet(TSHttpAltInfo infop, TSMBuffer 
*bufp, TSMLoc *obj)
 
   *(reinterpret_cast<HTTPHdr **>(bufp)) = &info->m_cached_resp;
   *obj                                  = 
reinterpret_cast<TSMLoc>(info->m_cached_resp.m_http);
-  sdk_revalidate_mbuffer(*bufp);
 
   return sdk_sanity_check_mbuffer(*bufp);
 }
@@ -6626,7 +6581,6 @@ TSFetchPageRespGet(TSHttpTxn txnp, TSMBuffer *bufp, 
TSMLoc *obj)
   if (hptr->valid()) {
     *(reinterpret_cast<HTTPHdr **>(bufp)) = hptr;
     *obj                                  = 
reinterpret_cast<TSMLoc>(hptr->m_http);
-    sdk_revalidate_mbuffer(*bufp);
     return sdk_sanity_check_mbuffer(*bufp);
   }
 
diff --git a/src/proxy/hdrs/HdrHeap.cc b/src/proxy/hdrs/HdrHeap.cc
index ccdcfe7d61..03ad762728 100644
--- a/src/proxy/hdrs/HdrHeap.cc
+++ b/src/proxy/hdrs/HdrHeap.cc
@@ -92,7 +92,6 @@ HdrHeap::init()
 {
   m_data_start = m_free_start = (reinterpret_cast<char *>(this)) + 
HDR_HEAP_HDR_SIZE;
   m_magic                     = HDR_BUF_MAGIC_ALIVE;
-  m_genid                     = 0;
   m_writeable                 = true;
 
   m_next      = nullptr;
@@ -371,8 +370,6 @@ HdrHeap::coalesce_str_heaps(int incoming_size)
   ink_assert(incoming_size >= 0);
   ink_assert(m_writeable);
 
-  ++m_genid;
-
   new_heap_size += required_space_for_evacuation();
 
   HdrStrHeap *new_heap = HdrStrHeap::alloc(new_heap_size);

Reply via email to