@@ -272,10 +272,11 @@ __wt_meta_checkpoint_clear(WT_SESSION_IMPL *session, const char *fname)
272272static int
273273__ckpt_set (WT_SESSION_IMPL * session , const char * fname , const char * v , bool use_base )
274274{
275+ struct timespec ts ;
275276 WT_DATA_HANDLE * dhandle ;
276277 WT_DECL_ITEM (tmp );
277278 WT_DECL_RET ;
278- size_t meta_base_length ;
279+ uint64_t base_hash ;
279280 char * config , * newcfg ;
280281 const char * cfg [3 ], * meta_base , * str ;
281282
@@ -294,27 +295,23 @@ __ckpt_set(WT_SESSION_IMPL *session, const char *fname, const char *v, bool use_
294295
295296 /* Check the metadata is not corrupted. */
296297 meta_base = dhandle -> meta_base ;
297- meta_base_length = strlen (meta_base );
298- if (dhandle -> meta_base_length != meta_base_length )
298+ base_hash = __wt_hash_city64 (meta_base , strlen (meta_base ));
299+ __wt_epoch (session , & ts );
300+ if (dhandle -> meta_hash != base_hash )
299301 WT_ERR_PANIC (session , WT_PANIC ,
300- "Corrupted metadata. The original metadata length was %lu while the new one is %lu." ,
301- dhandle -> meta_base_length , meta_base_length );
302- #ifdef HAVE_DIAGNOSTIC
303- if (!WT_STREQ (dhandle -> orig_meta_base , meta_base ))
304- WT_ERR_PANIC (session , WT_PANIC ,
305- "Corrupted metadata. The original metadata length was %lu while the new one is %lu. "
306- "The original metadata inserted was %s and the current "
302+ "Corrupted metadata. The original metadata inserted was %s and the current "
307303 "metadata is now %s." ,
308- dhandle -> meta_base_length , meta_base_length , dhandle -> orig_meta_base , meta_base );
309- #endif
304+ dhandle -> orig_meta_base , meta_base );
305+ else
306+ /*
307+ * Only if the hash matches, update the time structure to know when we last had a
308+ * matching hash. If there is a problem with the metadata string then we have bounded
309+ * the time from what is in the dhandle to the local time structure we have.
310+ */
311+ dhandle -> base_upd = ts ;
310312
311313 /* Concatenate the metadata base string with the checkpoint string. */
312314 WT_ERR (__wt_buf_fmt (session , tmp , "%s,%s" , meta_base , str ));
313- /*
314- * Check the new metadata length is at least as long as the original metadata string with
315- * the checkpoint base stripped out.
316- */
317- WT_ASSERT (session , tmp -> size >= dhandle -> meta_base_length );
318315 WT_ERR (__wt_metadata_update (session , fname , tmp -> mem ));
319316 } else {
320317 /* Retrieve the metadata for this file. */
0 commit comments