Merge pull request #6378 from sfc-gh-sgwydir/mako-overwrite

Add "overwrite" operation to mako
This commit is contained in:
Kao Makino 2022-02-11 15:50:04 -08:00 committed by GitHub
commit cb8c5168df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 1 deletions

View File

@ -829,6 +829,10 @@ retryTxn:
} }
docommit = 1; docommit = 1;
break; break;
case OP_OVERWRITE:
rc = run_op_insert(transaction, keystr, valstr);
docommit = 1;
break;
case OP_CLEAR: case OP_CLEAR:
rc = run_op_clear(transaction, keystr); rc = run_op_clear(transaction, keystr);
docommit = 1; docommit = 1;
@ -1212,6 +1216,9 @@ void get_stats_file_name(char filename[], int worker_id, int thread_id, int op)
case OP_INSERTRANGE: case OP_INSERTRANGE:
strcat(filename, "INSERTRANGE"); strcat(filename, "INSERTRANGE");
break; break;
case OP_OVERWRITE:
strcat(filename, "OVERWRITE");
break;
case OP_CLEAR: case OP_CLEAR:
strcat(filename, "CLEAR"); strcat(filename, "CLEAR");
break; break;
@ -1502,7 +1509,7 @@ int worker_process_main(mako_args_t* args, int worker_id, mako_shmhdr_t* shm, pi
/*** let's party! ***/ /*** let's party! ***/
/* set up cluster and datbase for workder threads */ /* set up cluster and datbase for worker threads */
#if FDB_API_VERSION < 610 #if FDB_API_VERSION < 610
/* cluster */ /* cluster */
@ -1704,6 +1711,9 @@ int parse_transaction(mako_args_t* args, char* optarg) {
} else if (strncmp(ptr, "i", 1) == 0) { } else if (strncmp(ptr, "i", 1) == 0) {
op = OP_INSERT; op = OP_INSERT;
ptr++; ptr++;
} else if (strncmp(ptr, "o", 1) == 0) {
op = OP_OVERWRITE;
ptr++;
} else if (strncmp(ptr, "cr", 2) == 0) { } else if (strncmp(ptr, "cr", 2) == 0) {
op = OP_CLEARRANGE; op = OP_CLEARRANGE;
rangeop = 1; rangeop = 1;
@ -2107,6 +2117,8 @@ char* get_ops_name(int ops_code) {
return "INSERT"; return "INSERT";
case OP_INSERTRANGE: case OP_INSERTRANGE:
return "INSERTRANGE"; return "INSERTRANGE";
case OP_OVERWRITE:
return "OVERWRITE";
case OP_CLEAR: case OP_CLEAR:
return "CLEAR"; return "CLEAR";
case OP_SETCLEAR: case OP_SETCLEAR:

View File

@ -45,6 +45,7 @@ enum Operations {
OP_UPDATE, OP_UPDATE,
OP_INSERT, OP_INSERT,
OP_INSERTRANGE, OP_INSERTRANGE,
OP_OVERWRITE,
OP_CLEAR, OP_CLEAR,
OP_SETCLEAR, OP_SETCLEAR,
OP_CLEARRANGE, OP_CLEARRANGE,

View File

@ -138,6 +138,7 @@ Operation Types
- ``u`` Update (= GET followed by SET) - ``u`` Update (= GET followed by SET)
- ``i`` Insert (= SET with a new key) - ``i`` Insert (= SET with a new key)
- ``ir`` Insert Range (Sequential) - ``ir`` Insert Range (Sequential)
- ``o`` Overwrite (Blind write to existing keys)
- ``c`` CLEAR - ``c`` CLEAR
- ``sc`` SET & CLEAR - ``sc`` SET & CLEAR
- ``cr`` CLEAR RANGE - ``cr`` CLEAR RANGE