diff options
author | Alex Gorrod <alexander.gorrod@mongodb.com> | 2017-05-24 15:24:19 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-24 15:24:19 -0400 |
commit | 92dde8bce6cf16c079baf47d4abd35a4e23195c4 (patch) | |
tree | 5780a4aa60cda25ec7bf59d2c2931a2189649006 | |
parent | a3073be71b1406c7eef60e35fcf2cdc1174e752b (diff) | |
download | mongo-92dde8bce6cf16c079baf47d4abd35a4e23195c4.tar.gz |
Revert "WT-2972 Add interface allowing partial updates to existing values (#3406)" (#3434)
This reverts commit a3073be71b1406c7eef60e35fcf2cdc1174e752b.
55 files changed, 355 insertions, 1527 deletions
diff --git a/dist/s_define.list b/dist/s_define.list index 9f94132f584..b7f124ef18c 100644 --- a/dist/s_define.list +++ b/dist/s_define.list @@ -58,7 +58,7 @@ WT_STAT_INCRV_BASE WT_STAT_WRITE WT_TIMEDIFF_US WT_TRET_ERROR_OK -WT_UPDATE_SIZE +WT_UPDATE_RESERVED_VALUE WT_WITH_LOCK_NOWAIT WT_WITH_LOCK_WAIT __F diff --git a/dist/s_string.ok b/dist/s_string.ok index d5a562fcbd1..ac21c61a8ef 100644 --- a/dist/s_string.ok +++ b/dist/s_string.ok @@ -344,7 +344,6 @@ Split's Stoica StoreLoad StoreStore -Su Syscall TAILQ TCMalloc @@ -950,7 +949,6 @@ nd needkey needvalue negint -nentries newbar newfile newuri @@ -1094,7 +1092,6 @@ rotN rotn rp rpc -ru run's runtime rwlock diff --git a/dist/stat_data.py b/dist/stat_data.py index 203a88fb055..4a147ca44eb 100644 --- a/dist/stat_data.py +++ b/dist/stat_data.py @@ -231,8 +231,8 @@ connection_stats = [ CacheStat('cache_eviction_walks_abandoned', 'eviction walks abandoned'), CacheStat('cache_eviction_walks_active', 'files with active eviction walks', 'no_clear,no_scale'), CacheStat('cache_eviction_walks_started', 'files with new eviction walks started'), - CacheStat('cache_eviction_worker_created', 'eviction worker thread created'), CacheStat('cache_eviction_worker_evicting', 'eviction worker thread evicting pages'), + CacheStat('cache_eviction_worker_created', 'eviction worker thread created'), CacheStat('cache_eviction_worker_removed', 'eviction worker thread removed'), CacheStat('cache_hazard_checks', 'hazard pointer check calls'), CacheStat('cache_hazard_max', 'hazard pointer maximum array length', 'max_aggregate,no_scale'), @@ -262,11 +262,9 @@ connection_stats = [ ########################################## CursorStat('cursor_create', 'cursor create calls'), CursorStat('cursor_insert', 'cursor insert calls'), - CursorStat('cursor_modify', 'cursor modify calls'), CursorStat('cursor_next', 'cursor next calls'), CursorStat('cursor_prev', 'cursor prev calls'), CursorStat('cursor_remove', 'cursor remove calls'), - CursorStat('cursor_reserve', 'cursor reserve calls'), CursorStat('cursor_reset', 'cursor reset calls'), CursorStat('cursor_restart', 'cursor restarted searches'), CursorStat('cursor_search', 'cursor search calls'), @@ -555,12 +553,10 @@ dsrc_stats = [ CursorStat('cursor_insert', 'insert calls'), CursorStat('cursor_insert_bulk', 'bulk-loaded cursor-insert calls'), CursorStat('cursor_insert_bytes', 'cursor-insert key and value bytes inserted', 'size'), - CursorStat('cursor_modify', 'modify calls'), CursorStat('cursor_next', 'next calls'), CursorStat('cursor_prev', 'prev calls'), CursorStat('cursor_remove', 'remove calls'), CursorStat('cursor_remove_bytes', 'cursor-remove key bytes removed', 'size'), - CursorStat('cursor_reserve', 'reserve calls'), CursorStat('cursor_reset', 'reset calls'), CursorStat('cursor_restart', 'restarted searches'), CursorStat('cursor_search', 'search calls'), diff --git a/examples/c/ex_all.c b/examples/c/ex_all.c index 5e1fa4bbcc5..f94863584e8 100644 --- a/examples/c/ex_all.c +++ b/examples/c/ex_all.c @@ -309,39 +309,6 @@ cursor_ops(WT_SESSION *session) } { - /*! [Modify an existing record] */ - WT_MODIFY entries[3]; - const char *key = "some key"; - ret = session->open_cursor( - session, "table:mytable", NULL, NULL, &cursor); - - /* Position the cursor. */ - cursor->set_key(cursor, key); - ret = cursor->search(cursor); - - /* Replace 20 bytes starting at byte offset 5. */ - entries[0].data.data = "some data"; - entries[0].data.size = strlen(entries[0].data.data); - entries[0].offset = 5; - entries[0].size = 20; - - /* Insert data at byte offset 40. */ - entries[1].data.data = "and more data"; - entries[1].data.size = strlen(entries[1].data.data); - entries[1].offset = 40; - entries[1].size = 0; - - /* Replace 2 bytes starting at byte offset 10. */ - entries[2].data.data = "and more data"; - entries[2].data.size = strlen(entries[2].data.data); - entries[2].offset = 10; - entries[2].size = 2; - - ret = cursor->modify(cursor, entries, 3); - /*! [Modify an existing record] */ - } - - { /*! [Update an existing record or insert a new record] */ const char *key = "some key", *value = "some value"; ret = session->open_cursor( diff --git a/examples/java/com/wiredtiger/examples/ex_cursor.java b/examples/java/com/wiredtiger/examples/ex_cursor.java index 4a57f3c35da..498ace12865 100644 --- a/examples/java/com/wiredtiger/examples/ex_cursor.java +++ b/examples/java/com/wiredtiger/examples/ex_cursor.java @@ -156,41 +156,6 @@ public class ex_cursor { } /*! [cursor remove] */ - /*! [cursor modify] */ - public static int - cursor_modify(Cursor cursor) - throws WiredTigerException - { - byte orig[] = new byte[4]; - for (int i = 0; i < 4; i++) - orig[i] = (byte)i; - cursor.putKeyString("key"); - cursor.putValueByteArray(orig); - cursor.insert(); // 0x0 0x1 0x2 0x3 - - byte b10[] = new byte[4]; - for (int i = 0; i < 4; i++) - b10[i] = (byte)(0x10 + i); - byte b20[] = new byte[4]; - for (int i = 0; i < 4; i++) - b20[i] = (byte)(0x20 + i); - - Modify modlist[] = new Modify[2]; - // The following Modify replaces one byte at position one by: - // (0x10 0x11 0x12 0x13), leaving: - // 0x0 0x10 0x11 0x12 0x13 0x2 0x3 - modlist[0] = new Modify(b10, 1, 1); - - // The following Modify replaces one byte at position three by: - // (0x20 0x21 0x22 0x23), leaving: - // 0x0 0x10 0x11 0x20 0x21 0x22 0x23 0x13 0x2 0x3 - modlist[1] = new Modify(b20, 3, 1); - - cursor.putKeyString("key"); - return (cursor.modify(modlist)); - } - /*! [cursor modify] */ - public static int cursorExample() throws WiredTigerException @@ -254,12 +219,6 @@ public class ex_cursor { ret = cursor_remove(cursor); ret = cursor.close(); - /* Create a table with a raw value to illustrate certain operations. */ - ret = session.create("table:raw", "key_format=S,value_format=u"); - cursor = session.open_cursor("table:raw", null, null); - ret = cursor_modify(cursor); - ret = cursor.close(); - /* Note: closing the connection implicitly closes open session(s). */ if ((ret = conn.close(null)) != 0) System.err.println("Error connecting to " + home + ": " + diff --git a/lang/java/Makefile.am b/lang/java/Makefile.am index 71515c430fd..2ff822a5d08 100644 --- a/lang/java/Makefile.am +++ b/lang/java/Makefile.am @@ -18,7 +18,6 @@ JAVA_SRC = \ $(JAVADESTFULL)/AsyncOpType.java \ $(JAVADESTFULL)/Connection.java \ $(JAVADESTFULL)/Cursor.java \ - $(JAVADESTFULL)/Modify.java \ $(JAVADESTFULL)/SearchStatus.java \ $(JAVADESTFULL)/PackFormatInputStream.java \ $(JAVADESTFULL)/PackInputStream.java \ @@ -32,7 +31,6 @@ JAVA_SRC = \ $(JAVADESTFULL)/wiredtiger.java \ $(JAVADESTFULL)/wiredtigerConstants.java \ $(JAVADESTFULL)/wiredtigerJNI.java \ - $(JAVADESTFULL)/WT_MODIFY_LIST.java \ $(JAVAEXAMPLES)/ex_access.java \ $(JAVAEXAMPLES)/ex_all.java \ $(JAVAEXAMPLES)/ex_async.java \ diff --git a/lang/java/java_doc.i b/lang/java/java_doc.i index f9e017ee43a..8088abbf065 100644 --- a/lang/java/java_doc.i +++ b/lang/java/java_doc.i @@ -12,7 +12,6 @@ COPYDOC(__wt_cursor, WT_CURSOR, reset) COPYDOC(__wt_cursor, WT_CURSOR, search) COPYDOC(__wt_cursor, WT_CURSOR, search_near) COPYDOC(__wt_cursor, WT_CURSOR, insert) -COPYDOC(__wt_cursor, WT_CURSOR, modify) COPYDOC(__wt_cursor, WT_CURSOR, update) COPYDOC(__wt_cursor, WT_CURSOR, remove) COPYDOC(__wt_cursor, WT_CURSOR, reserve) diff --git a/lang/java/wiredtiger.i b/lang/java/wiredtiger.i index 4c22a0af43b..d6fc5fc8b9a 100644 --- a/lang/java/wiredtiger.i +++ b/lang/java/wiredtiger.i @@ -47,7 +47,6 @@ %} %{ -#include "wiredtiger.h" #include "src/include/wt_internal.h" /* @@ -109,23 +108,6 @@ static void throwWiredTigerException(JNIEnv *jenv, int err) { (*jenv)->ThrowNew(jenv, excep, wiredtiger_strerror(err)); } -struct __wt_java_modify_impl; -struct __wt_java_modify_list; -typedef struct __wt_java_modify_impl WT_MODIFY_IMPL; -typedef struct __wt_java_modify_list WT_MODIFY_LIST; -static void modify_impl_release(WT_MODIFY_IMPL *impl); -static void modify_list_release(WT_MODIFY_LIST *impl); - -/* - * An extension to the WT_MODIFY struct, so we can associate some Java-specific - * information with it. - */ -typedef struct __wt_java_modify_impl { - WT_MODIFY modify; - JNIEnv *jnienv; - jobject ref; -} WT_MODIFY_IMPL; - %} /* No finalizers */ @@ -177,32 +159,6 @@ typedef struct __wt_java_modify_impl { } %} -/* - * In some cases, for an internal interface, we need something like a WT_ITEM, - * but we need to hold onto the memory past the method call, and release it - * later. A WT_ITEM_HOLD serves the purpose, it retains the java object - * for the byte array that we make into a global reference. - */ -%typemap(jni) WT_ITEM_HOLD, WT_ITEM_HOLD * "jbyteArray" -%typemap(jtype) WT_ITEM_HOLD, WT_ITEM_HOLD * "byte[]" -%typemap(jstype) WT_ITEM_HOLD, WT_ITEM_HOLD * "byte[]" - -%typemap(javain) WT_ITEM_HOLD, WT_ITEM_HOLD * "$javainput" -%typemap(javaout) WT_ITEM_HOLD, WT_ITEM_HOLD * { - return ($jnicall); -} -%typemap(in) WT_ITEM_HOLD * (WT_ITEM_HOLD item) %{ - $1 = &item; - $1->data = (*jenv)->GetByteArrayElements(jenv, $input, 0); - $1->size = (size_t)(*jenv)->GetArrayLength(jenv, $input); - $1->jnienv = jenv; - $1->ref = (*jenv)->NewGlobalRef(jenv, $input); -%} - -%typemap(argout) WT_ITEM_HOLD * %{ - /* Explicitly don't release the byte array elements here. */ -%} - /* Don't require empty config strings. */ %typemap(default) const char *config %{ $1 = NULL; %} @@ -353,10 +309,6 @@ WT_CLASS(struct __wt_async_op, WT_ASYNC_OP, op) %rename (prev_wrap) __wt_cursor::prev; %javamethodmodifiers __wt_cursor::key_format "protected"; %javamethodmodifiers __wt_cursor::value_format "protected"; -%ignore __wt_modify::data; -%ignore __wt_modify::position; -%ignore __wt_modify::size; -%ignore __wt_cursor::modify; %ignore __wt_cursor::compare(WT_CURSOR *, WT_CURSOR *, int *); %rename (compare_wrap) __wt_cursor::compare; @@ -1272,47 +1224,6 @@ WT_ASYNC_CALLBACK javaApiAsyncHandler = {javaAsyncHandler}; JCALL1(DeleteLocalRef, jcb->jnienv, jcursor); return (0); } - - int modify_wrap(WT_MODIFY_LIST *list, WT_ITEM *k) { - int ret; - - $self->set_key($self, k); - ret = $self->modify(self, list->mod_array, list->count); - modify_list_release(list); - return (ret); - } - - /* - * Called internally after a new call. The artificial constructor for - * WT_MODIFY_LIST has no opportunity to throw an exception on a memory - * allocation failure, so the the null check must be made within a - * method on WT_CURSOR. - */ - bool _new_check_modify_list(WT_MODIFY_LIST *list) { - JAVA_CALLBACK *jcb; - if (list == NULL) { - jcb = (JAVA_CALLBACK *)$self->lang_private; - throwWiredTigerException(jcb->jnienv, ENOMEM); - return (false); - } - return (true); - } - - /* - * Called internally after a new call. The artificial constructor for - * WT_MODIFY has no opportunity to throw an exception on a memory - * allocation failure, so the the null check must be made within a - * method on WT_CURSOR. - */ - bool _new_check_modify(WT_MODIFY *mod) { - JAVA_CALLBACK *jcb; - if (mod == NULL) { - jcb = (JAVA_CALLBACK *)$self->lang_private; - throwWiredTigerException(jcb->jnienv, ENOMEM); - return (false); - } - return (true); - } } /* Cache key/value formats in Cursor */ @@ -1909,149 +1820,6 @@ WT_ASYNC_CALLBACK javaApiAsyncHandler = {javaAsyncHandler}; return new PackInputStream(valueFormat, get_value_wrap(), _java_raw()); } - - /** - * Modify an existing record. - * - * The cursor must already be positioned, and the key's value will be - * updated. - * - * \param mods an array of modifications. - * \return 0 on success, errno on error. - */ - public int modify(Modify mods[]) - throws WiredTigerException { - byte[] key = keyPacker.getValue(); - keyPacker.reset(); - - WT_MODIFY_LIST l = new WT_MODIFY_LIST(mods.length); - if (!_new_check_modify_list(l)) - return (0); // exception is already thrown - int pos = 0; - - for (Modify m : mods) { - if (!_new_check_modify(m)) - return (0); // exception is already thrown - l.set(pos, m); - pos++; - } - return modify_wrap(l, key); - } -%} - -/* - * Support for WT_CURSOR.modify. - */ - -%inline %{ -typedef struct __wt_java_item_hold { -#ifndef SWIG - void *data; - size_t size; - JNIEnv *jnienv; - jobject ref; -#endif -} WT_ITEM_HOLD; - -/* - * An internal Java class encapsulates a list of Modify objects (stored as a - * WT_MODIFY array in C). - */ -typedef struct __wt_java_modify_list { -#ifndef SWIG - WT_MODIFY *mod_array; - jobject *ref_array; - JNIEnv *jnienv; - int count; -#endif -} WT_MODIFY_LIST; -%} -%extend __wt_java_modify_list { - __wt_java_modify_list(int count) { - WT_MODIFY_LIST *self; - if (__wt_calloc_def(NULL, 1, &self) != 0) - return (NULL); - if (__wt_calloc_def(NULL, (size_t)count, - &self->mod_array) != 0) { - __wt_free(NULL, self); - return (NULL); - } - if (__wt_calloc_def(NULL, (size_t)count, - &self->ref_array) != 0) { - __wt_free(NULL, self->mod_array); - __wt_free(NULL, self); - return (NULL); - } - self->count = count; - return (self); - } - ~__wt_java_modify_list() { - modify_list_release(self); - __wt_free(NULL, self); - } - void set(int i, WT_MODIFY *m) { - WT_MODIFY_IMPL *impl = (WT_MODIFY_IMPL *)m; - self->mod_array[i] = *m; - self->ref_array[i] = impl->ref; - impl->ref = (jobject)0; - self->jnienv = impl->jnienv; - } -}; - -%extend __wt_modify { - __wt_modify() { - WT_MODIFY_IMPL *self; - if (__wt_calloc_def(NULL, 1, &self) != 0) - return (NULL); - self->modify.data.data = NULL; - self->modify.data.size = 0; - self->modify.offset = 0; - self->modify.size = 0; - return (&self->modify); - } - __wt_modify(WT_ITEM_HOLD *itemdata, - size_t offset, size_t size) { - WT_MODIFY_IMPL *self; - if (__wt_calloc_def(NULL, 1, &self) != 0) - return (NULL); - self->modify.data.data = itemdata->data; - self->modify.data.size = itemdata->size; - self->modify.offset = offset; - self->modify.size = size; - self->ref = itemdata->ref; - self->jnienv = itemdata->jnienv; - return (&self->modify); - } - ~__wt_modify() { - modify_impl_release((WT_MODIFY_IMPL *)self); - __wt_free(NULL, self); - } -}; - -%{ -static void modify_list_release(WT_MODIFY_LIST *list) { - for (int i = 0; i < list->count; i++) - if (list->ref_array[i] != (jobject)0) { - (*list->jnienv)->ReleaseByteArrayElements( - list->jnienv, list->ref_array[i], - (jbyte *)list->mod_array[i].data.data, 0); - (*list->jnienv)->DeleteGlobalRef( - list->jnienv, list->ref_array[i]); - } - __wt_free(NULL, list->ref_array); - __wt_free(NULL, list->mod_array); - list->count = 0; -} - -static void modify_impl_release(WT_MODIFY_IMPL *impl) { - if (impl->ref != (jobject)0) { - (*impl->jnienv)->ReleaseByteArrayElements( - impl->jnienv, impl->ref, - (jbyte *)impl->modify.data.data, 0); - (*impl->jnienv)->DeleteGlobalRef(impl->jnienv, impl->ref); - impl->ref = (jobject)0; - } -} %} /* Put a WiredTigerException on all wrapped methods. We'd like this @@ -2134,7 +1902,6 @@ REQUIRE_WRAP(WT_ASYNC_OP::get_id, __wt_async_op::get_id,getId) %rename(AsyncOp) __wt_async_op; %rename(Cursor) __wt_cursor; -%rename(Modify) __wt_modify; %rename(Session) __wt_session; %rename(Connection) __wt_connection; diff --git a/lang/python/wiredtiger.i b/lang/python/wiredtiger.i index 61c7fc62c43..7a297312bb8 100644 --- a/lang/python/wiredtiger.i +++ b/lang/python/wiredtiger.i @@ -151,74 +151,6 @@ from packing import pack, unpack } } -%typemap(in) WT_MODIFY * (int len, WT_MODIFY *modarray, int i) { - len = PyList_Size($input); - /* - * We allocate an extra cleared WT_MODIFY struct, the first - * entry will be used solely to transmit the array length to - * the call site. - */ - if (__wt_calloc_def(NULL, (size_t)len + 1, &modarray) != 0) - SWIG_exception_fail(SWIG_MemoryError, "WT calloc failed"); - modarray[0].size = (size_t)len; - for (i = 1; i <= len; i++) { - PyObject *dataobj, *modobj, *offsetobj, *sizeobj; - char *datadata; - long offset, size; - Py_ssize_t datasize; - - if ((modobj = PySequence_GetItem($input, i - 1)) == NULL) - SWIG_exception_fail(SWIG_IndexError, - "Modify sequence failed"); - - WT_GETATTR(dataobj, modobj, "data"); - if (PyString_AsStringAndSize(dataobj, &datadata, - &datasize) < 0) { - Py_DECREF(dataobj); - Py_DECREF(modobj); - SWIG_exception_fail(SWIG_AttributeError, - "Modify.data bad value"); - } - modarray[i].data.data = malloc(datasize); - memcpy(modarray[i].data.data, datadata, datasize); - modarray[i].data.size = datasize; - Py_DECREF(dataobj); - - WT_GETATTR(offsetobj, modobj, "offset"); - if ((offset = PyInt_AsLong(offsetobj)) < 0) { - Py_DECREF(offsetobj); - Py_DECREF(modobj); - SWIG_exception_fail(SWIG_RuntimeError, - "Modify.offset bad value"); - } - modarray[i].offset = offset; - Py_DECREF(offsetobj); - - WT_GETATTR(sizeobj, modobj, "size"); - if ((size = PyInt_AsLong(sizeobj)) < 0) { - Py_DECREF(sizeobj); - Py_DECREF(modobj); - SWIG_exception_fail(SWIG_RuntimeError, - "Modify.size bad value"); - } - modarray[i].size = size; - Py_DECREF(sizeobj); - Py_DECREF(modobj); - } - $1 = modarray; -} - -%typemap(freearg) WT_MODIFY * { - /* The WT_MODIFY arg is in position 2. Is there a better way? */ - WT_MODIFY *modarray = modarray2; - size_t i, len; - - len = modarray[0].size; - for (i = 1; i <= len; i++) - __wt_free(NULL, modarray[i].data.data); - __wt_free(NULL, modarray); -} - /* 64 bit typemaps. */ %typemap(in) uint64_t { $1 = PyLong_AsUnsignedLongLong($input); @@ -312,13 +244,6 @@ static PyObject *wtError; static int sessionFreeHandler(WT_SESSION *session_arg); static int cursorFreeHandler(WT_CURSOR *cursor_arg); - -#define WT_GETATTR(var, parent, name) \ - do if ((var = PyObject_GetAttrString(parent, name)) == NULL) { \ - Py_DECREF(parent); \ - SWIG_exception_fail(SWIG_AttributeError, \ - "Modify." #name " get failed"); \ - } while(0) %} %init %{ @@ -448,8 +373,8 @@ retry: } %enddef -/* An API that returns a value that shouldn't be checked uses this. */ -%define ANY_OK(m) +/* Any API that returns an enum type uses this. */ +%define ENUM_OK(m) %exception m { $action } @@ -483,14 +408,12 @@ retry: %enddef EBUSY_OK(__wt_connection::async_new_op) -ANY_OK(__wt_async_op::get_type) +ENUM_OK(__wt_async_op::get_type) NOTFOUND_OK(__wt_cursor::next) NOTFOUND_OK(__wt_cursor::prev) NOTFOUND_OK(__wt_cursor::remove) NOTFOUND_OK(__wt_cursor::search) NOTFOUND_OK(__wt_cursor::update) -ANY_OK(__wt_modify::__wt_modify) -ANY_OK(__wt_modify::~__wt_modify) COMPARE_OK(__wt_cursor::_compare) COMPARE_OK(__wt_cursor::_equals) @@ -525,11 +448,6 @@ COMPARE_NOTFOUND_OK(__wt_cursor::_search_near) %ignore __wt_cursor::get_value; %ignore __wt_cursor::set_key; %ignore __wt_cursor::set_value; -%ignore __wt_cursor::modify(WT_CURSOR *, WT_MODIFY *, int); -%rename (modify) __wt_cursor::_modify; -%ignore __wt_modify::data; -%ignore __wt_modify::offset; -%ignore __wt_modify::size; /* Next, override methods that return integers via arguments. */ %ignore __wt_cursor::compare(WT_CURSOR *, WT_CURSOR *, int *); @@ -854,15 +772,6 @@ typedef int int_void; return (cursorFreeHandler($self)); } - /* - * modify: the size of the array was put into the first element by the - * typemap. - */ - int _modify(WT_MODIFY *list) { - int count = (int)list[0].size; - return (self->modify(self, &list[1], count)); - } - %pythoncode %{ def get_key(self): '''get_key(self) -> object @@ -961,21 +870,6 @@ typedef int int_void; %} }; -/* - * Support for WT_CURSOR.modify. The WT_MODIFY object is known to - * SWIG, but its attributes are regular Python attributes. - * We extract the attributes at the call site to WT_CURSOR.modify - * so we don't have to deal with managing Python objects references. - */ -%extend __wt_modify { -%pythoncode %{ - def __init__(self, data = '', offset = 0, size = 0): - self.data = data - self.offset = offset - self.size = size -%} -}; - %extend __wt_session { int _log_printf(const char *msg) { return self->log_printf(self, "%s", msg); @@ -1057,7 +951,6 @@ OVERRIDE_METHOD(__wt_session, WT_SESSION, log_printf, (self, msg)) %rename(AsyncOp) __wt_async_op; %rename(Cursor) __wt_cursor; -%rename(Modify) __wt_modify; %rename(Session) __wt_session; %rename(Connection) __wt_connection; @@ -1081,7 +974,7 @@ writeToPythonStream(const char *streamname, const char *message) written = NULL; arglist = arglist2 = NULL; msglen = strlen(message); - WT_RET(__wt_malloc(NULL, msglen + 2, &msg)); + msg = malloc(msglen + 2); strcpy(msg, message); strcpy(&msg[msglen], "\n"); @@ -1117,7 +1010,8 @@ err: Py_XDECREF(arglist2); /* Release python Global Interpreter Lock */ SWIG_PYTHON_THREAD_END_BLOCK; - __wt_free(NULL, msg); + if (msg) + free(msg); return (ret); } @@ -1338,3 +1232,4 @@ _rename_with_prefix('WT_STAT_CONN_', stat.conn) _rename_with_prefix('WT_STAT_DSRC_', stat.dsrc) del _rename_with_prefix %} + diff --git a/src/btree/bt_curnext.c b/src/btree/bt_curnext.c index 7b92a58991d..091b9345713 100644 --- a/src/btree/bt_curnext.c +++ b/src/btree/bt_curnext.c @@ -142,7 +142,7 @@ new_page: if (cbt->ins == NULL) __cursor_set_recno(cbt, WT_INSERT_RECNO(cbt->ins)); if ((upd = __wt_txn_read(session, cbt->ins->upd)) == NULL) continue; - if (upd->type == WT_UPDATE_DELETED) { + if (WT_UPDATE_DELETED_ISSET(upd)) { if (__wt_txn_visible_all(session, upd->txnid)) ++cbt->page_deleted_count; continue; @@ -205,7 +205,7 @@ new_page: /* Find the matching WT_COL slot. */ upd = cbt->ins == NULL ? NULL : __wt_txn_read(session, cbt->ins->upd); if (upd != NULL) { - if (upd->type == WT_UPDATE_DELETED) { + if (WT_UPDATE_DELETED_ISSET(upd)) { if (__wt_txn_visible_all(session, upd->txnid)) ++cbt->page_deleted_count; continue; @@ -325,7 +325,7 @@ __cursor_row_next(WT_CURSOR_BTREE *cbt, bool newpage) new_insert: if ((ins = cbt->ins) != NULL) { if ((upd = __wt_txn_read(session, ins->upd)) == NULL) continue; - if (upd->type == WT_UPDATE_DELETED) { + if (WT_UPDATE_DELETED_ISSET(upd)) { if (__wt_txn_visible_all(session, upd->txnid)) ++cbt->page_deleted_count; continue; @@ -358,7 +358,7 @@ new_insert: if ((ins = cbt->ins) != NULL) { cbt->slot = cbt->row_iteration_slot / 2 - 1; rip = &page->pg_row[cbt->slot]; upd = __wt_txn_read(session, WT_ROW_UPDATE(page, rip)); - if (upd != NULL && upd->type == WT_UPDATE_DELETED) { + if (upd != NULL && WT_UPDATE_DELETED_ISSET(upd)) { if (__wt_txn_visible_all(session, upd->txnid)) ++cbt->page_deleted_count; continue; diff --git a/src/btree/bt_curprev.c b/src/btree/bt_curprev.c index 55b5095fe91..4f0fa77d3e6 100644 --- a/src/btree/bt_curprev.c +++ b/src/btree/bt_curprev.c @@ -288,7 +288,7 @@ new_page: if (cbt->ins == NULL) __cursor_set_recno(cbt, WT_INSERT_RECNO(cbt->ins)); if ((upd = __wt_txn_read(session, cbt->ins->upd)) == NULL) continue; - if (upd->type == WT_UPDATE_DELETED) { + if (WT_UPDATE_DELETED_ISSET(upd)) { if (__wt_txn_visible_all(session, upd->txnid)) ++cbt->page_deleted_count; continue; @@ -352,7 +352,7 @@ new_page: if (cbt->recno < cbt->ref->ref_recno) upd = cbt->ins == NULL ? NULL : __wt_txn_read(session, cbt->ins->upd); if (upd != NULL) { - if (upd->type == WT_UPDATE_DELETED) { + if (WT_UPDATE_DELETED_ISSET(upd)) { if (__wt_txn_visible_all(session, upd->txnid)) ++cbt->page_deleted_count; continue; @@ -482,7 +482,7 @@ __cursor_row_prev(WT_CURSOR_BTREE *cbt, bool newpage) new_insert: if ((ins = cbt->ins) != NULL) { if ((upd = __wt_txn_read(session, ins->upd)) == NULL) continue; - if (upd->type == WT_UPDATE_DELETED) { + if (WT_UPDATE_DELETED_ISSET(upd)) { if (__wt_txn_visible_all(session, upd->txnid)) ++cbt->page_deleted_count; continue; @@ -517,7 +517,7 @@ new_insert: if ((ins = cbt->ins) != NULL) { cbt->slot = cbt->row_iteration_slot / 2 - 1; rip = &page->pg_row[cbt->slot]; upd = __wt_txn_read(session, WT_ROW_UPDATE(page, rip)); - if (upd != NULL && upd->type == WT_UPDATE_DELETED) { + if (upd != NULL && WT_UPDATE_DELETED_ISSET(upd)) { if (__wt_txn_visible_all(session, upd->txnid)) ++cbt->page_deleted_count; continue; diff --git a/src/btree/bt_cursor.c b/src/btree/bt_cursor.c index 7e415150cc5..664545ee3a0 100644 --- a/src/btree/bt_cursor.c +++ b/src/btree/bt_cursor.c @@ -224,7 +224,7 @@ __wt_cursor_valid(WT_CURSOR_BTREE *cbt, WT_UPDATE **updp) */ if (cbt->ins != NULL && (upd = __wt_txn_read(session, cbt->ins->upd)) != NULL) { - if (upd->type == WT_UPDATE_DELETED) + if (WT_UPDATE_DELETED_ISSET(upd)) return (false); if (updp != NULL) *updp = upd; @@ -297,7 +297,7 @@ __wt_cursor_valid(WT_CURSOR_BTREE *cbt, WT_UPDATE **updp) page->modify->mod_row_update != NULL && (upd = __wt_txn_read(session, page->modify->mod_row_update[cbt->slot])) != NULL) { - if (upd->type == WT_UPDATE_DELETED) + if (WT_UPDATE_DELETED_ISSET(upd)) return (false); if (updp != NULL) *updp = upd; @@ -342,11 +342,11 @@ __cursor_row_search( * Column-store delete, insert, and update from an application cursor. */ static inline int -__cursor_col_modify( - WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, u_int modify_type) +__cursor_col_modify(WT_SESSION_IMPL *session, + WT_CURSOR_BTREE *cbt, bool is_remove, bool is_reserve) { return (__wt_col_modify(session, cbt, - cbt->iface.recno, &cbt->iface.value, NULL, modify_type)); + cbt->iface.recno, &cbt->iface.value, NULL, is_remove, is_reserve)); } /* @@ -354,11 +354,11 @@ __cursor_col_modify( * Row-store insert, update and delete from an application cursor. */ static inline int -__cursor_row_modify( - WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, u_int modify_type) +__cursor_row_modify(WT_SESSION_IMPL *session, + WT_CURSOR_BTREE *cbt, bool is_remove, bool is_reserve) { return (__wt_row_modify(session, cbt, - &cbt->iface.key, &cbt->iface.value, NULL, modify_type)); + &cbt->iface.key, &cbt->iface.value, NULL, is_remove, is_reserve)); } /* @@ -662,8 +662,8 @@ __wt_btcur_insert(WT_CURSOR_BTREE *cbt) */ cbt->compare = 0; ret = btree->type == BTREE_ROW ? - __cursor_row_modify(session, cbt, WT_UPDATE_STANDARD) : - __cursor_col_modify(session, cbt, WT_UPDATE_STANDARD); + __cursor_row_modify(session, cbt, false, false) : + __cursor_col_modify(session, cbt, false, false); if (ret == 0) goto done; @@ -700,7 +700,7 @@ retry: WT_ERR(__cursor_func_init(cbt, true)); cbt->compare == 0 && __wt_cursor_valid(cbt, NULL)) WT_ERR(WT_DUPLICATE_KEY); - ret = __cursor_row_modify(session, cbt, WT_UPDATE_STANDARD); + ret = __cursor_row_modify(session, cbt, false, false); } else { /* * Optionally insert a new record (ignoring the application's @@ -723,7 +723,7 @@ retry: WT_ERR(__cursor_func_init(cbt, true)); (cbt->compare != 0 && __cursor_fix_implicit(btree, cbt)))) WT_ERR(WT_DUPLICATE_KEY); - WT_ERR(__cursor_col_modify(session, cbt, WT_UPDATE_STANDARD)); + WT_ERR(__cursor_col_modify(session, cbt, false, false)); if (append_key) cbt->iface.recno = cbt->recno; @@ -881,8 +881,8 @@ __wt_btcur_remove(WT_CURSOR_BTREE *cbt) */ cbt->compare = 0; ret = btree->type == BTREE_ROW ? - __cursor_row_modify(session, cbt, WT_UPDATE_DELETED) : - __cursor_col_modify(session, cbt, WT_UPDATE_DELETED); + __cursor_row_modify(session, cbt, true, false) : + __cursor_col_modify(session, cbt, true, false); if (ret == 0) goto done; @@ -921,7 +921,7 @@ retry: WT_ERR(__cursor_func_init(cbt, true)); if (cbt->compare != 0 || !__wt_cursor_valid(cbt, NULL)) WT_ERR(WT_NOTFOUND); - ret = __cursor_row_modify(session, cbt, WT_UPDATE_DELETED); + ret = __cursor_row_modify(session, cbt, true, false); } else { WT_ERR(__cursor_col_search(session, cbt, NULL)); @@ -948,8 +948,7 @@ retry: WT_ERR(__cursor_func_init(cbt, true)); */ cbt->recno = cursor->recno; } else - ret = __cursor_col_modify( - session, cbt, WT_UPDATE_DELETED); + ret = __cursor_col_modify(session, cbt, true, false); } err: if (ret == WT_RESTART) { @@ -987,7 +986,7 @@ done: /* * Update a record in the tree. */ static int -__btcur_update(WT_CURSOR_BTREE *cbt, u_int modify_type) +__btcur_update(WT_CURSOR_BTREE *cbt, bool is_reserve) { WT_BTREE *btree; WT_CURFILE_STATE state; @@ -999,6 +998,15 @@ __btcur_update(WT_CURSOR_BTREE *cbt, u_int modify_type) cursor = &cbt->iface; session = (WT_SESSION_IMPL *)cursor->session; + WT_STAT_CONN_INCR(session, cursor_update); + WT_STAT_DATA_INCR(session, cursor_update); + WT_STAT_DATA_INCRV(session, cursor_update_bytes, cursor->value.size); + + if (btree->type == BTREE_ROW) + WT_RET(__cursor_size_chk(session, &cursor->key)); + if (!is_reserve) + WT_RET(__cursor_size_chk(session, &cursor->value)); + /* It's no longer possible to bulk-load into the tree. */ __cursor_disable_bulk(session, btree); @@ -1022,8 +1030,8 @@ __btcur_update(WT_CURSOR_BTREE *cbt, u_int modify_type) */ cbt->compare = 0; ret = btree->type == BTREE_ROW ? - __cursor_row_modify(session, cbt, modify_type) : - __cursor_col_modify(session, cbt, modify_type); + __cursor_row_modify(session, cbt, false, is_reserve) : + __cursor_col_modify(session, cbt, false, is_reserve); if (ret == 0) goto done; @@ -1061,7 +1069,7 @@ retry: WT_ERR(__cursor_func_init(cbt, true)); if (cbt->compare != 0 || !__wt_cursor_valid(cbt, NULL)) WT_ERR(WT_NOTFOUND); } - ret = __cursor_row_modify(session, cbt, modify_type); + ret = __cursor_row_modify(session, cbt, false, is_reserve); } else { WT_ERR(__cursor_col_search(session, cbt, NULL)); @@ -1080,7 +1088,7 @@ retry: WT_ERR(__cursor_func_init(cbt, true)); !__cursor_fix_implicit(btree, cbt)) WT_ERR(WT_NOTFOUND); } - ret = __cursor_col_modify(session, cbt, modify_type); + ret = __cursor_col_modify(session, cbt, false, is_reserve); } err: if (ret == WT_RESTART) { @@ -1098,7 +1106,7 @@ err: if (ret == WT_RESTART) { * pointer to the modify function's allocated update structure. */ done: if (ret == 0) { - if (modify_type == WT_UPDATE_RESERVED) { + if (is_reserve) { F_CLR(cursor, WT_CURSTD_VALUE_SET); WT_TRET(__wt_key_return(session, cbt)); } else @@ -1123,19 +1131,14 @@ __wt_btcur_reserve(WT_CURSOR_BTREE *cbt) { WT_CURSOR *cursor; WT_DECL_RET; - WT_SESSION_IMPL *session; bool overwrite; cursor = &cbt->iface; - session = (WT_SESSION_IMPL *)cursor->session; - - WT_STAT_CONN_INCR(session, cursor_reserve); - WT_STAT_DATA_INCR(session, cursor_reserve); /* WT_CURSOR.reserve is update-without-overwrite and a special value. */ overwrite = F_ISSET(cursor, WT_CURSTD_OVERWRITE); F_CLR(cursor, WT_CURSTD_OVERWRITE); - ret = __btcur_update(cbt, WT_UPDATE_RESERVED); + ret = __btcur_update(cbt, true); if (overwrite) F_SET(cursor, WT_CURSTD_OVERWRITE); return (ret); @@ -1148,23 +1151,7 @@ __wt_btcur_reserve(WT_CURSOR_BTREE *cbt) int __wt_btcur_update(WT_CURSOR_BTREE *cbt) { - WT_BTREE *btree; - WT_CURSOR *cursor; - WT_SESSION_IMPL *session; - - btree = cbt->btree; - cursor = &cbt->iface; - session = (WT_SESSION_IMPL *)cursor->session; - - WT_STAT_CONN_INCR(session, cursor_update); - WT_STAT_DATA_INCR(session, cursor_update); - WT_STAT_DATA_INCRV(session, cursor_update_bytes, cursor->value.size); - - if (btree->type == BTREE_ROW) - WT_RET(__cursor_size_chk(session, &cursor->key)); - WT_RET(__cursor_size_chk(session, &cursor->value)); - - return (__btcur_update(cbt, WT_UPDATE_STANDARD)); + return (__btcur_update(cbt, false)); } /* @@ -1287,7 +1274,7 @@ __wt_btcur_equals(WT_CURSOR_BTREE *a_arg, WT_CURSOR_BTREE *b_arg, int *equalp) static int __cursor_truncate(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *start, WT_CURSOR_BTREE *stop, - int (*rmfunc)(WT_SESSION_IMPL *, WT_CURSOR_BTREE *, u_int)) + int (*rmfunc)(WT_SESSION_IMPL *, WT_CURSOR_BTREE *, bool, bool)) { WT_DECL_RET; @@ -1315,7 +1302,7 @@ retry: WT_RET(__wt_btcur_search(start)); F_MASK((WT_CURSOR *)start, WT_CURSTD_KEY_SET) == WT_CURSTD_KEY_INT); for (;;) { - if ((ret = rmfunc(session, start, WT_UPDATE_DELETED)) != 0) + if ((ret = rmfunc(session, start, true, false)) != 0) break; if (stop != NULL && __cursor_equals(start, stop)) @@ -1342,7 +1329,7 @@ retry: WT_RET(__wt_btcur_search(start)); static int __cursor_truncate_fix(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *start, WT_CURSOR_BTREE *stop, - int (*rmfunc)(WT_SESSION_IMPL *, WT_CURSOR_BTREE *, u_int)) + int (*rmfunc)(WT_SESSION_IMPL *, WT_CURSOR_BTREE *, bool, bool)) { WT_DECL_RET; const uint8_t *value; @@ -1373,7 +1360,7 @@ retry: WT_RET(__wt_btcur_search(start)); for (;;) { value = (const uint8_t *)start->iface.value.data; if (*value != 0 && - (ret = rmfunc(session, start, WT_UPDATE_DELETED)) != 0) + (ret = rmfunc(session, start, true, false)) != 0) break; if (stop != NULL && __cursor_equals(start, stop)) diff --git a/src/btree/bt_debug.c b/src/btree/bt_debug.c index c3f98a98ec5..538c363a864 100644 --- a/src/btree/bt_debug.c +++ b/src/btree/bt_debug.c @@ -985,9 +985,9 @@ static int __debug_update(WT_DBG *ds, WT_UPDATE *upd, bool hexbyte) { for (; upd != NULL; upd = upd->next) - if (upd->type == WT_UPDATE_DELETED) + if (WT_UPDATE_DELETED_ISSET(upd)) WT_RET(ds->f(ds, "\tvalue {deleted}\n")); - else if (upd->type == WT_UPDATE_RESERVED) + else if (WT_UPDATE_RESERVED_ISSET(upd)) WT_RET(ds->f(ds, "\tvalue {reserved}\n")); else if (hexbyte) { WT_RET(ds->f(ds, "\t{")); diff --git a/src/btree/bt_delete.c b/src/btree/bt_delete.c index 4a88b672d47..12c3b044fda 100644 --- a/src/btree/bt_delete.c +++ b/src/btree/bt_delete.c @@ -333,7 +333,7 @@ __wt_delete_page_instantiate(WT_SESSION_IMPL *session, WT_REF *ref) */ for (i = 0, size = 0; i < page->entries; ++i) { WT_ERR(__wt_calloc_one(session, &upd)); - upd->type = WT_UPDATE_DELETED; + WT_UPDATE_DELETED_SET(upd); if (page_del == NULL) upd->txnid = WT_TXN_NONE; /* Globally visible */ diff --git a/src/btree/bt_read.c b/src/btree/bt_read.c index e6a0f53ab40..72a69e8591c 100644 --- a/src/btree/bt_read.c +++ b/src/btree/bt_read.c @@ -90,8 +90,7 @@ __col_instantiate(WT_SESSION_IMPL *session, { /* Search the page and add updates. */ WT_RET(__wt_col_search(session, recno, ref, cbt)); - WT_RET(__wt_col_modify( - session, cbt, recno, NULL, upd, WT_UPDATE_STANDARD)); + WT_RET(__wt_col_modify(session, cbt, recno, NULL, upd, false, false)); return (0); } @@ -105,8 +104,7 @@ __row_instantiate(WT_SESSION_IMPL *session, { /* Search the page and add updates. */ WT_RET(__wt_row_search(session, key, ref, cbt, true)); - WT_RET(__wt_row_modify( - session, cbt, key, NULL, upd, WT_UPDATE_STANDARD)); + WT_RET(__wt_row_modify(session, cbt, key, NULL, upd, false, false)); return (0); } @@ -129,8 +127,7 @@ __las_page_instantiate(WT_SESSION_IMPL *session, WT_UPDATE *first_upd, *last_upd, *upd; size_t incr, total_incr; uint64_t current_recno, las_counter, las_txnid, recno, upd_txnid; - uint32_t las_id, session_flags; - uint8_t upd_type; + uint32_t las_id, upd_size, session_flags; int exact; const uint8_t *p; @@ -191,10 +188,9 @@ __las_page_instantiate(WT_SESSION_IMPL *session, /* Allocate the WT_UPDATE structure. */ WT_ERR(cursor->get_value( - cursor, &upd_txnid, &upd_type, las_value)); - WT_ERR(__wt_update_alloc(session, las_value, &upd, &incr, - upd_type == WT_UPDATE_DELETED ? - WT_UPDATE_DELETED : WT_UPDATE_STANDARD)); + cursor, &upd_txnid, &upd_size, las_value)); + WT_ERR(__wt_update_alloc(session, las_value, + &upd, &incr, upd_size == WT_UPDATE_DELETED_VALUE, false)); total_incr += incr; upd->txnid = upd_txnid; diff --git a/src/btree/bt_split.c b/src/btree/bt_split.c index c2c56a18131..23210a556da 100644 --- a/src/btree/bt_split.c +++ b/src/btree/bt_split.c @@ -1424,8 +1424,8 @@ __split_multi_inmem( WT_ERR(__wt_col_search(session, recno, ref, &cbt)); /* Apply the modification. */ - WT_ERR(__wt_col_modify(session, - &cbt, recno, NULL, upd, WT_UPDATE_STANDARD)); + WT_ERR(__wt_col_modify( + session, &cbt, recno, NULL, upd, false, false)); break; case WT_PAGE_ROW_LEAF: /* Build a key. */ @@ -1447,7 +1447,7 @@ __split_multi_inmem( /* Apply the modification. */ WT_ERR(__wt_row_modify( - session, &cbt, key, NULL, upd, WT_UPDATE_STANDARD)); + session, &cbt, key, NULL, upd, false, false)); break; WT_ILLEGAL_VALUE_ERR(session); } diff --git a/src/btree/bt_stat.c b/src/btree/bt_stat.c index e3b9bbced48..2b9c9bef8a2 100644 --- a/src/btree/bt_stat.c +++ b/src/btree/bt_stat.c @@ -178,9 +178,9 @@ __stat_page_col_var( */ WT_SKIP_FOREACH(ins, WT_COL_UPDATE(page, cip)) { upd = ins->upd; - if (upd->type == WT_UPDATE_RESERVED) + if (WT_UPDATE_RESERVED_ISSET(upd)) continue; - if (upd->type == WT_UPDATE_DELETED) { + if (WT_UPDATE_DELETED_ISSET(upd)) { if (!orig_deleted) { ++deleted_cnt; --entry_cnt; @@ -195,9 +195,9 @@ __stat_page_col_var( /* Walk any append list. */ WT_SKIP_FOREACH(ins, WT_COL_APPEND(page)) { - if (ins->upd->type == WT_UPDATE_RESERVED) + if (WT_UPDATE_RESERVED_ISSET(ins->upd)) continue; - if (ins->upd->type == WT_UPDATE_DELETED) + if (WT_UPDATE_DELETED_ISSET(ins->upd)) ++deleted_cnt; else ++entry_cnt; @@ -268,8 +268,8 @@ __stat_page_row_leaf( * key on the page. */ WT_SKIP_FOREACH(ins, WT_ROW_INSERT_SMALLEST(page)) - if (ins->upd->type != WT_UPDATE_DELETED && - ins->upd->type != WT_UPDATE_RESERVED) + if (!WT_UPDATE_DELETED_ISSET(ins->upd) && + !WT_UPDATE_RESERVED_ISSET(ins->upd)) ++entry_cnt; /* @@ -279,8 +279,8 @@ __stat_page_row_leaf( WT_ROW_FOREACH(page, rip, i) { upd = WT_ROW_UPDATE(page, rip); if (upd == NULL || - (upd->type != WT_UPDATE_DELETED && - upd->type != WT_UPDATE_RESERVED)) + (!WT_UPDATE_DELETED_ISSET(upd) && + !WT_UPDATE_RESERVED_ISSET(upd))) ++entry_cnt; if (upd == NULL && (cell = __wt_row_leaf_value_cell(page, rip, NULL)) != NULL && @@ -289,8 +289,8 @@ __stat_page_row_leaf( /* Walk K/V pairs inserted after the on-page K/V pair. */ WT_SKIP_FOREACH(ins, WT_ROW_INSERT(page, rip)) - if (ins->upd->type != WT_UPDATE_DELETED && - ins->upd->type != WT_UPDATE_RESERVED) + if (!WT_UPDATE_DELETED_ISSET(ins->upd) && + !WT_UPDATE_RESERVED_ISSET(ins->upd)) ++entry_cnt; } diff --git a/src/btree/col_modify.c b/src/btree/col_modify.c index c256f03a612..b45f369f1c2 100644 --- a/src/btree/col_modify.c +++ b/src/btree/col_modify.c @@ -17,7 +17,8 @@ static int __col_insert_alloc( */ int __wt_col_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, - uint64_t recno, const WT_ITEM *value, WT_UPDATE *upd_arg, u_int modify_type) + uint64_t recno, const WT_ITEM *value, WT_UPDATE *upd_arg, + bool is_remove, bool is_reserve) { static const WT_ITEM col_fix_remove = { "", 1, NULL, 0, 0 }; WT_BTREE *btree; @@ -37,15 +38,13 @@ __wt_col_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, upd = upd_arg; append = logged = false; - if (modify_type == WT_UPDATE_DELETED || - modify_type == WT_UPDATE_RESERVED) { + if (is_remove || is_reserve) { /* * Fixed-size column-store doesn't have on-page deleted values, * it's a nul byte. */ - if (modify_type == WT_UPDATE_DELETED && - btree->type == BTREE_COL_FIX) { - modify_type = WT_UPDATE_STANDARD; + if (is_remove && btree->type == BTREE_COL_FIX) { + is_remove = false; value = &col_fix_remove; } } else { @@ -90,7 +89,7 @@ __wt_col_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, /* Allocate a WT_UPDATE structure and transaction ID. */ WT_ERR(__wt_update_alloc(session, - value, &upd, &upd_size, modify_type)); + value, &upd, &upd_size, is_remove, is_reserve)); WT_ERR(__wt_txn_modify(session, upd)); logged = true; @@ -151,7 +150,7 @@ __wt_col_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, if (upd_arg == NULL) { WT_ERR(__wt_update_alloc(session, - value, &upd, &upd_size, modify_type)); + value, &upd, &upd_size, is_remove, is_reserve)); WT_ERR(__wt_txn_modify(session, upd)); logged = true; @@ -196,7 +195,7 @@ __wt_col_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, } /* If the update was successful, add it to the in-memory log. */ - if (logged && modify_type != WT_UPDATE_RESERVED) + if (logged && !is_reserve) WT_ERR(__wt_txn_log_op(session, cbt)); if (0) { diff --git a/src/btree/row_modify.c b/src/btree/row_modify.c index 2bf3c2f29bc..d3b087f92c6 100644 --- a/src/btree/row_modify.c +++ b/src/btree/row_modify.c @@ -48,7 +48,7 @@ __wt_page_modify_alloc(WT_SESSION_IMPL *session, WT_PAGE *page) int __wt_row_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, const WT_ITEM *key, const WT_ITEM *value, - WT_UPDATE *upd_arg, u_int modify_type) + WT_UPDATE *upd_arg, bool is_remove, bool is_reserve) { WT_DECL_RET; WT_INSERT *ins; @@ -97,7 +97,7 @@ __wt_row_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, /* Allocate a WT_UPDATE structure and transaction ID. */ WT_ERR(__wt_update_alloc(session, - value, &upd, &upd_size, modify_type)); + value, &upd, &upd_size, is_remove, is_reserve)); WT_ERR(__wt_txn_modify(session, upd)); logged = true; @@ -168,7 +168,7 @@ __wt_row_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, if (upd_arg == NULL) { WT_ERR(__wt_update_alloc(session, - value, &upd, &upd_size, modify_type)); + value, &upd, &upd_size, is_remove, is_reserve)); WT_ERR(__wt_txn_modify(session, upd)); logged = true; @@ -207,7 +207,7 @@ __wt_row_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, &ins, ins_size, skipdepth)); } - if (logged && modify_type != WT_UPDATE_RESERVED) + if (logged && !is_reserve) WT_ERR(__wt_txn_log_op(session, cbt)); if (0) { @@ -261,7 +261,7 @@ __wt_row_insert_alloc(WT_SESSION_IMPL *session, */ int __wt_update_alloc(WT_SESSION_IMPL *session, const WT_ITEM *value, - WT_UPDATE **updp, size_t *sizep, u_int modify_type) + WT_UPDATE **updp, size_t *sizep, bool is_remove, bool is_reserve) { WT_UPDATE *upd; @@ -271,10 +271,13 @@ __wt_update_alloc(WT_SESSION_IMPL *session, const WT_ITEM *value, * Allocate the WT_UPDATE structure and room for the value, then copy * the value into place. */ - if (modify_type == WT_UPDATE_DELETED || - modify_type == WT_UPDATE_RESERVED) + if (is_remove || is_reserve) { WT_RET(__wt_calloc(session, 1, sizeof(WT_UPDATE), &upd)); - else { + if (is_remove) + WT_UPDATE_DELETED_SET(upd); + if (is_reserve) + WT_UPDATE_RESERVED_SET(upd); + } else { WT_RET(__wt_calloc( session, 1, sizeof(WT_UPDATE) + value->size, &upd)); if (value->size != 0) { @@ -282,7 +285,6 @@ __wt_update_alloc(WT_SESSION_IMPL *session, const WT_ITEM *value, memcpy(WT_UPDATE_DATA(upd), value->data, value->size); } } - upd->type = (uint8_t)modify_type; *updp = upd; *sizep = WT_UPDATE_MEMSIZE(upd); diff --git a/src/cursor/cur_backup.c b/src/cursor/cur_backup.c index 60750b88900..a30cb6f0e17 100644 --- a/src/cursor/cur_backup.c +++ b/src/cursor/cur_backup.c @@ -119,7 +119,6 @@ __wt_curbackup_open(WT_SESSION_IMPL *session, __wt_cursor_notsup, /* search */ __wt_cursor_search_near_notsup, /* search-near */ __wt_cursor_notsup, /* insert */ - __wt_cursor_modify_notsup, /* modify */ __wt_cursor_notsup, /* update */ __wt_cursor_notsup, /* remove */ __wt_cursor_notsup, /* reserve */ diff --git a/src/cursor/cur_config.c b/src/cursor/cur_config.c index 6c198315e33..a0b87b2b3c6 100644 --- a/src/cursor/cur_config.c +++ b/src/cursor/cur_config.c @@ -39,7 +39,6 @@ __wt_curconfig_open(WT_SESSION_IMPL *session, __wt_cursor_notsup, /* search */ __wt_cursor_search_near_notsup, /* search-near */ __wt_cursor_notsup, /* insert */ - __wt_cursor_modify_notsup, /* modify */ __wt_cursor_notsup, /* update */ __wt_cursor_notsup, /* remove */ __wt_cursor_notsup, /* reserve */ diff --git a/src/cursor/cur_ds.c b/src/cursor/cur_ds.c index 4930bcdda13..e40cb30dd53 100644 --- a/src/cursor/cur_ds.c +++ b/src/cursor/cur_ds.c @@ -458,7 +458,6 @@ __wt_curds_open( __curds_search, /* search */ __curds_search_near, /* search-near */ __curds_insert, /* insert */ - __wt_cursor_modify_notsup, /* modify */ __curds_update, /* update */ __curds_remove, /* remove */ __wt_cursor_notsup, /* reserve */ diff --git a/src/cursor/cur_dump.c b/src/cursor/cur_dump.c index 3e90d321db6..73328da6246 100644 --- a/src/cursor/cur_dump.c +++ b/src/cursor/cur_dump.c @@ -369,7 +369,6 @@ __wt_curdump_create(WT_CURSOR *child, WT_CURSOR *owner, WT_CURSOR **cursorp) __curdump_search, /* search */ __curdump_search_near, /* search-near */ __curdump_insert, /* insert */ - __wt_cursor_modify_notsup, /* modify */ __curdump_update, /* update */ __curdump_remove, /* remove */ __wt_cursor_notsup, /* reserve */ diff --git a/src/cursor/cur_file.c b/src/cursor/cur_file.c index d6cf308077d..c43826799cf 100644 --- a/src/cursor/cur_file.c +++ b/src/cursor/cur_file.c @@ -352,11 +352,6 @@ __curfile_reserve(WT_CURSOR *cursor) WT_ERR(__wt_btcur_reserve(cbt)); - /* - * Reserve maintains a position and key, which doesn't match the library - * API, where reserve maintains a value. Fix the API by searching after - * each successful reserve operation. - */ WT_ASSERT(session, F_MASK(cursor, WT_CURSTD_KEY_SET) == WT_CURSTD_KEY_INT); WT_ASSERT(session, F_MASK(cursor, WT_CURSTD_VALUE_SET) == 0); @@ -435,7 +430,6 @@ __curfile_create(WT_SESSION_IMPL *session, __curfile_search, /* search */ __curfile_search_near, /* search-near */ __curfile_insert, /* insert */ - __wt_cursor_modify_notsup, /* modify */ __curfile_update, /* update */ __curfile_remove, /* remove */ __curfile_reserve, /* reserve */ diff --git a/src/cursor/cur_index.c b/src/cursor/cur_index.c index e8fcb1b2702..fcf00e4fa03 100644 --- a/src/cursor/cur_index.c +++ b/src/cursor/cur_index.c @@ -449,7 +449,6 @@ __wt_curindex_open(WT_SESSION_IMPL *session, __curindex_search, /* search */ __curindex_search_near, /* search-near */ __wt_cursor_notsup, /* insert */ - __wt_cursor_modify_notsup, /* modify */ __wt_cursor_notsup, /* update */ __wt_cursor_notsup, /* remove */ __wt_cursor_notsup, /* reserve */ diff --git a/src/cursor/cur_join.c b/src/cursor/cur_join.c index e4ccb90139e..cebf8a7fd6e 100644 --- a/src/cursor/cur_join.c +++ b/src/cursor/cur_join.c @@ -591,7 +591,6 @@ __curjoin_entry_member(WT_SESSION_IMPL *session, WT_CURSOR_JOIN_ENTRY *entry, __wt_cursor_notsup, /* search */ __wt_cursor_search_near_notsup, /* search-near */ __curjoin_extract_insert, /* insert */ - __wt_cursor_modify_notsup, /* modify */ __wt_cursor_notsup, /* update */ __wt_cursor_notsup, /* remove */ __wt_cursor_notsup, /* reserve */ @@ -1294,7 +1293,6 @@ __wt_curjoin_open(WT_SESSION_IMPL *session, __wt_cursor_notsup, /* search */ __wt_cursor_search_near_notsup, /* search-near */ __wt_cursor_notsup, /* insert */ - __wt_cursor_modify_notsup, /* modify */ __wt_cursor_notsup, /* update */ __wt_cursor_notsup, /* remove */ __wt_cursor_notsup, /* reserve */ diff --git a/src/cursor/cur_log.c b/src/cursor/cur_log.c index 38e9d4a1784..c8dc44bb392 100644 --- a/src/cursor/cur_log.c +++ b/src/cursor/cur_log.c @@ -342,7 +342,6 @@ __wt_curlog_open(WT_SESSION_IMPL *session, __curlog_search, /* search */ __wt_cursor_search_near_notsup, /* search-near */ __wt_cursor_notsup, /* insert */ - __wt_cursor_modify_notsup, /* modify */ __wt_cursor_notsup, /* update */ __wt_cursor_notsup, /* remove */ __wt_cursor_notsup, /* reserve */ diff --git a/src/cursor/cur_metadata.c b/src/cursor/cur_metadata.c index d9aeed1fccd..9a38996d4ce 100644 --- a/src/cursor/cur_metadata.c +++ b/src/cursor/cur_metadata.c @@ -550,7 +550,6 @@ __wt_curmetadata_open(WT_SESSION_IMPL *session, __curmetadata_search, /* search */ __curmetadata_search_near, /* search-near */ __curmetadata_insert, /* insert */ - __wt_cursor_modify_notsup, /* modify */ __curmetadata_update, /* update */ __curmetadata_remove, /* remove */ __wt_cursor_notsup, /* reserve */ diff --git a/src/cursor/cur_stat.c b/src/cursor/cur_stat.c index a1ec1d75918..0bfe5679677 100644 --- a/src/cursor/cur_stat.c +++ b/src/cursor/cur_stat.c @@ -576,7 +576,6 @@ __wt_curstat_open(WT_SESSION_IMPL *session, __curstat_search, /* search */ __wt_cursor_search_near_notsup, /* search-near */ __wt_cursor_notsup, /* insert */ - __wt_cursor_modify_notsup, /* modify */ __wt_cursor_notsup, /* update */ __wt_cursor_notsup, /* remove */ __wt_cursor_notsup, /* reserve */ diff --git a/src/cursor/cur_std.c b/src/cursor/cur_std.c index f52d60fde01..e42c5c7766e 100644 --- a/src/cursor/cur_std.c +++ b/src/cursor/cur_std.c @@ -90,19 +90,6 @@ __wt_cursor_equals_notsup(WT_CURSOR *cursor, WT_CURSOR *other, int *equalp) } /* - * __wt_cursor_modify_notsup -- - * Unsupported cursor modify. - */ -int -__wt_cursor_modify_notsup(WT_CURSOR *cursor, WT_MODIFY *entries, int nentries) -{ - WT_UNUSED(entries); - WT_UNUSED(nentries); - - return (__wt_cursor_notsup(cursor)); -} - -/* * __wt_cursor_search_near_notsup -- * Unsupported cursor search-near. */ @@ -595,100 +582,6 @@ err: API_END(session, ret); } /* - * __cursor_modify -- - * WT_CURSOR->modify default implementation. - */ -static int -__cursor_modify(WT_CURSOR *cursor, WT_MODIFY *entries, int nentries) -{ - WT_DECL_RET; - WT_SESSION_IMPL *session; - WT_DECL_ITEM(ta); - WT_DECL_ITEM(tb); - WT_DECL_ITEM(tmp); - size_t len, size; - int i; - - CURSOR_UPDATE_API_CALL(cursor, session, modify, NULL); - WT_ERR(__cursor_checkkey(cursor)); - - /* Check for a rational modify vector count. */ - if (nentries <= 0) - WT_ERR_MSG( - session, EINVAL, "Illegal modify vector of %d", nentries); - - WT_STAT_CONN_INCR(session, cursor_modify); - WT_STAT_DATA_INCR(session, cursor_modify); - - /* Acquire position and value. */ - WT_ERR(cursor->search(cursor)); - - /* - * Process the entries to figure out how large a buffer we need. This is - * a bit pessimistic because we're ignoring replacement bytes, but it's - * a simpler calculation. - */ - for (size = cursor->value.size, i = 0; i < nentries; ++i) { - if (entries[i].offset >= size) - size = entries[i].offset; - size += entries[i].data.size; - } - - /* Allocate a pair of buffers. */ - WT_ERR(__wt_scr_alloc(session, size, &ta)); - WT_ERR(__wt_scr_alloc(session, size, &tb)); - - /* Apply the change vector to the value. */ - WT_ERR(__wt_buf_set( - session, ta, cursor->value.data, cursor->value.size)); - for (i = 0; i < nentries; ++i) { - /* Take leading bytes from the original, plus any gap bytes. */ - if (entries[i].offset >= ta->size) { - memcpy(tb->mem, ta->mem, ta->size); - if (entries[i].offset > ta->size) - memset((uint8_t *)tb->mem + ta->size, - '\0', entries[i].offset - ta->size); - } else - if (entries[i].offset > 0) - memcpy(tb->mem, ta->mem, entries[i].offset); - tb->size = entries[i].offset; - - /* Take replacement bytes. */ - if (entries[i].data.size > 0) { - memcpy((uint8_t *)tb->mem + tb->size, - entries[i].data.data, entries[i].data.size); - tb->size += entries[i].data.size; - } - - /* Take trailing bytes from the original. */ - len = entries[i].offset + entries[i].size; - if (ta->size > len) { - memcpy((uint8_t *)tb->mem + tb->size, - (uint8_t *)ta->mem + len, ta->size - len); - tb->size += ta->size - len; - } - WT_ASSERT(session, tb->size <= size); - - tmp = ta; - ta = tb; - tb = tmp; - } - - /* Set the cursor's value. */ - ta->data = ta->mem; - cursor->set_value(cursor, ta); - - /* We know both key and value are set, "overwrite" doesn't matter. */ - ret = cursor->update(cursor); - -err: __wt_scr_free(session, &ta); - __wt_scr_free(session, &tb); - - CURSOR_UPDATE_API_END(session, ret); - return (ret); -} - -/* * __wt_cursor_reconfigure -- * Set runtime-configurable settings. */ @@ -864,14 +757,6 @@ __wt_cursor_init(WT_CURSOR *cursor, F_SET(cursor, WT_CURSTD_RAW); /* - * WT_CURSOR.modify supported on 'u' value formats, but may have been - * already initialized. - */ - if (WT_STREQ(cursor->value_format, "u") && - cursor->modify == __wt_cursor_modify_notsup) - cursor->modify = __cursor_modify; - - /* * Cursors that are internal to some other cursor (such as file cursors * inside a table cursor) should be closed after the containing cursor. * Arrange for that to happen by putting internal cursors after their diff --git a/src/cursor/cur_table.c b/src/cursor/cur_table.c index 7a04033e9a4..c6514aaac58 100644 --- a/src/cursor/cur_table.c +++ b/src/cursor/cur_table.c @@ -91,7 +91,6 @@ __wt_apply_single_idx(WT_SESSION_IMPL *session, WT_INDEX *idx, __wt_cursor_notsup, /* search */ __wt_cursor_search_near_notsup, /* search-near */ __curextract_insert, /* insert */ - __wt_cursor_modify_notsup, /* modify */ __wt_cursor_notsup, /* update */ __wt_cursor_notsup, /* remove */ __wt_cursor_notsup, /* reserve */ @@ -950,7 +949,6 @@ __wt_curtable_open(WT_SESSION_IMPL *session, __curtable_search, /* search */ __curtable_search_near, /* search-near */ __curtable_insert, /* insert */ - __wt_cursor_modify_notsup, /* modify */ __curtable_update, /* update */ __curtable_remove, /* remove */ __curtable_reserve, /* reserve */ diff --git a/src/docs/Doxyfile b/src/docs/Doxyfile index e7382e2bc5e..3d8c46962f1 100644 --- a/src/docs/Doxyfile +++ b/src/docs/Doxyfile @@ -1582,7 +1582,6 @@ PREDEFINED = DOXYGEN \ __wt_file_system:=WT_FILE_SYSTEM \ __wt_item:=WT_ITEM \ __wt_lsn:=WT_LSN \ - __wt_modify:=WT_MODIFY \ __wt_session:=WT_SESSION \ __wt_txn_notify:=WT_TXN_NOTIFY \ WT_HANDLE_CLOSED(x):=x \ diff --git a/src/include/btmem.h b/src/include/btmem.h index 4e8d3c05d7d..6755db81007 100644 --- a/src/include/btmem.h +++ b/src/include/btmem.h @@ -208,7 +208,7 @@ struct __wt_ovfl_txnc { */ #define WT_LAS_FORMAT \ "key_format=" WT_UNCHECKED_STRING(IuQQu) \ - ",value_format=" WT_UNCHECKED_STRING(QBu) + ",value_format=" WT_UNCHECKED_STRING(QIu) /* * WT_PAGE_MODIFY -- @@ -809,11 +809,11 @@ struct __wt_row { /* On-page key, on-page cell, or off-page WT_IKEY */ * Walk the entries of an in-memory row-store leaf page. */ #define WT_ROW_FOREACH(page, rip, i) \ - for ((i) = (page)->entries, \ + for ((i) = (page)->entries, \ (rip) = (page)->pg_row; (i) > 0; ++(rip), --(i)) #define WT_ROW_FOREACH_REVERSE(page, rip, i) \ - for ((i) = (page)->entries, \ - (rip) = (page)->pg_row + ((page)->entries - 1); \ + for ((i) = (page)->entries, \ + (rip) = (page)->pg_row + ((page)->entries - 1); \ (i) > 0; --(rip), --(i)) /* @@ -861,7 +861,7 @@ struct __wt_col { * Walk the entries of variable-length column-store leaf page. */ #define WT_COL_FOREACH(page, cip, i) \ - for ((i) = (page)->entries, \ + for ((i) = (page)->entries, \ (cip) = (page)->pg_var; (i) > 0; ++(cip), --(i)) /* @@ -908,16 +908,23 @@ struct __wt_ikey { * list. */ WT_PACKED_STRUCT_BEGIN(__wt_update) - uint64_t txnid; /* transaction */ + uint64_t txnid; /* update transaction */ WT_UPDATE *next; /* forward-linked list */ - uint32_t size; /* data length */ + /* + * Use the maximum size and maximum size-1 as is-deleted and is-reserved + * flags (which means we can't store 4GB objects), instead of increasing + * the size of this structure for a flag bit. + */ +#define WT_UPDATE_DELETED_VALUE UINT32_MAX +#define WT_UPDATE_DELETED_SET(u) ((u)->size = WT_UPDATE_DELETED_VALUE) +#define WT_UPDATE_DELETED_ISSET(u) ((u)->size == WT_UPDATE_DELETED_VALUE) -#define WT_UPDATE_STANDARD 0 -#define WT_UPDATE_DELETED 1 -#define WT_UPDATE_RESERVED 2 - uint8_t type; /* type (one byte to conserve memory) */ +#define WT_UPDATE_RESERVED_VALUE (UINT32_MAX - 1) +#define WT_UPDATE_RESERVED_SET(u) ((u)->size = WT_UPDATE_RESERVED_VALUE) +#define WT_UPDATE_RESERVED_ISSET(u) ((u)->size == WT_UPDATE_RESERVED_VALUE) + uint32_t size; /* update length */ /* The untyped value immediately follows the WT_UPDATE structure. */ #define WT_UPDATE_DATA(upd) \ @@ -929,13 +936,9 @@ WT_PACKED_STRUCT_BEGIN(__wt_update) * cache overhead calculation. */ #define WT_UPDATE_MEMSIZE(upd) \ - WT_ALIGN(sizeof(WT_UPDATE) + (upd)->size, 32) + WT_ALIGN(sizeof(WT_UPDATE) + (WT_UPDATE_DELETED_ISSET(upd) || \ + WT_UPDATE_RESERVED_ISSET(upd) ? 0 : (upd)->size), 32) WT_PACKED_STRUCT_END -/* - * WT_UPDATE_SIZE is the expected structure size -- we verify the build to - * ensure the compiler hasn't inserted padding. - */ -#define WT_UPDATE_SIZE 21 /* * WT_INSERT -- diff --git a/src/include/cursor.h b/src/include/cursor.h index 8d2f2c80c2a..b044329fbfe 100644 --- a/src/include/cursor.h +++ b/src/include/cursor.h @@ -22,7 +22,6 @@ search, \ search_near, \ insert, \ - modify, \ update, \ remove, \ reserve, \ @@ -45,7 +44,6 @@ search, \ search_near, \ insert, \ - modify, \ update, \ remove, \ reserve, \ diff --git a/src/include/extern.h b/src/include/extern.h index 01c21b188c0..a3ce0f3746f 100644 --- a/src/include/extern.h +++ b/src/include/extern.h @@ -180,7 +180,7 @@ extern int __wt_verify_dsk(WT_SESSION_IMPL *session, const char *tag, WT_ITEM *b extern int __wt_tree_walk(WT_SESSION_IMPL *session, WT_REF **refp, uint32_t flags) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_tree_walk_count(WT_SESSION_IMPL *session, WT_REF **refp, uint64_t *walkcntp, uint32_t flags) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_tree_walk_skip( WT_SESSION_IMPL *session, WT_REF **refp, uint64_t *skipleafcntp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_col_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, uint64_t recno, const WT_ITEM *value, WT_UPDATE *upd_arg, u_int modify_type) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); +extern int __wt_col_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, uint64_t recno, const WT_ITEM *value, WT_UPDATE *upd_arg, bool is_remove, bool is_reserve) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_col_search(WT_SESSION_IMPL *session, uint64_t search_recno, WT_REF *leaf, WT_CURSOR_BTREE *cbt) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_row_leaf_keys(WT_SESSION_IMPL *session, WT_PAGE *page) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_row_leaf_key_copy( WT_SESSION_IMPL *session, WT_PAGE *page, WT_ROW *rip, WT_ITEM *key) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); @@ -189,9 +189,9 @@ extern int __wt_row_ikey_alloc(WT_SESSION_IMPL *session, uint32_t cell_offset, c extern int __wt_row_ikey_incr(WT_SESSION_IMPL *session, WT_PAGE *page, uint32_t cell_offset, const void *key, size_t size, WT_REF *ref) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_row_ikey(WT_SESSION_IMPL *session, uint32_t cell_offset, const void *key, size_t size, WT_REF *ref) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_page_modify_alloc(WT_SESSION_IMPL *session, WT_PAGE *page) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_row_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, const WT_ITEM *key, const WT_ITEM *value, WT_UPDATE *upd_arg, u_int modify_type) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); +extern int __wt_row_modify(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, const WT_ITEM *key, const WT_ITEM *value, WT_UPDATE *upd_arg, bool is_remove, bool is_reserve) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_row_insert_alloc(WT_SESSION_IMPL *session, const WT_ITEM *key, u_int skipdepth, WT_INSERT **insp, size_t *ins_sizep) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_update_alloc(WT_SESSION_IMPL *session, const WT_ITEM *value, WT_UPDATE **updp, size_t *sizep, u_int modify_type) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); +extern int __wt_update_alloc(WT_SESSION_IMPL *session, const WT_ITEM *value, WT_UPDATE **updp, size_t *sizep, bool is_remove, bool is_reserve) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern WT_UPDATE *__wt_update_obsolete_check( WT_SESSION_IMPL *session, WT_PAGE *page, WT_UPDATE *upd); extern void __wt_update_obsolete_free( WT_SESSION_IMPL *session, WT_PAGE *page, WT_UPDATE *upd); extern int __wt_search_insert(WT_SESSION_IMPL *session, WT_CURSOR_BTREE *cbt, WT_INSERT_HEAD *ins_head, WT_ITEM *srch_key) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); @@ -314,7 +314,6 @@ extern void __wt_cursor_set_key_notsup(WT_CURSOR *cursor, ...); extern void __wt_cursor_set_value_notsup(WT_CURSOR *cursor, ...); extern int __wt_cursor_compare_notsup(WT_CURSOR *a, WT_CURSOR *b, int *cmpp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_cursor_equals_notsup(WT_CURSOR *cursor, WT_CURSOR *other, int *equalp) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); -extern int __wt_cursor_modify_notsup(WT_CURSOR *cursor, WT_MODIFY *entries, int nentries) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_cursor_search_near_notsup(WT_CURSOR *cursor, int *exact) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern int __wt_cursor_reconfigure_notsup(WT_CURSOR *cursor, const char *config) WT_GCC_FUNC_DECL_ATTRIBUTE((warn_unused_result)); extern void __wt_cursor_set_notsup(WT_CURSOR *cursor); diff --git a/src/include/log.h b/src/include/log.h index e7bc28cd220..f80514a3546 100644 --- a/src/include/log.h +++ b/src/include/log.h @@ -130,7 +130,7 @@ union __wt_lsn { #define WT_LOG_SLOT_FLAGS(state) ((state) & WT_LOG_SLOT_MASK_ON) #define WT_LOG_SLOT_JOINED(state) (((state) & WT_LOG_SLOT_MASK_OFF) >> 32) #define WT_LOG_SLOT_JOINED_BUFFERED(state) \ - (WT_LOG_SLOT_JOINED(state) & \ + (WT_LOG_SLOT_JOINED(state) & \ (WT_LOG_SLOT_UNBUFFERED - 1)) #define WT_LOG_SLOT_JOIN_REL(j, r, s) (((j) << 32) + (r) + (s)) #define WT_LOG_SLOT_RELEASED(state) ((int64_t)(int32_t)(state)) diff --git a/src/include/lsm.h b/src/include/lsm.h index f8d0f480cbb..08313438eb8 100644 --- a/src/include/lsm.h +++ b/src/include/lsm.h @@ -240,11 +240,11 @@ struct __wt_lsm_tree { * area, copying them into place when a statistics cursor is created. */ #define WT_LSM_TREE_STAT_INCR(session, fld) do { \ - if (WT_STAT_ENABLED(session)) \ + if (WT_STAT_ENABLED(session)) \ ++(fld); \ } while (0) #define WT_LSM_TREE_STAT_INCRV(session, fld, v) do { \ - if (WT_STAT_ENABLED(session)) \ + if (WT_STAT_ENABLED(session)) \ (fld) += (int64_t)(v); \ } while (0) int64_t bloom_false_positive; diff --git a/src/include/mutex.h b/src/include/mutex.h index 00babd47fbf..c0e25ebb295 100644 --- a/src/include/mutex.h +++ b/src/include/mutex.h @@ -66,8 +66,8 @@ struct __wt_spinlock { WT_CACHE_LINE_PAD_BEGIN #if SPINLOCK_TYPE == SPINLOCK_GCC volatile int lock; -#elif SPINLOCK_TYPE == SPINLOCK_PTHREAD_MUTEX || \ - SPINLOCK_TYPE == SPINLOCK_PTHREAD_MUTEX_ADAPTIVE || \ +#elif SPINLOCK_TYPE == SPINLOCK_PTHREAD_MUTEX ||\ + SPINLOCK_TYPE == SPINLOCK_PTHREAD_MUTEX_ADAPTIVE ||\ SPINLOCK_TYPE == SPINLOCK_MSVC wt_mutex_t lock; #else diff --git a/src/include/mutex.i b/src/include/mutex.i index 5b14bb24730..44b8494cdbf 100644 --- a/src/include/mutex.i +++ b/src/include/mutex.i @@ -102,8 +102,8 @@ __wt_spin_unlock(WT_SESSION_IMPL *session, WT_SPINLOCK *t) __sync_lock_release(&t->lock); } -#elif SPINLOCK_TYPE == SPINLOCK_PTHREAD_MUTEX || \ - SPINLOCK_TYPE == SPINLOCK_PTHREAD_MUTEX_ADAPTIVE +#elif SPINLOCK_TYPE == SPINLOCK_PTHREAD_MUTEX ||\ + SPINLOCK_TYPE == SPINLOCK_PTHREAD_MUTEX_ADAPTIVE /* * __wt_spin_init -- @@ -142,8 +142,8 @@ __wt_spin_destroy(WT_SESSION_IMPL *session, WT_SPINLOCK *t) } } -#if SPINLOCK_TYPE == SPINLOCK_PTHREAD_MUTEX || \ - SPINLOCK_TYPE == SPINLOCK_PTHREAD_MUTEX_ADAPTIVE +#if SPINLOCK_TYPE == SPINLOCK_PTHREAD_MUTEX ||\ + SPINLOCK_TYPE == SPINLOCK_PTHREAD_MUTEX_ADAPTIVE /* * __wt_spin_trylock -- diff --git a/src/include/schema.h b/src/include/schema.h index 8b8ee5616d1..fa836084834 100644 --- a/src/include/schema.h +++ b/src/include/schema.h @@ -323,7 +323,7 @@ struct __wt_table { F_SET(session, WT_SESSION_LOCKED_HANDLE_LIST_READ); \ } \ if (__handle_write_locked) { \ - __wt_writelock(session, &__conn->dhandle_lock); \ + __wt_writelock(session, &__conn->dhandle_lock); \ F_SET(session, WT_SESSION_LOCKED_HANDLE_LIST_WRITE); \ } \ } while (0) diff --git a/src/include/stat.h b/src/include/stat.h index fa62cf27693..beb589dc0ef 100644 --- a/src/include/stat.h +++ b/src/include/stat.h @@ -374,11 +374,9 @@ struct __wt_connection_stats { int64_t write_io; int64_t cursor_create; int64_t cursor_insert; - int64_t cursor_modify; int64_t cursor_next; int64_t cursor_prev; int64_t cursor_remove; - int64_t cursor_reserve; int64_t cursor_reset; int64_t cursor_restart; int64_t cursor_search; @@ -611,11 +609,9 @@ struct __wt_dsrc_stats { int64_t cursor_remove_bytes; int64_t cursor_update_bytes; int64_t cursor_insert; - int64_t cursor_modify; int64_t cursor_next; int64_t cursor_prev; int64_t cursor_remove; - int64_t cursor_reserve; int64_t cursor_reset; int64_t cursor_restart; int64_t cursor_search; diff --git a/src/include/txn.i b/src/include/txn.i index f7321af5b12..4b6ba17853f 100644 --- a/src/include/txn.i +++ b/src/include/txn.i @@ -235,7 +235,7 @@ __wt_txn_read(WT_SESSION_IMPL *session, WT_UPDATE *upd) { /* Skip reserved place-holders, they're never visible. */ for (; upd != NULL; upd = upd->next) - if (upd->type != WT_UPDATE_RESERVED && + if (!WT_UPDATE_RESERVED_ISSET(upd) && __wt_txn_visible(session, upd->txnid)) break; diff --git a/src/include/verify_build.h b/src/include/verify_build.h index e93f5931c21..d2ccf206990 100644 --- a/src/include/verify_build.h +++ b/src/include/verify_build.h @@ -52,7 +52,6 @@ __wt_verify_build(void) /* Check specific structures weren't padded. */ WT_SIZE_CHECK(WT_BLOCK_DESC, WT_BLOCK_DESC_SIZE); WT_SIZE_CHECK(WT_REF, WT_REF_SIZE); - WT_SIZE_CHECK(WT_UPDATE, WT_UPDATE_SIZE); /* Check specific structures were padded. */ #define WT_PADDING_CHECK(s) \ diff --git a/src/include/wiredtiger.in b/src/include/wiredtiger.in index 5e76b2915b1..b93fbebef25 100644 --- a/src/include/wiredtiger.in +++ b/src/include/wiredtiger.in @@ -49,6 +49,12 @@ extern "C" { #define WT_ATTRIBUTE_LIBRARY_VISIBLE __attribute__((visibility("default"))) #endif +#ifdef SWIG +%{ +#include <wiredtiger.h> +%} +#endif + /*! * @defgroup wt WiredTiger API * The functions, handles and methods applications use to access and manage @@ -78,7 +84,6 @@ struct __wt_extractor; typedef struct __wt_extractor WT_EXTRACTOR; struct __wt_file_handle; typedef struct __wt_file_handle WT_FILE_HANDLE; struct __wt_file_system; typedef struct __wt_file_system WT_FILE_SYSTEM; struct __wt_item; typedef struct __wt_item WT_ITEM; -struct __wt_modify; typedef struct __wt_modify WT_MODIFY; struct __wt_session; typedef struct __wt_session WT_SESSION; #if defined(SWIGJAVA) @@ -133,43 +138,6 @@ struct __wt_item { }; /*! - * A set of modifications for a value, including a pointer to new data and a - * length, plus a target offset in the value and an optional length of data - * in the value to be replaced. - * - * WT_MODIFY structures do not need to be cleared before use. - */ -struct __wt_modify { - /*! - * New data. The size of the new data may be zero when no new data is - * provided. - */ - WT_ITEM data; - - /*! - * The zero-based byte offset in the value where the new data is placed. - * - * If the offset is past the end of the value, nul bytes are appended to - * the value up to the specified offset. - */ - size_t offset; - - /*! - * The number of bytes in the value to be replaced. - * - * If the size is zero, no bytes from the value are replaced and the new - * data is inserted. - * - * If the offset is past the end of the value, the size is ignored. - * - * If the offset plus the size overlaps the end of the previous value, - * bytes from the offset to the end of the value are replaced and any - * remaining new data is appended. - */ - size_t size; -}; - -/*! * The maximum packed size of a 64-bit integer. The ::wiredtiger_struct_pack * function will pack single long integers into at most this many bytes. */ @@ -478,38 +446,6 @@ struct __wt_cursor { int __F(insert)(WT_CURSOR *cursor); /*! - * Modify an existing record. - * - * Both the key and value must be set and the record must already exist; - * the record will be updated. - * - * Modification structures are applied in order, and later modifications - * can update earlier modifications. - * - * The modify method is only supported on raw byte arrays accessed using - * a WT_ITEM structure, that is, a format type of \c u. - * - * @snippet ex_all.c Modify an existing record - * - * On success, the cursor ends positioned at the modified record; to - * minimize cursor resources, the WT_CURSOR::reset method should be - * called as soon as the cursor no longer needs that position. - * - * The maximum length of a single column stored in a table is not fixed - * (as it partially depends on the underlying file configuration), but - * is always a small number of bytes less than 4GB. - * - * @param cursor the cursor handle - * @param entries an array of modification data structures - * @param nentries the number of modification data structures - * @errors - * In particular, if \c in_memory is configured for the database and - * the modify requires more than the configured cache size to complete, - * ::WT_CACHE_FULL is returned. - */ - int __F(modify)(WT_CURSOR *cursor, WT_MODIFY *entries, int nentries); - - /*! * Update an existing record and optionally insert a record. * * If the cursor was configured with "overwrite=true" (the default), @@ -538,7 +474,7 @@ struct __wt_cursor { * @errors * In particular, if \c overwrite=false is configured and no record with * the specified key exists, ::WT_NOTFOUND is returned. - * Also, if \c in_memory is configured for the database and the update + * Also, if \c in_memory is configured for the database and the insert * requires more than the configured cache size to complete, * ::WT_CACHE_FULL is returned. */ @@ -4678,296 +4614,292 @@ extern int wiredtiger_extension_terminate(WT_CONNECTION *connection); #define WT_STAT_CONN_CURSOR_CREATE 1115 /*! cursor: cursor insert calls */ #define WT_STAT_CONN_CURSOR_INSERT 1116 -/*! cursor: cursor modify calls */ -#define WT_STAT_CONN_CURSOR_MODIFY 1117 /*! cursor: cursor next calls */ -#define WT_STAT_CONN_CURSOR_NEXT 1118 +#define WT_STAT_CONN_CURSOR_NEXT 1117 /*! cursor: cursor prev calls */ -#define WT_STAT_CONN_CURSOR_PREV 1119 +#define WT_STAT_CONN_CURSOR_PREV 1118 /*! cursor: cursor remove calls */ -#define WT_STAT_CONN_CURSOR_REMOVE 1120 -/*! cursor: cursor reserve calls */ -#define WT_STAT_CONN_CURSOR_RESERVE 1121 +#define WT_STAT_CONN_CURSOR_REMOVE 1119 /*! cursor: cursor reset calls */ -#define WT_STAT_CONN_CURSOR_RESET 1122 +#define WT_STAT_CONN_CURSOR_RESET 1120 /*! cursor: cursor restarted searches */ -#define WT_STAT_CONN_CURSOR_RESTART 1123 +#define WT_STAT_CONN_CURSOR_RESTART 1121 /*! cursor: cursor search calls */ -#define WT_STAT_CONN_CURSOR_SEARCH 1124 +#define WT_STAT_CONN_CURSOR_SEARCH 1122 /*! cursor: cursor search near calls */ -#define WT_STAT_CONN_CURSOR_SEARCH_NEAR 1125 +#define WT_STAT_CONN_CURSOR_SEARCH_NEAR 1123 /*! cursor: cursor update calls */ -#define WT_STAT_CONN_CURSOR_UPDATE 1126 +#define WT_STAT_CONN_CURSOR_UPDATE 1124 /*! cursor: truncate calls */ -#define WT_STAT_CONN_CURSOR_TRUNCATE 1127 +#define WT_STAT_CONN_CURSOR_TRUNCATE 1125 /*! data-handle: connection data handles currently active */ -#define WT_STAT_CONN_DH_CONN_HANDLE_COUNT 1128 +#define WT_STAT_CONN_DH_CONN_HANDLE_COUNT 1126 /*! data-handle: connection sweep candidate became referenced */ -#define WT_STAT_CONN_DH_SWEEP_REF 1129 +#define WT_STAT_CONN_DH_SWEEP_REF 1127 /*! data-handle: connection sweep dhandles closed */ -#define WT_STAT_CONN_DH_SWEEP_CLOSE 1130 +#define WT_STAT_CONN_DH_SWEEP_CLOSE 1128 /*! data-handle: connection sweep dhandles removed from hash list */ -#define WT_STAT_CONN_DH_SWEEP_REMOVE 1131 +#define WT_STAT_CONN_DH_SWEEP_REMOVE 1129 /*! data-handle: connection sweep time-of-death sets */ -#define WT_STAT_CONN_DH_SWEEP_TOD 1132 +#define WT_STAT_CONN_DH_SWEEP_TOD 1130 /*! data-handle: connection sweeps */ -#define WT_STAT_CONN_DH_SWEEPS 1133 +#define WT_STAT_CONN_DH_SWEEPS 1131 /*! data-handle: session dhandles swept */ -#define WT_STAT_CONN_DH_SESSION_HANDLES 1134 +#define WT_STAT_CONN_DH_SESSION_HANDLES 1132 /*! data-handle: session sweep attempts */ -#define WT_STAT_CONN_DH_SESSION_SWEEPS 1135 +#define WT_STAT_CONN_DH_SESSION_SWEEPS 1133 /*! lock: checkpoint lock acquisitions */ -#define WT_STAT_CONN_LOCK_CHECKPOINT_COUNT 1136 +#define WT_STAT_CONN_LOCK_CHECKPOINT_COUNT 1134 /*! lock: checkpoint lock application thread wait time (usecs) */ -#define WT_STAT_CONN_LOCK_CHECKPOINT_WAIT_APPLICATION 1137 +#define WT_STAT_CONN_LOCK_CHECKPOINT_WAIT_APPLICATION 1135 /*! lock: checkpoint lock internal thread wait time (usecs) */ -#define WT_STAT_CONN_LOCK_CHECKPOINT_WAIT_INTERNAL 1138 +#define WT_STAT_CONN_LOCK_CHECKPOINT_WAIT_INTERNAL 1136 /*! lock: handle-list lock eviction thread wait time (usecs) */ -#define WT_STAT_CONN_LOCK_HANDLE_LIST_WAIT_EVICTION 1139 +#define WT_STAT_CONN_LOCK_HANDLE_LIST_WAIT_EVICTION 1137 /*! lock: metadata lock acquisitions */ -#define WT_STAT_CONN_LOCK_METADATA_COUNT 1140 +#define WT_STAT_CONN_LOCK_METADATA_COUNT 1138 /*! lock: metadata lock application thread wait time (usecs) */ -#define WT_STAT_CONN_LOCK_METADATA_WAIT_APPLICATION 1141 +#define WT_STAT_CONN_LOCK_METADATA_WAIT_APPLICATION 1139 /*! lock: metadata lock internal thread wait time (usecs) */ -#define WT_STAT_CONN_LOCK_METADATA_WAIT_INTERNAL 1142 +#define WT_STAT_CONN_LOCK_METADATA_WAIT_INTERNAL 1140 /*! lock: schema lock acquisitions */ -#define WT_STAT_CONN_LOCK_SCHEMA_COUNT 1143 +#define WT_STAT_CONN_LOCK_SCHEMA_COUNT 1141 /*! lock: schema lock application thread wait time (usecs) */ -#define WT_STAT_CONN_LOCK_SCHEMA_WAIT_APPLICATION 1144 +#define WT_STAT_CONN_LOCK_SCHEMA_WAIT_APPLICATION 1142 /*! lock: schema lock internal thread wait time (usecs) */ -#define WT_STAT_CONN_LOCK_SCHEMA_WAIT_INTERNAL 1145 +#define WT_STAT_CONN_LOCK_SCHEMA_WAIT_INTERNAL 1143 /*! lock: table lock acquisitions */ -#define WT_STAT_CONN_LOCK_TABLE_COUNT 1146 +#define WT_STAT_CONN_LOCK_TABLE_COUNT 1144 /*! * lock: table lock application thread time waiting for the table lock * (usecs) */ -#define WT_STAT_CONN_LOCK_TABLE_WAIT_APPLICATION 1147 +#define WT_STAT_CONN_LOCK_TABLE_WAIT_APPLICATION 1145 /*! * lock: table lock internal thread time waiting for the table lock * (usecs) */ -#define WT_STAT_CONN_LOCK_TABLE_WAIT_INTERNAL 1148 +#define WT_STAT_CONN_LOCK_TABLE_WAIT_INTERNAL 1146 /*! log: busy returns attempting to switch slots */ -#define WT_STAT_CONN_LOG_SLOT_SWITCH_BUSY 1149 +#define WT_STAT_CONN_LOG_SLOT_SWITCH_BUSY 1147 /*! log: log bytes of payload data */ -#define WT_STAT_CONN_LOG_BYTES_PAYLOAD 1150 +#define WT_STAT_CONN_LOG_BYTES_PAYLOAD 1148 /*! log: log bytes written */ -#define WT_STAT_CONN_LOG_BYTES_WRITTEN 1151 +#define WT_STAT_CONN_LOG_BYTES_WRITTEN 1149 /*! log: log files manually zero-filled */ -#define WT_STAT_CONN_LOG_ZERO_FILLS 1152 +#define WT_STAT_CONN_LOG_ZERO_FILLS 1150 /*! log: log flush operations */ -#define WT_STAT_CONN_LOG_FLUSH 1153 +#define WT_STAT_CONN_LOG_FLUSH 1151 /*! log: log force write operations */ -#define WT_STAT_CONN_LOG_FORCE_WRITE 1154 +#define WT_STAT_CONN_LOG_FORCE_WRITE 1152 /*! log: log force write operations skipped */ -#define WT_STAT_CONN_LOG_FORCE_WRITE_SKIP 1155 +#define WT_STAT_CONN_LOG_FORCE_WRITE_SKIP 1153 /*! log: log records compressed */ -#define WT_STAT_CONN_LOG_COMPRESS_WRITES 1156 +#define WT_STAT_CONN_LOG_COMPRESS_WRITES 1154 /*! log: log records not compressed */ -#define WT_STAT_CONN_LOG_COMPRESS_WRITE_FAILS 1157 +#define WT_STAT_CONN_LOG_COMPRESS_WRITE_FAILS 1155 /*! log: log records too small to compress */ -#define WT_STAT_CONN_LOG_COMPRESS_SMALL 1158 +#define WT_STAT_CONN_LOG_COMPRESS_SMALL 1156 /*! log: log release advances write LSN */ -#define WT_STAT_CONN_LOG_RELEASE_WRITE_LSN 1159 +#define WT_STAT_CONN_LOG_RELEASE_WRITE_LSN 1157 /*! log: log scan operations */ -#define WT_STAT_CONN_LOG_SCANS 1160 +#define WT_STAT_CONN_LOG_SCANS 1158 /*! log: log scan records requiring two reads */ -#define WT_STAT_CONN_LOG_SCAN_REREADS 1161 +#define WT_STAT_CONN_LOG_SCAN_REREADS 1159 /*! log: log server thread advances write LSN */ -#define WT_STAT_CONN_LOG_WRITE_LSN 1162 +#define WT_STAT_CONN_LOG_WRITE_LSN 1160 /*! log: log server thread write LSN walk skipped */ -#define WT_STAT_CONN_LOG_WRITE_LSN_SKIP 1163 +#define WT_STAT_CONN_LOG_WRITE_LSN_SKIP 1161 /*! log: log sync operations */ -#define WT_STAT_CONN_LOG_SYNC 1164 +#define WT_STAT_CONN_LOG_SYNC 1162 /*! log: log sync time duration (usecs) */ -#define WT_STAT_CONN_LOG_SYNC_DURATION 1165 +#define WT_STAT_CONN_LOG_SYNC_DURATION 1163 /*! log: log sync_dir operations */ -#define WT_STAT_CONN_LOG_SYNC_DIR 1166 +#define WT_STAT_CONN_LOG_SYNC_DIR 1164 /*! log: log sync_dir time duration (usecs) */ -#define WT_STAT_CONN_LOG_SYNC_DIR_DURATION 1167 +#define WT_STAT_CONN_LOG_SYNC_DIR_DURATION 1165 /*! log: log write operations */ -#define WT_STAT_CONN_LOG_WRITES 1168 +#define WT_STAT_CONN_LOG_WRITES 1166 /*! log: logging bytes consolidated */ -#define WT_STAT_CONN_LOG_SLOT_CONSOLIDATED 1169 +#define WT_STAT_CONN_LOG_SLOT_CONSOLIDATED 1167 /*! log: maximum log file size */ -#define WT_STAT_CONN_LOG_MAX_FILESIZE 1170 +#define WT_STAT_CONN_LOG_MAX_FILESIZE 1168 /*! log: number of pre-allocated log files to create */ -#define WT_STAT_CONN_LOG_PREALLOC_MAX 1171 +#define WT_STAT_CONN_LOG_PREALLOC_MAX 1169 /*! log: pre-allocated log files not ready and missed */ -#define WT_STAT_CONN_LOG_PREALLOC_MISSED 1172 +#define WT_STAT_CONN_LOG_PREALLOC_MISSED 1170 /*! log: pre-allocated log files prepared */ -#define WT_STAT_CONN_LOG_PREALLOC_FILES 1173 +#define WT_STAT_CONN_LOG_PREALLOC_FILES 1171 /*! log: pre-allocated log files used */ -#define WT_STAT_CONN_LOG_PREALLOC_USED 1174 +#define WT_STAT_CONN_LOG_PREALLOC_USED 1172 /*! log: records processed by log scan */ -#define WT_STAT_CONN_LOG_SCAN_RECORDS 1175 +#define WT_STAT_CONN_LOG_SCAN_RECORDS 1173 /*! log: slot close lost race */ -#define WT_STAT_CONN_LOG_SLOT_CLOSE_RACE 1176 +#define WT_STAT_CONN_LOG_SLOT_CLOSE_RACE 1174 /*! log: slot close unbuffered waits */ -#define WT_STAT_CONN_LOG_SLOT_CLOSE_UNBUF 1177 +#define WT_STAT_CONN_LOG_SLOT_CLOSE_UNBUF 1175 /*! log: slot closures */ -#define WT_STAT_CONN_LOG_SLOT_CLOSES 1178 +#define WT_STAT_CONN_LOG_SLOT_CLOSES 1176 /*! log: slot join atomic update races */ -#define WT_STAT_CONN_LOG_SLOT_RACES 1179 +#define WT_STAT_CONN_LOG_SLOT_RACES 1177 /*! log: slot join calls atomic updates raced */ -#define WT_STAT_CONN_LOG_SLOT_YIELD_RACE 1180 +#define WT_STAT_CONN_LOG_SLOT_YIELD_RACE 1178 /*! log: slot join calls did not yield */ -#define WT_STAT_CONN_LOG_SLOT_IMMEDIATE 1181 +#define WT_STAT_CONN_LOG_SLOT_IMMEDIATE 1179 /*! log: slot join calls found active slot closed */ -#define WT_STAT_CONN_LOG_SLOT_YIELD_CLOSE 1182 +#define WT_STAT_CONN_LOG_SLOT_YIELD_CLOSE 1180 /*! log: slot join calls slept */ -#define WT_STAT_CONN_LOG_SLOT_YIELD_SLEEP 1183 +#define WT_STAT_CONN_LOG_SLOT_YIELD_SLEEP 1181 /*! log: slot join calls yielded */ -#define WT_STAT_CONN_LOG_SLOT_YIELD 1184 +#define WT_STAT_CONN_LOG_SLOT_YIELD 1182 /*! log: slot join found active slot closed */ -#define WT_STAT_CONN_LOG_SLOT_ACTIVE_CLOSED 1185 +#define WT_STAT_CONN_LOG_SLOT_ACTIVE_CLOSED 1183 /*! log: slot joins yield time (usecs) */ -#define WT_STAT_CONN_LOG_SLOT_YIELD_DURATION 1186 +#define WT_STAT_CONN_LOG_SLOT_YIELD_DURATION 1184 /*! log: slot transitions unable to find free slot */ -#define WT_STAT_CONN_LOG_SLOT_NO_FREE_SLOTS 1187 +#define WT_STAT_CONN_LOG_SLOT_NO_FREE_SLOTS 1185 /*! log: slot unbuffered writes */ -#define WT_STAT_CONN_LOG_SLOT_UNBUFFERED 1188 +#define WT_STAT_CONN_LOG_SLOT_UNBUFFERED 1186 /*! log: total in-memory size of compressed records */ -#define WT_STAT_CONN_LOG_COMPRESS_MEM 1189 +#define WT_STAT_CONN_LOG_COMPRESS_MEM 1187 /*! log: total log buffer size */ -#define WT_STAT_CONN_LOG_BUFFER_SIZE 1190 +#define WT_STAT_CONN_LOG_BUFFER_SIZE 1188 /*! log: total size of compressed records */ -#define WT_STAT_CONN_LOG_COMPRESS_LEN 1191 +#define WT_STAT_CONN_LOG_COMPRESS_LEN 1189 /*! log: written slots coalesced */ -#define WT_STAT_CONN_LOG_SLOT_COALESCED 1192 +#define WT_STAT_CONN_LOG_SLOT_COALESCED 1190 /*! log: yields waiting for previous log file close */ -#define WT_STAT_CONN_LOG_CLOSE_YIELDS 1193 +#define WT_STAT_CONN_LOG_CLOSE_YIELDS 1191 /*! reconciliation: fast-path pages deleted */ -#define WT_STAT_CONN_REC_PAGE_DELETE_FAST 1194 +#define WT_STAT_CONN_REC_PAGE_DELETE_FAST 1192 /*! reconciliation: page reconciliation calls */ -#define WT_STAT_CONN_REC_PAGES 1195 +#define WT_STAT_CONN_REC_PAGES 1193 /*! reconciliation: page reconciliation calls for eviction */ -#define WT_STAT_CONN_REC_PAGES_EVICTION 1196 +#define WT_STAT_CONN_REC_PAGES_EVICTION 1194 /*! reconciliation: pages deleted */ -#define WT_STAT_CONN_REC_PAGE_DELETE 1197 +#define WT_STAT_CONN_REC_PAGE_DELETE 1195 /*! reconciliation: split bytes currently awaiting free */ -#define WT_STAT_CONN_REC_SPLIT_STASHED_BYTES 1198 +#define WT_STAT_CONN_REC_SPLIT_STASHED_BYTES 1196 /*! reconciliation: split objects currently awaiting free */ -#define WT_STAT_CONN_REC_SPLIT_STASHED_OBJECTS 1199 +#define WT_STAT_CONN_REC_SPLIT_STASHED_OBJECTS 1197 /*! session: open cursor count */ -#define WT_STAT_CONN_SESSION_CURSOR_OPEN 1200 +#define WT_STAT_CONN_SESSION_CURSOR_OPEN 1198 /*! session: open session count */ -#define WT_STAT_CONN_SESSION_OPEN 1201 +#define WT_STAT_CONN_SESSION_OPEN 1199 /*! session: table alter failed calls */ -#define WT_STAT_CONN_SESSION_TABLE_ALTER_FAIL 1202 +#define WT_STAT_CONN_SESSION_TABLE_ALTER_FAIL 1200 /*! session: table alter successful calls */ -#define WT_STAT_CONN_SESSION_TABLE_ALTER_SUCCESS 1203 +#define WT_STAT_CONN_SESSION_TABLE_ALTER_SUCCESS 1201 /*! session: table alter unchanged and skipped */ -#define WT_STAT_CONN_SESSION_TABLE_ALTER_SKIP 1204 +#define WT_STAT_CONN_SESSION_TABLE_ALTER_SKIP 1202 /*! session: table compact failed calls */ -#define WT_STAT_CONN_SESSION_TABLE_COMPACT_FAIL 1205 +#define WT_STAT_CONN_SESSION_TABLE_COMPACT_FAIL 1203 /*! session: table compact successful calls */ -#define WT_STAT_CONN_SESSION_TABLE_COMPACT_SUCCESS 1206 +#define WT_STAT_CONN_SESSION_TABLE_COMPACT_SUCCESS 1204 /*! session: table create failed calls */ -#define WT_STAT_CONN_SESSION_TABLE_CREATE_FAIL 1207 +#define WT_STAT_CONN_SESSION_TABLE_CREATE_FAIL 1205 /*! session: table create successful calls */ -#define WT_STAT_CONN_SESSION_TABLE_CREATE_SUCCESS 1208 +#define WT_STAT_CONN_SESSION_TABLE_CREATE_SUCCESS 1206 /*! session: table drop failed calls */ -#define WT_STAT_CONN_SESSION_TABLE_DROP_FAIL 1209 +#define WT_STAT_CONN_SESSION_TABLE_DROP_FAIL 1207 /*! session: table drop successful calls */ -#define WT_STAT_CONN_SESSION_TABLE_DROP_SUCCESS 1210 +#define WT_STAT_CONN_SESSION_TABLE_DROP_SUCCESS 1208 /*! session: table rebalance failed calls */ -#define WT_STAT_CONN_SESSION_TABLE_REBALANCE_FAIL 1211 +#define WT_STAT_CONN_SESSION_TABLE_REBALANCE_FAIL 1209 /*! session: table rebalance successful calls */ -#define WT_STAT_CONN_SESSION_TABLE_REBALANCE_SUCCESS 1212 +#define WT_STAT_CONN_SESSION_TABLE_REBALANCE_SUCCESS 1210 /*! session: table rename failed calls */ -#define WT_STAT_CONN_SESSION_TABLE_RENAME_FAIL 1213 +#define WT_STAT_CONN_SESSION_TABLE_RENAME_FAIL 1211 /*! session: table rename successful calls */ -#define WT_STAT_CONN_SESSION_TABLE_RENAME_SUCCESS 1214 +#define WT_STAT_CONN_SESSION_TABLE_RENAME_SUCCESS 1212 /*! session: table salvage failed calls */ -#define WT_STAT_CONN_SESSION_TABLE_SALVAGE_FAIL 1215 +#define WT_STAT_CONN_SESSION_TABLE_SALVAGE_FAIL 1213 /*! session: table salvage successful calls */ -#define WT_STAT_CONN_SESSION_TABLE_SALVAGE_SUCCESS 1216 +#define WT_STAT_CONN_SESSION_TABLE_SALVAGE_SUCCESS 1214 /*! session: table truncate failed calls */ -#define WT_STAT_CONN_SESSION_TABLE_TRUNCATE_FAIL 1217 +#define WT_STAT_CONN_SESSION_TABLE_TRUNCATE_FAIL 1215 /*! session: table truncate successful calls */ -#define WT_STAT_CONN_SESSION_TABLE_TRUNCATE_SUCCESS 1218 +#define WT_STAT_CONN_SESSION_TABLE_TRUNCATE_SUCCESS 1216 /*! session: table verify failed calls */ -#define WT_STAT_CONN_SESSION_TABLE_VERIFY_FAIL 1219 +#define WT_STAT_CONN_SESSION_TABLE_VERIFY_FAIL 1217 /*! session: table verify successful calls */ -#define WT_STAT_CONN_SESSION_TABLE_VERIFY_SUCCESS 1220 +#define WT_STAT_CONN_SESSION_TABLE_VERIFY_SUCCESS 1218 /*! thread-state: active filesystem fsync calls */ -#define WT_STAT_CONN_THREAD_FSYNC_ACTIVE 1221 +#define WT_STAT_CONN_THREAD_FSYNC_ACTIVE 1219 /*! thread-state: active filesystem read calls */ -#define WT_STAT_CONN_THREAD_READ_ACTIVE 1222 +#define WT_STAT_CONN_THREAD_READ_ACTIVE 1220 /*! thread-state: active filesystem write calls */ -#define WT_STAT_CONN_THREAD_WRITE_ACTIVE 1223 +#define WT_STAT_CONN_THREAD_WRITE_ACTIVE 1221 /*! thread-yield: application thread time evicting (usecs) */ -#define WT_STAT_CONN_APPLICATION_EVICT_TIME 1224 +#define WT_STAT_CONN_APPLICATION_EVICT_TIME 1222 /*! thread-yield: application thread time waiting for cache (usecs) */ -#define WT_STAT_CONN_APPLICATION_CACHE_TIME 1225 +#define WT_STAT_CONN_APPLICATION_CACHE_TIME 1223 /*! thread-yield: page acquire busy blocked */ -#define WT_STAT_CONN_PAGE_BUSY_BLOCKED 1226 +#define WT_STAT_CONN_PAGE_BUSY_BLOCKED 1224 /*! thread-yield: page acquire eviction blocked */ -#define WT_STAT_CONN_PAGE_FORCIBLE_EVICT_BLOCKED 1227 +#define WT_STAT_CONN_PAGE_FORCIBLE_EVICT_BLOCKED 1225 /*! thread-yield: page acquire locked blocked */ -#define WT_STAT_CONN_PAGE_LOCKED_BLOCKED 1228 +#define WT_STAT_CONN_PAGE_LOCKED_BLOCKED 1226 /*! thread-yield: page acquire read blocked */ -#define WT_STAT_CONN_PAGE_READ_BLOCKED 1229 +#define WT_STAT_CONN_PAGE_READ_BLOCKED 1227 /*! thread-yield: page acquire time sleeping (usecs) */ -#define WT_STAT_CONN_PAGE_SLEEP 1230 +#define WT_STAT_CONN_PAGE_SLEEP 1228 /*! transaction: number of named snapshots created */ -#define WT_STAT_CONN_TXN_SNAPSHOTS_CREATED 1231 +#define WT_STAT_CONN_TXN_SNAPSHOTS_CREATED 1229 /*! transaction: number of named snapshots dropped */ -#define WT_STAT_CONN_TXN_SNAPSHOTS_DROPPED 1232 +#define WT_STAT_CONN_TXN_SNAPSHOTS_DROPPED 1230 /*! transaction: transaction begins */ -#define WT_STAT_CONN_TXN_BEGIN 1233 +#define WT_STAT_CONN_TXN_BEGIN 1231 /*! transaction: transaction checkpoint currently running */ -#define WT_STAT_CONN_TXN_CHECKPOINT_RUNNING 1234 +#define WT_STAT_CONN_TXN_CHECKPOINT_RUNNING 1232 /*! transaction: transaction checkpoint generation */ -#define WT_STAT_CONN_TXN_CHECKPOINT_GENERATION 1235 +#define WT_STAT_CONN_TXN_CHECKPOINT_GENERATION 1233 /*! transaction: transaction checkpoint max time (msecs) */ -#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_MAX 1236 +#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_MAX 1234 /*! transaction: transaction checkpoint min time (msecs) */ -#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_MIN 1237 +#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_MIN 1235 /*! transaction: transaction checkpoint most recent time (msecs) */ -#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_RECENT 1238 +#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_RECENT 1236 /*! transaction: transaction checkpoint scrub dirty target */ -#define WT_STAT_CONN_TXN_CHECKPOINT_SCRUB_TARGET 1239 +#define WT_STAT_CONN_TXN_CHECKPOINT_SCRUB_TARGET 1237 /*! transaction: transaction checkpoint scrub time (msecs) */ -#define WT_STAT_CONN_TXN_CHECKPOINT_SCRUB_TIME 1240 +#define WT_STAT_CONN_TXN_CHECKPOINT_SCRUB_TIME 1238 /*! transaction: transaction checkpoint total time (msecs) */ -#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_TOTAL 1241 +#define WT_STAT_CONN_TXN_CHECKPOINT_TIME_TOTAL 1239 /*! transaction: transaction checkpoints */ -#define WT_STAT_CONN_TXN_CHECKPOINT 1242 +#define WT_STAT_CONN_TXN_CHECKPOINT 1240 /*! * transaction: transaction checkpoints skipped because database was * clean */ -#define WT_STAT_CONN_TXN_CHECKPOINT_SKIPPED 1243 +#define WT_STAT_CONN_TXN_CHECKPOINT_SKIPPED 1241 /*! transaction: transaction failures due to cache overflow */ -#define WT_STAT_CONN_TXN_FAIL_CACHE 1244 +#define WT_STAT_CONN_TXN_FAIL_CACHE 1242 /*! * transaction: transaction fsync calls for checkpoint after allocating * the transaction ID */ -#define WT_STAT_CONN_TXN_CHECKPOINT_FSYNC_POST 1245 +#define WT_STAT_CONN_TXN_CHECKPOINT_FSYNC_POST 1243 /*! * transaction: transaction fsync duration for checkpoint after * allocating the transaction ID (usecs) */ -#define WT_STAT_CONN_TXN_CHECKPOINT_FSYNC_POST_DURATION 1246 +#define WT_STAT_CONN_TXN_CHECKPOINT_FSYNC_POST_DURATION 1244 /*! transaction: transaction range of IDs currently pinned */ -#define WT_STAT_CONN_TXN_PINNED_RANGE 1247 +#define WT_STAT_CONN_TXN_PINNED_RANGE 1245 /*! transaction: transaction range of IDs currently pinned by a checkpoint */ -#define WT_STAT_CONN_TXN_PINNED_CHECKPOINT_RANGE 1248 +#define WT_STAT_CONN_TXN_PINNED_CHECKPOINT_RANGE 1246 /*! * transaction: transaction range of IDs currently pinned by named * snapshots */ -#define WT_STAT_CONN_TXN_PINNED_SNAPSHOT_RANGE 1249 +#define WT_STAT_CONN_TXN_PINNED_SNAPSHOT_RANGE 1247 /*! transaction: transaction sync calls */ -#define WT_STAT_CONN_TXN_SYNC 1250 +#define WT_STAT_CONN_TXN_SYNC 1248 /*! transaction: transactions committed */ -#define WT_STAT_CONN_TXN_COMMIT 1251 +#define WT_STAT_CONN_TXN_COMMIT 1249 /*! transaction: transactions rolled back */ -#define WT_STAT_CONN_TXN_ROLLBACK 1252 +#define WT_STAT_CONN_TXN_ROLLBACK 1250 /*! * @} @@ -5249,65 +5181,61 @@ extern int wiredtiger_extension_terminate(WT_CONNECTION *connection); #define WT_STAT_DSRC_CURSOR_UPDATE_BYTES 2092 /*! cursor: insert calls */ #define WT_STAT_DSRC_CURSOR_INSERT 2093 -/*! cursor: modify calls */ -#define WT_STAT_DSRC_CURSOR_MODIFY 2094 /*! cursor: next calls */ -#define WT_STAT_DSRC_CURSOR_NEXT 2095 +#define WT_STAT_DSRC_CURSOR_NEXT 2094 /*! cursor: prev calls */ -#define WT_STAT_DSRC_CURSOR_PREV 2096 +#define WT_STAT_DSRC_CURSOR_PREV 2095 /*! cursor: remove calls */ -#define WT_STAT_DSRC_CURSOR_REMOVE 2097 -/*! cursor: reserve calls */ -#define WT_STAT_DSRC_CURSOR_RESERVE 2098 +#define WT_STAT_DSRC_CURSOR_REMOVE 2096 /*! cursor: reset calls */ -#define WT_STAT_DSRC_CURSOR_RESET 2099 +#define WT_STAT_DSRC_CURSOR_RESET 2097 /*! cursor: restarted searches */ -#define WT_STAT_DSRC_CURSOR_RESTART 2100 +#define WT_STAT_DSRC_CURSOR_RESTART 2098 /*! cursor: search calls */ -#define WT_STAT_DSRC_CURSOR_SEARCH 2101 +#define WT_STAT_DSRC_CURSOR_SEARCH 2099 /*! cursor: search near calls */ -#define WT_STAT_DSRC_CURSOR_SEARCH_NEAR 2102 +#define WT_STAT_DSRC_CURSOR_SEARCH_NEAR 2100 /*! cursor: truncate calls */ -#define WT_STAT_DSRC_CURSOR_TRUNCATE 2103 +#define WT_STAT_DSRC_CURSOR_TRUNCATE 2101 /*! cursor: update calls */ -#define WT_STAT_DSRC_CURSOR_UPDATE 2104 +#define WT_STAT_DSRC_CURSOR_UPDATE 2102 /*! reconciliation: dictionary matches */ -#define WT_STAT_DSRC_REC_DICTIONARY 2105 +#define WT_STAT_DSRC_REC_DICTIONARY 2103 /*! reconciliation: fast-path pages deleted */ -#define WT_STAT_DSRC_REC_PAGE_DELETE_FAST 2106 +#define WT_STAT_DSRC_REC_PAGE_DELETE_FAST 2104 /*! * reconciliation: internal page key bytes discarded using suffix * compression */ -#define WT_STAT_DSRC_REC_SUFFIX_COMPRESSION 2107 +#define WT_STAT_DSRC_REC_SUFFIX_COMPRESSION 2105 /*! reconciliation: internal page multi-block writes */ -#define WT_STAT_DSRC_REC_MULTIBLOCK_INTERNAL 2108 +#define WT_STAT_DSRC_REC_MULTIBLOCK_INTERNAL 2106 /*! reconciliation: internal-page overflow keys */ -#define WT_STAT_DSRC_REC_OVERFLOW_KEY_INTERNAL 2109 +#define WT_STAT_DSRC_REC_OVERFLOW_KEY_INTERNAL 2107 /*! reconciliation: leaf page key bytes discarded using prefix compression */ -#define WT_STAT_DSRC_REC_PREFIX_COMPRESSION 2110 +#define WT_STAT_DSRC_REC_PREFIX_COMPRESSION 2108 /*! reconciliation: leaf page multi-block writes */ -#define WT_STAT_DSRC_REC_MULTIBLOCK_LEAF 2111 +#define WT_STAT_DSRC_REC_MULTIBLOCK_LEAF 2109 /*! reconciliation: leaf-page overflow keys */ -#define WT_STAT_DSRC_REC_OVERFLOW_KEY_LEAF 2112 +#define WT_STAT_DSRC_REC_OVERFLOW_KEY_LEAF 2110 /*! reconciliation: maximum blocks required for a page */ -#define WT_STAT_DSRC_REC_MULTIBLOCK_MAX 2113 +#define WT_STAT_DSRC_REC_MULTIBLOCK_MAX 2111 /*! reconciliation: overflow values written */ -#define WT_STAT_DSRC_REC_OVERFLOW_VALUE 2114 +#define WT_STAT_DSRC_REC_OVERFLOW_VALUE 2112 /*! reconciliation: page checksum matches */ -#define WT_STAT_DSRC_REC_PAGE_MATCH 2115 +#define WT_STAT_DSRC_REC_PAGE_MATCH 2113 /*! reconciliation: page reconciliation calls */ -#define WT_STAT_DSRC_REC_PAGES 2116 +#define WT_STAT_DSRC_REC_PAGES 2114 /*! reconciliation: page reconciliation calls for eviction */ -#define WT_STAT_DSRC_REC_PAGES_EVICTION 2117 +#define WT_STAT_DSRC_REC_PAGES_EVICTION 2115 /*! reconciliation: pages deleted */ -#define WT_STAT_DSRC_REC_PAGE_DELETE 2118 +#define WT_STAT_DSRC_REC_PAGE_DELETE 2116 /*! session: object compaction */ -#define WT_STAT_DSRC_SESSION_COMPACT 2119 +#define WT_STAT_DSRC_SESSION_COMPACT 2117 /*! session: open cursor count */ -#define WT_STAT_DSRC_SESSION_CURSOR_OPEN 2120 +#define WT_STAT_DSRC_SESSION_CURSOR_OPEN 2118 /*! transaction: update conflicts */ -#define WT_STAT_DSRC_TXN_UPDATE_CONFLICT 2121 +#define WT_STAT_DSRC_TXN_UPDATE_CONFLICT 2119 /*! * @} diff --git a/src/lsm/lsm_cursor.c b/src/lsm/lsm_cursor.c index b14e94eb93e..e62d6cab584 100644 --- a/src/lsm/lsm_cursor.c +++ b/src/lsm/lsm_cursor.c @@ -1756,7 +1756,6 @@ __wt_clsm_open(WT_SESSION_IMPL *session, __clsm_search, /* search */ __clsm_search_near, /* search-near */ __clsm_insert, /* insert */ - __wt_cursor_modify_notsup, /* modify */ __clsm_update, /* update */ __clsm_remove, /* remove */ __clsm_reserve, /* reserve */ diff --git a/src/reconcile/rec_write.c b/src/reconcile/rec_write.c index 8f7769766a9..52a279b8c96 100644 --- a/src/reconcile/rec_write.c +++ b/src/reconcile/rec_write.c @@ -1227,8 +1227,7 @@ __rec_txn_read(WT_SESSION_IMPL *session, WT_RECONCILE *r, } /* Reconciliation should never see a reserved update. */ - WT_ASSERT(session, - *updp == NULL || (*updp)->type != WT_UPDATE_RESERVED); + WT_ASSERT(session, *updp == NULL || !WT_UPDATE_RESERVED_ISSET(*updp)); /* * If all of the updates were aborted, quit. This test is not strictly @@ -1412,14 +1411,14 @@ __rec_txn_read(WT_SESSION_IMPL *session, WT_RECONCILE *r, * place a deleted record at the end of the update list. */ if (vpack == NULL || vpack->type == WT_CELL_DEL) - WT_RET(__wt_update_alloc(session, - NULL, &append, ¬used, WT_UPDATE_DELETED)); + WT_RET(__wt_update_alloc( + session, NULL, &append, ¬used, true, false)); else { WT_RET(__wt_scr_alloc(session, 0, &tmp)); if ((ret = __wt_page_cell_data_ref( session, page, vpack, tmp)) == 0) ret = __wt_update_alloc(session, - tmp, &append, ¬used, WT_UPDATE_STANDARD); + tmp, &append, ¬used, false, false); __wt_scr_free(session, &tmp); WT_RET(ret); } @@ -3676,20 +3675,20 @@ __rec_update_las(WT_SESSION_IMPL *session, * restored, obviously. */ do { - if (upd->type == WT_UPDATE_RESERVED) + if (WT_UPDATE_RESERVED_ISSET(upd)) continue; cursor->set_key(cursor, btree_id, &las_addr, ++las_counter, list->onpage_txn, key); - if (upd->type == WT_UPDATE_DELETED) + if (WT_UPDATE_DELETED_ISSET(upd)) las_value.size = 0; else { las_value.data = WT_UPDATE_DATA(upd); las_value.size = upd->size; } cursor->set_value( - cursor, upd->txnid, upd->type, &las_value); + cursor, upd->txnid, upd->size, &las_value); WT_ERR(cursor->insert(cursor)); ++insert_cnt; @@ -4615,7 +4614,7 @@ record_loop: /* update_no_copy = true; /* No data copy */ repeat_count = 1; /* Single record */ - deleted = upd->type == WT_UPDATE_DELETED; + deleted = WT_UPDATE_DELETED_ISSET(upd); if (!deleted) { data = WT_UPDATE_DATA(upd); size = upd->size; @@ -4850,7 +4849,7 @@ compare: /* } } else { deleted = upd == NULL || - upd->type == WT_UPDATE_DELETED; + WT_UPDATE_DELETED_ISSET(upd); if (!deleted) { data = WT_UPDATE_DATA(upd); size = upd->size; @@ -5395,7 +5394,7 @@ __rec_row_leaf(WT_SESSION_IMPL *session, __wt_ovfl_cache(session, page, rip, vpack)); /* If this key/value pair was deleted, we're done. */ - if (upd->type == WT_UPDATE_DELETED) { + if (WT_UPDATE_DELETED_ISSET(upd)) { /* * Overflow keys referencing discarded values * are no longer useful, discard the backing @@ -5605,7 +5604,7 @@ __rec_row_leaf_insert(WT_SESSION_IMPL *session, WT_RECONCILE *r, WT_INSERT *ins) for (; ins != NULL; ins = WT_SKIP_NEXT(ins)) { /* Look for an update. */ WT_RET(__rec_txn_read(session, r, ins, NULL, NULL, &upd)); - if (upd == NULL || upd->type == WT_UPDATE_DELETED) + if (upd == NULL || WT_UPDATE_DELETED_ISSET(upd)) continue; if (upd->size == 0) /* Build value cell. */ diff --git a/src/support/stat.c b/src/support/stat.c index bc40244f5e6..8711e6b9bc1 100644 --- a/src/support/stat.c +++ b/src/support/stat.c @@ -97,11 +97,9 @@ static const char * const __stats_dsrc_desc[] = { "cursor: cursor-remove key bytes removed", "cursor: cursor-update value bytes updated", "cursor: insert calls", - "cursor: modify calls", "cursor: next calls", "cursor: prev calls", "cursor: remove calls", - "cursor: reserve calls", "cursor: reset calls", "cursor: restarted searches", "cursor: search calls", @@ -261,11 +259,9 @@ __wt_stat_dsrc_clear_single(WT_DSRC_STATS *stats) stats->cursor_remove_bytes = 0; stats->cursor_update_bytes = 0; stats->cursor_insert = 0; - stats->cursor_modify = 0; stats->cursor_next = 0; stats->cursor_prev = 0; stats->cursor_remove = 0; - stats->cursor_reserve = 0; stats->cursor_reset = 0; stats->cursor_restart = 0; stats->cursor_search = 0; @@ -414,11 +410,9 @@ __wt_stat_dsrc_aggregate_single( to->cursor_remove_bytes += from->cursor_remove_bytes; to->cursor_update_bytes += from->cursor_update_bytes; to->cursor_insert += from->cursor_insert; - to->cursor_modify += from->cursor_modify; to->cursor_next += from->cursor_next; to->cursor_prev += from->cursor_prev; to->cursor_remove += from->cursor_remove; - to->cursor_reserve += from->cursor_reserve; to->cursor_reset += from->cursor_reset; to->cursor_restart += from->cursor_restart; to->cursor_search += from->cursor_search; @@ -594,11 +588,9 @@ __wt_stat_dsrc_aggregate( to->cursor_remove_bytes += WT_STAT_READ(from, cursor_remove_bytes); to->cursor_update_bytes += WT_STAT_READ(from, cursor_update_bytes); to->cursor_insert += WT_STAT_READ(from, cursor_insert); - to->cursor_modify += WT_STAT_READ(from, cursor_modify); to->cursor_next += WT_STAT_READ(from, cursor_next); to->cursor_prev += WT_STAT_READ(from, cursor_prev); to->cursor_remove += WT_STAT_READ(from, cursor_remove); - to->cursor_reserve += WT_STAT_READ(from, cursor_reserve); to->cursor_reset += WT_STAT_READ(from, cursor_reset); to->cursor_restart += WT_STAT_READ(from, cursor_restart); to->cursor_search += WT_STAT_READ(from, cursor_search); @@ -749,11 +741,9 @@ static const char * const __stats_connection_desc[] = { "connection: total write I/Os", "cursor: cursor create calls", "cursor: cursor insert calls", - "cursor: cursor modify calls", "cursor: cursor next calls", "cursor: cursor prev calls", "cursor: cursor remove calls", - "cursor: cursor reserve calls", "cursor: cursor reset calls", "cursor: cursor restarted searches", "cursor: cursor search calls", @@ -1044,11 +1034,9 @@ __wt_stat_connection_clear_single(WT_CONNECTION_STATS *stats) stats->write_io = 0; stats->cursor_create = 0; stats->cursor_insert = 0; - stats->cursor_modify = 0; stats->cursor_next = 0; stats->cursor_prev = 0; stats->cursor_remove = 0; - stats->cursor_reserve = 0; stats->cursor_reset = 0; stats->cursor_restart = 0; stats->cursor_search = 0; @@ -1359,11 +1347,9 @@ __wt_stat_connection_aggregate( to->write_io += WT_STAT_READ(from, write_io); to->cursor_create += WT_STAT_READ(from, cursor_create); to->cursor_insert += WT_STAT_READ(from, cursor_insert); - to->cursor_modify += WT_STAT_READ(from, cursor_modify); to->cursor_next += WT_STAT_READ(from, cursor_next); to->cursor_prev += WT_STAT_READ(from, cursor_prev); to->cursor_remove += WT_STAT_READ(from, cursor_remove); - to->cursor_reserve += WT_STAT_READ(from, cursor_reserve); to->cursor_reset += WT_STAT_READ(from, cursor_reset); to->cursor_restart += WT_STAT_READ(from, cursor_restart); to->cursor_search += WT_STAT_READ(from, cursor_search); diff --git a/src/txn/txn.c b/src/txn/txn.c index d9edbb80564..ac4be37f855 100644 --- a/src/txn/txn.c +++ b/src/txn/txn.c @@ -600,7 +600,7 @@ __wt_txn_commit(WT_SESSION_IMPL *session, const char *cfg[]) * Switch reserved operations to abort to simplify * obsolete update list truncation. */ - if (op->u.upd->type == WT_UPDATE_RESERVED) + if (WT_UPDATE_RESERVED_ISSET(op->u.upd)) op->u.upd->txnid = WT_TXN_ABORTED; break; case WT_TXN_OP_REF: diff --git a/src/txn/txn_log.c b/src/txn/txn_log.c index 74dc679a6ef..fae2027e1ec 100644 --- a/src/txn/txn_log.c +++ b/src/txn/txn_log.c @@ -82,12 +82,12 @@ __txn_op_log(WT_SESSION_IMPL *session, * or update, all of which require log records. We shouldn't ever log * reserve operations. */ - WT_ASSERT(session, upd->type != WT_UPDATE_RESERVED); + WT_ASSERT(session, !WT_UPDATE_RESERVED_ISSET(upd)); if (cbt->btree->type == BTREE_ROW) { #ifdef HAVE_DIAGNOSTIC __txn_op_log_row_key_check(session, cbt); #endif - if (upd->type == WT_UPDATE_DELETED) + if (WT_UPDATE_DELETED_ISSET(upd)) WT_RET(__wt_logop_row_remove_pack( session, logrec, op->fileid, &cursor->key)); else @@ -97,7 +97,7 @@ __txn_op_log(WT_SESSION_IMPL *session, recno = WT_INSERT_RECNO(cbt->ins); WT_ASSERT(session, recno != WT_RECNO_OOB); - if (upd->type == WT_UPDATE_DELETED) + if (WT_UPDATE_DELETED_ISSET(upd)) WT_RET(__wt_logop_col_remove_pack( session, logrec, op->fileid, recno)); else diff --git a/test/csuite/scope/main.c b/test/csuite/scope/main.c index 83d6bd479d9..8b9a79decd0 100644 --- a/test/csuite/scope/main.c +++ b/test/csuite/scope/main.c @@ -28,7 +28,7 @@ #include "test_util.h" #define KEY "key" -#define VALUE "value,value,value" +#define VALUE "value" static int ignore_errors; @@ -63,55 +63,44 @@ cursor_scope_ops(WT_SESSION *session, const char *uri) { struct { const char *op; - enum { INSERT, MODIFY, SEARCH, SEARCH_NEAR, + enum { INSERT, SEARCH, SEARCH_NEAR, REMOVE, REMOVE_POS, RESERVE, UPDATE } func; const char *config; } *op, ops[] = { /* - * The ops order is specific: insert has to happen first so - * other operations are possible, and remove has to be last. + * The ops order is fixed and shouldn't change, that is, insert + * has to happen first so search, update and remove operations + * are possible, and remove has to be last. */ { "insert", INSERT, NULL, }, { "search", SEARCH, NULL, }, { "search", SEARCH_NEAR, NULL, }, { "reserve", RESERVE, NULL, }, - { "insert", MODIFY, NULL, }, { "update", UPDATE, NULL, }, { "remove", REMOVE, NULL, }, { "remove", REMOVE_POS, NULL, }, { NULL, INSERT, NULL } }; WT_CURSOR *cursor; -#define MODIFY_ENTRIES 2 - WT_MODIFY entries[MODIFY_ENTRIES]; - WT_ITEM vu; uint64_t keyr; - const char *key, *vs; + const char *key, *value; char keybuf[100], valuebuf[100]; int exact; - bool recno, vstring; + bool recno; /* Reserve requires a running transaction. */ testutil_check(session->begin_transaction(session, NULL)); cursor = NULL; for (op = ops; op->op != NULL; op++) { - key = vs = NULL; - memset(&vu, 0, sizeof(vu)); + key = value = NULL; /* Open a cursor. */ if (cursor != NULL) testutil_check(cursor->close(cursor)); testutil_check(session->open_cursor( session, uri, NULL, op->config, &cursor)); - - /* Operations change based on the key/value formats. */ recno = strcmp(cursor->key_format, "r") == 0; - vstring = strcmp(cursor->value_format, "S") == 0; - - /* Modify is only possible with "item" values. */ - if (vstring && op->func == MODIFY) - continue; /* * Set up application buffers so we can detect overwrites @@ -125,12 +114,7 @@ cursor_scope_ops(WT_SESSION *session, const char *uri) cursor->set_key(cursor, keybuf); } strcpy(valuebuf, VALUE); - if (vstring) - cursor->set_value(cursor, valuebuf); - else { - vu.size = strlen(vu.data = valuebuf); - cursor->set_value(cursor, &vu); - } + cursor->set_value(cursor, valuebuf); /* * The application must keep key and value memory valid until @@ -143,20 +127,6 @@ cursor_scope_ops(WT_SESSION *session, const char *uri) case INSERT: testutil_check(cursor->insert(cursor)); break; - case MODIFY: - /* Modify, but don't really change anything. */ - entries[0].data.data = &VALUE[0]; - entries[0].data.size = 2; - entries[0].offset = 0; - entries[0].size = 2; - entries[1].data.data = &VALUE[3]; - entries[1].data.size = 5; - entries[1].offset = 3; - entries[1].size = 5; - - testutil_check( - cursor->modify(cursor, entries, MODIFY_ENTRIES)); - break; case SEARCH: testutil_check(cursor->search(cursor)); break; @@ -210,12 +180,7 @@ cursor_scope_ops(WT_SESSION *session, const char *uri) else testutil_assert( cursor->get_key(cursor, &key) != 0); - if (vstring) - testutil_assert( - cursor->get_value(cursor, &vs) != 0); - else - testutil_assert( - cursor->get_value(cursor, &vu) != 0); + testutil_assert(cursor->get_value(cursor, &value) != 0); testutil_assert(ignore_errors == 0); break; case REMOVE_POS: @@ -236,22 +201,16 @@ cursor_scope_ops(WT_SESSION *session, const char *uri) testutil_assert(strcmp(key, KEY) == 0); } ignore_errors = 1; - if (vstring) - testutil_assert( - cursor->get_value(cursor, &vs) != 0); - else - testutil_assert( - cursor->get_value(cursor, &vu) != 0); + testutil_assert(cursor->get_value(cursor, &value) != 0); testutil_assert(ignore_errors == 0); break; - case MODIFY: case RESERVE: case SEARCH: case SEARCH_NEAR: case UPDATE: /* - * Modify, reserve, search, search-near and update all - * position the cursor and have both a key and value. + * Reserve, search, search-near and update position the + * cursor and have both a key and value. * * Any key/value should not reference application * memory. @@ -266,19 +225,9 @@ cursor_scope_ops(WT_SESSION *session, const char *uri) testutil_assert(key != keybuf); testutil_assert(strcmp(key, KEY) == 0); } - if (vstring) { - testutil_assert( - cursor->get_value(cursor, &vs) == 0); - testutil_assert(vs != valuebuf); - testutil_assert(strcmp(vs, VALUE) == 0); - } else { - testutil_assert( - cursor->get_value(cursor, &vu) == 0); - testutil_assert(vu.data != valuebuf); - testutil_assert(vu.size == strlen(VALUE)); - testutil_assert( - memcmp(vu.data, VALUE, strlen(VALUE)) == 0); - } + testutil_assert(cursor->get_value(cursor, &value) == 0); + testutil_assert(value != valuebuf); + testutil_assert(strcmp(value, VALUE) == 0); break; } @@ -290,16 +239,9 @@ cursor_scope_ops(WT_SESSION *session, const char *uri) if (recno) cursor->set_key(cursor, (uint64_t)1); else { - strcpy(keybuf, KEY); - cursor->set_key(cursor, keybuf); - } - strcpy(valuebuf, VALUE); - if (vstring) - cursor->set_value(cursor, valuebuf); - else { - vu.size = strlen(vu.data = valuebuf); - cursor->set_value(cursor, &vu); + cursor->set_key(cursor, KEY); } + cursor->set_value(cursor, VALUE); testutil_check(cursor->insert(cursor)); } } @@ -330,19 +272,11 @@ main(int argc, char *argv[]) wiredtiger_open(opts->home, &event_handler, "create", &opts->conn)); run(opts->conn, "file:file.SS", "key_format=S,value_format=S"); - run(opts->conn, "file:file.Su", "key_format=S,value_format=u"); run(opts->conn, "file:file.rS", "key_format=r,value_format=S"); - run(opts->conn, "file:file.ru", "key_format=r,value_format=u"); - run(opts->conn, "lsm:lsm.SS", "key_format=S,value_format=S"); - run(opts->conn, "lsm:lsm.Su", "key_format=S,value_format=S"); run(opts->conn, "lsm:lsm.rS", "key_format=r,value_format=S"); - run(opts->conn, "lsm:lsm.ru", "key_format=r,value_format=S"); - run(opts->conn, "table:table.SS", "key_format=S,value_format=S"); - run(opts->conn, "table:table.Su", "key_format=S,value_format=u"); run(opts->conn, "table:table.rS", "key_format=r,value_format=S"); - run(opts->conn, "table:table.ru", "key_format=r,value_format=u"); testutil_cleanup(opts); diff --git a/test/format/config.c b/test/format/config.c index 2685438af00..ce1dc6d6e8e 100644 --- a/test/format/config.c +++ b/test/format/config.c @@ -489,8 +489,6 @@ config_pct(void) #define CONFIG_DELETE_ENTRY 0 { "delete_pct", &g.c_delete_pct, 0 }, { "insert_pct", &g.c_insert_pct, 0 }, -#define CONFIG_MODIFY_ENTRY 2 - { "modify_pct", &g.c_modify_pct, 0 }, { "read_pct", &g.c_read_pct, 0 }, { "write_pct", &g.c_write_pct, 0 }, }; @@ -510,16 +508,6 @@ config_pct(void) testutil_die(EINVAL, "operation percentages total to more than 100%%"); - /* Cursor modify isn't possible for fixed-length column store. */ - if (g.type == FIX) { - if (config_is_perm("modify_pct")) - testutil_die(EINVAL, - "WT_CURSOR.modify not supported by fixed-length " - "column store or LSM"); - list[CONFIG_MODIFY_ENTRY].order = 0; - *list[CONFIG_MODIFY_ENTRY].vp = 0; - } - /* * If the delete percentage isn't nailed down, periodically set it to * 0 so salvage gets run. Don't do it on the first run, all our smoke @@ -559,9 +547,8 @@ config_pct(void) list[max_slot].order = 0; pct -= *list[max_slot].vp; } - - testutil_assert(g.c_delete_pct + g.c_insert_pct + - g.c_modify_pct + g.c_read_pct + g.c_write_pct == 100); + testutil_assert(g.c_delete_pct + + g.c_insert_pct + g.c_read_pct + g.c_write_pct == 100); } /* diff --git a/test/format/config.h b/test/format/config.h index 3a41411e104..bc809a764ce 100644 --- a/test/format/config.h +++ b/test/format/config.h @@ -238,10 +238,6 @@ static CONFIG c[] = { "configure for mmap operations", /* 90% */ C_BOOL, 90, 0, 0, &g.c_mmap, NULL }, - { "modify_pct", - "percent operations that are value modifications", - C_IGNORE, 0, 0, 100, &g.c_modify_pct, NULL }, - { "ops", "the number of modification operations done per run", 0x0, 0, M(2), M(100), &g.c_ops, NULL }, @@ -327,7 +323,7 @@ static CONFIG c[] = { C_IGNORE|C_STRING, 0, 0, 0, NULL, &g.c_config_open }, { "write_pct", - "percent operations that are value updates", + "percent operations that are writes", C_IGNORE, 0, 0, 100, &g.c_write_pct, NULL }, { NULL, NULL, 0x0, 0, 0, 0, NULL, NULL } diff --git a/test/format/format.h b/test/format/format.h index 104ee1553f4..fa898e439be 100644 --- a/test/format/format.h +++ b/test/format/format.h @@ -78,8 +78,6 @@ #define FORMAT_OPERATION_REPS 3 /* 3 thread operations sets */ -#define MAX_MODIFY_ENTRIES 5 /* maximum change vectors */ - typedef struct { char *home; /* Home directory */ char *home_backup; /* Hot-backup directory */ @@ -149,28 +147,28 @@ typedef struct { uint32_t c_bloom_hash_count; uint32_t c_bloom_oldest; uint32_t c_cache; + uint32_t c_compact; uint32_t c_checkpoints; - char *c_checksum; + char *c_checksum; uint32_t c_chunk_size; - uint32_t c_compact; - char *c_compression; - char *c_config_open; + char *c_compression; + char *c_encryption; + char *c_config_open; uint32_t c_data_extend; - char *c_data_source; + char *c_data_source; uint32_t c_delete_pct; uint32_t c_dictionary; uint32_t c_direct_io; - char *c_encryption; uint32_t c_evict_max; - char *c_file_type; uint32_t c_firstfit; + char *c_file_type; uint32_t c_huffman_key; uint32_t c_huffman_value; uint32_t c_in_memory; uint32_t c_insert_pct; uint32_t c_internal_key_truncation; uint32_t c_intl_page_max; - char *c_isolation; + char *c_isolation; uint32_t c_key_gap; uint32_t c_key_max; uint32_t c_key_min; @@ -178,23 +176,22 @@ typedef struct { uint32_t c_leak_memory; uint32_t c_logging; uint32_t c_logging_archive; - char *c_logging_compression; + char *c_logging_compression; uint32_t c_logging_prealloc; uint32_t c_long_running_txn; uint32_t c_lsm_worker_threads; uint32_t c_merge_max; uint32_t c_mmap; - uint32_t c_modify_pct; uint32_t c_ops; + uint32_t c_quiet; uint32_t c_prefix_compression; uint32_t c_prefix_compression_min; - uint32_t c_quiet; - uint32_t c_read_pct; - uint32_t c_rebalance; uint32_t c_repeat_data_pct; uint32_t c_reverse; uint32_t c_rows; uint32_t c_runs; + uint32_t c_read_pct; + uint32_t c_rebalance; uint32_t c_salvage; uint32_t c_split_pct; uint32_t c_statistics; diff --git a/test/format/ops.c b/test/format/ops.c index 02cce77eec2..6e3e3b783c5 100644 --- a/test/format/ops.c +++ b/test/format/ops.c @@ -29,8 +29,6 @@ #include "format.h" static int col_insert(TINFO *, WT_CURSOR *, WT_ITEM *, WT_ITEM *, uint64_t *); -static int col_modify( - TINFO *, WT_CURSOR *, WT_ITEM *, WT_ITEM *, uint64_t, bool); static int col_remove(WT_CURSOR *, WT_ITEM *, uint64_t, bool); static int col_reserve(WT_CURSOR *, uint64_t, bool); static int col_update( @@ -39,8 +37,6 @@ static int nextprev(WT_CURSOR *, int); static void *ops(void *); static int row_insert( TINFO *, WT_CURSOR *, WT_ITEM *, WT_ITEM *, uint64_t, bool); -static int row_modify( - TINFO *, WT_CURSOR *, WT_ITEM *, WT_ITEM *, uint64_t, bool); static int row_remove(WT_CURSOR *, WT_ITEM *, uint64_t, bool); static int row_reserve(WT_CURSOR *, WT_ITEM *, uint64_t, bool); static int row_update( @@ -407,7 +403,7 @@ snap_check(WT_CURSOR *cursor, static void * ops(void *arg) { - enum { INSERT, MODIFY, READ, REMOVE, UPDATE } op; + enum { INSERT, READ, REMOVE, UPDATE } op; SNAP_OPS *snap, snap_list[64]; TINFO *tinfo; WT_CONNECTION *conn; @@ -614,12 +610,11 @@ skip_checkpoint: /* Pick the next checkpoint operation. */ op = REMOVE; else if (i < g.c_delete_pct + g.c_insert_pct) op = INSERT; - else if (i < g.c_delete_pct + - g.c_insert_pct + g.c_modify_pct) - op = MODIFY; - else if (i < g.c_delete_pct + - g.c_insert_pct + g.c_modify_pct + g.c_write_pct) + else if (i < + g.c_delete_pct + g.c_insert_pct + g.c_write_pct) op = UPDATE; + else + op = READ; } /* @@ -703,30 +698,6 @@ skip_checkpoint: /* Pick the next checkpoint operation. */ testutil_assert(ret == 0 || ret == WT_ROLLBACK); } break; - case MODIFY: - ++tinfo->update; - switch (g.type) { - case ROW: - ret = row_modify(tinfo, cursor, - key, value, keyno, positioned); - break; - case VAR: - ret = col_modify(tinfo, cursor, - key, value, keyno, positioned); - break; - } - if (ret == 0) { - positioned = true; - if (SNAP_TRACK) - snap_track(snap++, keyno, NULL, value); - } else { - positioned = false; - if (ret == WT_ROLLBACK && intxn) - goto deadlock; - testutil_assert(ret == 0 || - ret == WT_NOTFOUND || ret == WT_ROLLBACK); - } - break; case READ: ++tinfo->search; ret = read_row(cursor, key, value, keyno); @@ -771,15 +742,17 @@ skip_checkpoint: /* Pick the next checkpoint operation. */ case UPDATE: update_instead_of_insert: ++tinfo->update; + + /* Update the row. */ switch (g.type) { case ROW: - ret = row_update(tinfo, cursor, - key, value, keyno, positioned); + ret = row_update(tinfo, + cursor, key, value, keyno, positioned); break; case FIX: case VAR: - ret = col_update(tinfo, cursor, - key, value, keyno, positioned); + ret = col_update(tinfo, + cursor, key, value, keyno, positioned); break; } if (ret == 0) { @@ -1196,235 +1169,6 @@ col_reserve(WT_CURSOR *cursor, uint64_t keyno, bool positioned) } /* - * modify_build -- - * Generate a set of modify vectors, and copy what the final result - * should be into the value buffer. - */ -static bool -modify_build(TINFO *tinfo, - WT_CURSOR *cursor, WT_MODIFY *entries, int *nentriesp, WT_ITEM *value) -{ - static char repl[64]; - size_t len, size; - u_int i, nentries; - WT_ITEM *ta, _ta, *tb, _tb, *tmp; - - if (repl[0] == '\0') - memset(repl, '+', sizeof(repl)); - - ta = &_ta; - memset(ta, 0, sizeof(*ta)); - tb = &_tb; - memset(tb, 0, sizeof(*tb)); - - testutil_check(cursor->get_value(cursor, value)); - - /* - * Randomly select a number of byte changes, offsets and lengths. Start - * at least 11 bytes in so we skip the leading key information. - */ - nentries = mmrand(&tinfo->rnd, 1, MAX_MODIFY_ENTRIES); - for (i = 0; i < nentries; ++i) { - entries[i].data.data = repl; - entries[i].data.size = (size_t)mmrand(&tinfo->rnd, 0, 10); - entries[i].offset = (size_t)mmrand(&tinfo->rnd, 20, 40); - entries[i].size = (size_t)mmrand(&tinfo->rnd, 0, 10); - } - - /* - * Process the entries to figure out how large a buffer we need. This is - * a bit pessimistic because we're ignoring replacement bytes, but it's - * a simpler calculation. - */ - for (size = cursor->value.size, i = 0; i < nentries; ++i) { - if (entries[i].offset >= size) - size = entries[i].offset; - size += entries[i].data.size; - } - - /* If size is larger than the available buffer size, skip this one. */ - if (size >= value->memsize) - return (false); - - /* Allocate a pair of buffers. */ - ta->mem = dcalloc(size, sizeof(uint8_t)); - tb->mem = dcalloc(size, sizeof(uint8_t)); - - /* - * Use a brute-force process to create the value WiredTiger will create - * from this change vector. Don't do anything tricky to speed it up, we - * want to use a different algorithm from WiredTiger's, the idea is to - * bug-check the library. - */ - memcpy(ta->mem, value->data, value->size); - ta->size = value->size; - for (i = 0; i < nentries; ++i) { - /* Take leading bytes from the original, plus any gap bytes. */ - if (entries[i].offset >= ta->size) { - memcpy(tb->mem, ta->mem, ta->size); - if (entries[i].offset > ta->size) - memset((uint8_t *)tb->mem + ta->size, - '\0', entries[i].offset - ta->size); - } else - if (entries[i].offset > 0) - memcpy(tb->mem, ta->mem, entries[i].offset); - tb->size = entries[i].offset; - - /* Take replacement bytes. */ - if (entries[i].data.size > 0) { - memcpy((uint8_t *)tb->mem + tb->size, - entries[i].data.data, entries[i].data.size); - tb->size += entries[i].data.size; - } - - /* Take trailing bytes from the original. */ - len = entries[i].offset + entries[i].size; - if (ta->size > len) { - memcpy((uint8_t *)tb->mem + tb->size, - (uint8_t *)ta->mem + len, ta->size - len); - tb->size += ta->size - len; - } - testutil_assert(tb->size <= size); - - tmp = ta; - ta = tb; - tb = tmp; - } - - /* Copy the expected result into the value structure. */ - memcpy(value->mem, ta->mem, ta->size); - value->data = value->mem; - value->size = ta->size; - - free(ta->mem); - free(tb->mem); - - *nentriesp = (int)nentries; - return (true); -} - -/* - * row_modify -- - * Modify a row in a row-store file. - */ -static int -row_modify(TINFO *tinfo, WT_CURSOR *cursor, - WT_ITEM *key, WT_ITEM *value, uint64_t keyno, bool positioned) -{ - WT_DECL_RET; - WT_MODIFY entries[MAX_MODIFY_ENTRIES]; - int nentries; - - if (!positioned) { - key_gen(key, keyno); - cursor->set_key(cursor, key); - switch (ret = cursor->search(cursor)) { - case 0: - break; - case WT_CACHE_FULL: - case WT_ROLLBACK: - return (WT_ROLLBACK); - case WT_NOTFOUND: - return (WT_NOTFOUND); - default: - testutil_die(ret, - "row_modify: read row %" PRIu64 " by key", keyno); - } - } - - /* - * Generate a set of change vectors and copy the expected result into - * the value buffer. If the return value is non-zero, there wasn't a - * big enough value to work with, or for some reason we couldn't build - * a reasonable change vector. - */ - ret = WT_NOTFOUND; - if (modify_build(tinfo, cursor, entries, &nentries, value)) - ret = cursor->modify(cursor, entries, nentries); - switch (ret) { - case 0: - break; - case WT_CACHE_FULL: - case WT_ROLLBACK: - return (WT_ROLLBACK); - case WT_NOTFOUND: - return (WT_NOTFOUND); - default: - testutil_die(ret, - "row_modify: modify row %" PRIu64 " by key", keyno); - } - -#ifdef HAVE_BERKELEY_DB - if (!SINGLETHREADED) - return (0); - - bdb_update(key->data, key->size, value->data, value->size); -#endif - return (0); -} - -/* - * col_modify -- - * Modify a row in a column-store file. - */ -static int -col_modify(TINFO *tinfo, WT_CURSOR *cursor, - WT_ITEM *key, WT_ITEM *value, uint64_t keyno, bool positioned) -{ - WT_DECL_RET; - WT_MODIFY entries[MAX_MODIFY_ENTRIES]; - int nentries; - - if (!positioned) { - cursor->set_key(cursor, keyno); - switch (ret = cursor->search(cursor)) { - case 0: - break; - case WT_CACHE_FULL: - case WT_ROLLBACK: - return (WT_ROLLBACK); - case WT_NOTFOUND: - return (WT_NOTFOUND); - default: - testutil_die(ret, - "col_modify: read row %" PRIu64, keyno); - } - } - - /* - * Generate a set of change vectors and copy the expected result into - * the value buffer. If the return value is non-zero, there wasn't a - * big enough value to work with, or for some reason we couldn't build - * a reasonable change vector. - */ - ret = WT_NOTFOUND; - if (modify_build(tinfo, cursor, entries, &nentries, value)) - ret = cursor->modify(cursor, entries, nentries); - switch (ret) { - case 0: - break; - case WT_CACHE_FULL: - case WT_ROLLBACK: - return (WT_ROLLBACK); - case WT_NOTFOUND: - return (WT_NOTFOUND); - default: - testutil_die(ret, "col_modify: modify row %" PRIu64, keyno); - } - -#ifdef HAVE_BERKELEY_DB - if (!SINGLETHREADED) - return (0); - - key_gen(key, keyno); - bdb_update(key->data, key->size, value->data, value->size); -#else - (void)key; /* [-Wunused-variable] */ -#endif - return (0); -} - -/* * row_update -- * Update a row in a row-store file. */ diff --git a/test/suite/test_cursor12.py b/test/suite/test_cursor12.py deleted file mode 100644 index 827f37cfcef..00000000000 --- a/test/suite/test_cursor12.py +++ /dev/null @@ -1,165 +0,0 @@ -#!/usr/bin/env python -# -# Public Domain 2014-2017 MongoDB, Inc. -# Public Domain 2008-2014 WiredTiger, Inc. -# -# This is free and unencumbered software released into the public domain. -# -# Anyone is free to copy, modify, publish, use, compile, sell, or -# distribute this software, either in source code form or as a compiled -# binary, for any purpose, commercial or non-commercial, and by any -# means. -# -# In jurisdictions that recognize copyright laws, the author or authors -# of this software dedicate any and all copyright interest in the -# software to the public domain. We make this dedication for the benefit -# of the public at large and to the detriment of our heirs and -# successors. We intend this dedication to be an overt act of -# relinquishment in perpetuity of all present and future rights to this -# software under copyright law. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR -# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -# OTHER DEALINGS IN THE SOFTWARE. - -import wiredtiger, wttest -from wtscenario import make_scenarios - -# test_cursor12.py -# Test cursor modify call -class test_cursor12(wttest.WiredTigerTestCase): - types = [ - ('file', dict(uri='file:modify')), - ('lsm', dict(uri='lsm:modify')), - ('table', dict(uri='table:modify')), - ] - scenarios = make_scenarios(types) - - # Smoke-test the modify API. - def test_modify_smoke(self): - # List with original value, final value, and modifications to get - # there. - list = [ - { - 'o' : 'ABCDEFGH', # no operation - 'f' : 'ABCDEFGH', - 'mods' : [['', 0, 0]] - },{ - 'o' : 'ABCDEFGH', # no operation with offset - 'f' : 'ABCDEFGH', - 'mods' : [['', 4, 0]] - },{ - 'o' : 'ABCDEFGH', # rewrite beginning - 'f' : '--CDEFGH', - 'mods' : [['--', 0, 2]] - },{ - 'o' : 'ABCDEFGH', # rewrite end - 'f' : 'ABCDEF--', - 'mods' : [['--', 6, 2]] - },{ - 'o' : 'ABCDEFGH', # append - 'f' : 'ABCDEFGH--', - 'mods' : [['--', 8, 2]] - },{ - 'o' : 'ABCDEFGH', # append with gap - 'f' : 'ABCDEFGH\00\00--', - 'mods' : [['--', 10, 2]] - },{ - 'o' : 'ABCDEFGH', # multiple replacements - 'f' : 'A-C-E-G-', - 'mods' : [['-', 1, 1], ['-', 3, 1], ['-', 5, 1], ['-', 7, 1]] - },{ - 'o' : 'ABCDEFGH', # multiple overlapping replacements - 'f' : 'A-CDEFGH', - 'mods' : [['+', 1, 1], ['+', 1, 1], ['+', 1, 1], ['-', 1, 1]] - },{ - 'o' : 'ABCDEFGH', # multiple overlapping gap replacements - 'f' : 'ABCDEFGH\00\00--', - 'mods' : [['+', 10, 1], ['+', 10, 1], ['+', 10, 1], ['--', 10, 2]] - },{ - 'o' : 'ABCDEFGH', # shrink beginning - 'f' : '--EFGH', - 'mods' : [['--', 0, 4]] - },{ - 'o' : 'ABCDEFGH', # shrink middle - 'f' : 'AB--GH', - 'mods' : [['--', 2, 4]] - },{ - 'o' : 'ABCDEFGH', # shrink end - 'f' : 'ABCD--', - 'mods' : [['--', 4, 4]] - },{ - 'o' : 'ABCDEFGH', # grow beginning - 'f' : '--ABCDEFGH', - 'mods' : [['--', 0, 0]] - },{ - 'o' : 'ABCDEFGH', # grow middle - 'f' : 'ABCD--EFGH', - 'mods' : [['--', 4, 0]] - },{ - 'o' : 'ABCDEFGH', # grow end - 'f' : 'ABCDEFGH--', - 'mods' : [['--', 8, 0]] - },{ - 'o' : 'ABCDEFGH', # discard beginning - 'f' : 'EFGH', - 'mods' : [['', 0, 4]] - },{ - 'o' : 'ABCDEFGH', # discard middle - 'f' : 'ABGH', - 'mods' : [['', 2, 4]] - },{ - 'o' : 'ABCDEFGH', # discard end - 'f' : 'ABCD', - 'mods' : [['', 4, 4]] - },{ - 'o' : 'ABCDEFGH', # overlap the end and append - 'f' : 'ABCDEF--XX', - 'mods' : [['--XX', 6, 2]] - },{ - 'o' : 'ABCDEFGH', # overlap the end with incorrect size - 'f' : 'ABCDEFG01234567', - 'mods' : [['01234567', 7, 2000]] - } - ] - - self.session.create(self.uri, 'key_format=S,value_format=u') - cursor = self.session.open_cursor(self.uri, None, None) - - # For each test in the list, set the original value, apply modifications - # in order, then confirm the final state. - for i in list: - cursor['ABC'] = i['o'] - - mods = [] - for j in i['mods']: - mod = wiredtiger.Modify(j[0], j[1], j[2]) - mods.append(mod) - - cursor.set_key('ABC') - cursor.modify(mods) - self.assertEquals(str(cursor['ABC']), i['f']) - - # Check that modify returns not-found after a delete. - def test_modify_delete(self): - self.session.create(self.uri, 'key_format=S,value_format=u') - cursor = self.session.open_cursor(self.uri, None, None) - cursor['ABC'] = 'ABCDEFGH' - cursor.set_key('ABC') - cursor.remove() - - mods = [] - mod = wiredtiger.Modify('ABCD', 3, 3) - mods.append(mod) - - cursor.set_key('ABC') - #self.assertEqual(cursor.modify(mods), wiredtiger.WT_NOTFOUND) - self.assertRaises( - wiredtiger.WiredTigerError, lambda:cursor.modify(mods)) - -if __name__ == '__main__': - wttest.run() |