-
Type: Improvement
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
8
-
Storage Engines 2020-02-10
While I work on WT-5467 to remove the cursor pool, I am having trouble at connection close with history store cursors. For some reason, history store cursors do not like to be cached as of the attached patch. I get the following crash if I do not disable cursor caching for the history store cursors:
#0 __strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:93 #1 0x00007fe0e0ea84d3 in _IO_vfprintf_internal (s=s@entry=0x7ffca2ba7320, format=format@entry=0x7fe0dec9bb1e ", %s", ap=ap@entry=0x7ffca2ba7500) at vfprintf.c:1643 #2 0x00007fe0e0ed3910 in _IO_vsnprintf (string=0x7ffca2ba76c7 ", ", maxlen=<optimised out>, format=0x7fe0dec9bb1e ", %s", args=0x7ffca2ba7500) at vsnprintf.c:114 #3 0x00007fe0debe2084 in __wt_vsnprintf_len_incr (buf=0x7ffca2ba76c7 ", ", size=3977, retsizep=0x7ffca2ba7638, fmt=0x7fe0dec9bb1e ", %s", ap=0x7ffca2ba7500) at ../src/os_posix/os_snprintf.c:21 #4 0x00007fe0dec37e71 in __wt_snprintf_len_set (buf=0x7ffca2ba76c7 ", ", size=3977, retsizep=0x7ffca2ba7638, fmt=0x7fe0dec9bb1e ", %s") at ../src/include/misc.i:110 #5 0x00007fe0dec38819 in __eventv (session=0x5582677384a0, msg_event=false, error=0, func=0x7fe0dec86580 <__func__.35607> "__curfile_close", line=511, fmt=0x7fe0dec85b68 "%s", ap=0x7ffca2ba8770) at ../src/support/err.c:219 #6 0x00007fe0dec38f56 in __wt_errx_func (session=0x5582677384a0, func=0x7fe0dec86580 <__func__.35607> "__curfile_close", line=511, fmt=0x7fe0dec85b68 "%s") at ../src/support/err.c:330 #7 0x00007fe0deb57067 in __curfile_close (cursor=0x55826778eba0) at ../src/cursor/cur_file.c:511 #8 0x00007fe0dec1f53f in __session_close_cursors (session=0x5582677384a0, cursors=0x558267761350) at ../src/session/session_api.c:234 #9 0x00007fe0dec1f5de in __session_close_cached_cursors (session=0x5582677384a0) at ../src/session/session_api.c:252 #10 0x00007fe0dec1fa5a in __session_close (wt_session=0x5582677384a0, config=0x0) at ../src/session/session_api.c:288 #11 0x00007fe0deb363a4 in __wt_connection_close (conn=0x55826771e010) at ../src/conn/conn_open.c:152 #12 0x00007fe0deb2276a in __conn_close (wt_conn=0x55826771e010, config=0x0) at ../src/conn/conn_api.c:1100
Note: As part of the patch, I have disabled cursor caching for history store cursors:
$ cat diff diff --git a/src/cursor/cur_file.c b/src/cursor/cur_file.c index 32adec887..cce07a661 100644 --- a/src/cursor/cur_file.c +++ b/src/cursor/cur_file.c @@ -720,8 +720,11 @@ __curfile_create(WT_SESSION_IMPL *session, WT_CURSOR *owner, const char *cfg[], /* * WiredTiger.wt should not be cached, doing so interferes with named checkpoints. + * WiredTigerHS.wt should not be cached <-- Needs a discussion whether we should cache HS + * cursors. */ - if (cacheable && strcmp(WT_METAFILE_URI, cursor->internal_uri) != 0) + if (cacheable && strcmp(WT_METAFILE_URI, cursor->internal_uri) != 0 && + strcmp(WT_HS_URI, cursor->internal_uri) != 0) F_SET(cursor, WT_CURSTD_CACHEABLE); WT_ERR(__wt_cursor_init(cursor, cursor->internal_uri, owner, cfg, cursorp));
This ticket is to understand how to fix cursor caching for history store cursor. Before digging too much into a "fix", also to keep in mind:
- If we need cursor caching for history store cursors or an alternate mechanism would be more efficient. Neither we want to open/close history store cursor each time required, nor we want to build an alternative mechanism to do what cursor caching already achieves.