diff --git a/include/assoc.h b/include/assoc.h index 937101ecfa2c9a2836ff0e5ddb270ed566f0275b..85a00f253f7960a882c0425fade9f3659845dcfa 100644 --- a/include/assoc.h +++ b/include/assoc.h @@ -55,7 +55,7 @@ struct mh_i32ptr_node_t { */ #define mh_name _i64ptr struct mh_i64ptr_node_t { - u64 key; + uint64_t key; void *val; }; diff --git a/include/log_io.h b/include/log_io.h index 8a3cf2fc8a7efaba593f2cadee2149c2e8d2bd2c..52dfde242847812ebb8792afafbfed755349a8b9 100644 --- a/include/log_io.h +++ b/include/log_io.h @@ -128,7 +128,7 @@ static inline struct header_v11 *header_v11(const char *t) } static inline void -header_v11_fill(struct header_v11 *header, u64 lsn, size_t data_len) +header_v11_fill(struct header_v11 *header, int64_t lsn, size_t data_len) { header->lsn = lsn; header->tm = ev_now(); @@ -142,14 +142,14 @@ struct row_v11 { log_magic_t marker; struct header_v11 header; uint16_t tag; - u64 cookie; + uint64_t cookie; uint8_t data[]; } __attribute__((packed)); void -row_v11_fill(struct row_v11 *row, u64 lsn, uint16_t tag, u64 cookie, - const char *metadata, size_t metadata_len, const char - *data, size_t data_len); +row_v11_fill(struct row_v11 *row, int64_t lsn, uint16_t tag, + uint64_t cookie, const char *metadata, size_t metadata_len, + const char *data, size_t data_len); static inline size_t row_v11_size(struct row_v11 *row) diff --git a/include/recovery.h b/include/recovery.h index 62c4082a35710663c770009105296be4e886389d..1762997af1dc7bc69d7c1f34213c450fbf11b224 100644 --- a/include/recovery.h +++ b/include/recovery.h @@ -71,7 +71,7 @@ struct wal_watcher; struct remote { struct sockaddr_in addr; struct fiber *reader; - u64 cookie; + uint64_t cookie; ev_tstamp recovery_lag, recovery_last_update_tstamp; }; @@ -122,7 +122,7 @@ void recover_snap(struct recovery_state *); void recover_existing_wals(struct recovery_state *); void recovery_follow_local(struct recovery_state *r, ev_tstamp wal_dir_rescan_delay); void recovery_finalize(struct recovery_state *r); -int wal_write(struct recovery_state *r, int64_t lsn, u64 cookie, +int wal_write(struct recovery_state *r, int64_t lsn, uint64_t cookie, uint16_t op, const char *data, u32 len); void recovery_setup_panic(struct recovery_state *r, bool on_snap_error, bool on_wal_error); diff --git a/include/salloc.h b/include/salloc.h index 83d59605e3e731f83f10e06d2f0293b1916d0413..4b7e5e97e427490dcb1a07a1517c59399dd4cef2 100644 --- a/include/salloc.h +++ b/include/salloc.h @@ -30,7 +30,7 @@ */ #include <stddef.h> #include <stdbool.h> -#include "tarantool/util.h" /* for u64 */ +#include "tarantool/util.h" /* for uint64_t */ struct tbuf; diff --git a/include/tarantool/util.h b/include/tarantool/util.h index cb9a30219024fd005f492e1b50b50d66d59531c8..8b656b3549775c861160b9c0a7dcfd79040b9640 100644 --- a/include/tarantool/util.h +++ b/include/tarantool/util.h @@ -122,7 +122,6 @@ strindex(const char **haystack, const char *needle, uint32_t hmax); #endif typedef uint32_t u32; -typedef uint64_t u64; typedef int32_t i32; #define CRLF "\n" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8781917490985a11cd49103f5821d4d5bb14d12e..fe000c8f2b4abfb3e744f0c6301f375784370ae9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -37,7 +37,7 @@ add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/src/memcached-grammar.cc -o src/memcached-grammar.cc DEPENDS ${CMAKE_SOURCE_DIR}/src/memcached-grammar.rl) -add_custom_target(generate_admin_m DEPENDS ${CMAKE_SOURCE_DIR}/src/admin.cc) +add_custom_target(generate_admin_cc DEPENDS ${CMAKE_SOURCE_DIR}/src/admin.cc) add_custom_target(generate_memcached_grammar_cc DEPENDS ${CMAKE_SOURCE_DIR}/src/memcached-grammar.cc) @@ -206,7 +206,7 @@ function(tarantool_module mod) add_library(lt${mod} STATIC ${recompiled_sources}) set_target_properties(lt${mod} PROPERTIES COMPILE_FLAGS "-DTARANTOOL_CONFIG='<cfg/tarantool_${mod}_cfg.h>'") - add_dependencies(lt${mod} generate_headers generate_admin_m generate_memcached_grammar_m build_bundled_libs) + add_dependencies(lt${mod} generate_headers generate_admin_cc generate_memcached_grammar_cc build_bundled_libs) target_link_libraries(tarantool_${mod} lt${mod} ${common_libraries}) diff --git a/src/box/space.cc b/src/box/space.cc index 90b6e3f3eb00b082b646b443dbf278fd8be52c3c..c61d54215f04602d35962adf3633d232d47c00ae 100644 --- a/src/box/space.cc +++ b/src/box/space.cc @@ -190,11 +190,11 @@ space_validate_tuple(struct space *sp, struct tuple *new_tuple) if (sp->field_types[fieldno] == NUM) { if (len != sizeof(u32)) tnt_raise(ClientError, ER_KEY_FIELD_TYPE, - "u32"); + "NUM"); } else if (sp->field_types[fieldno] == NUM64) { - if (len != sizeof(u64)) + if (len != sizeof(uint64_t)) tnt_raise(ClientError, ER_KEY_FIELD_TYPE, - "u64"); + "NUM64"); } fieldno++; } diff --git a/src/box/tuple.cc b/src/box/tuple.cc index 06837570330a1b95f44fb7a72444d4987debd4a9..0be7073a4f04be334179118a150fef830afd4c79 100644 --- a/src/box/tuple.cc +++ b/src/box/tuple.cc @@ -146,7 +146,7 @@ print_field(struct tbuf *buf, const char *field, uint32_t len) tbuf_printf(buf, "%u", *(u32 *)field); break; case 8: - tbuf_printf(buf, "%" PRIu64, *(u64 *)field); + tbuf_printf(buf, "%" PRIu64, *(uint64_t *)field); break; default: tbuf_printf(buf, "'"); diff --git a/src/log_io.cc b/src/log_io.cc index 1e02b84ccbe7cc3da71dfd74c2fc4ccb4fca7015..40db69f4df8972ce54b6a7f89e269b54d006d2c6 100644 --- a/src/log_io.cc +++ b/src/log_io.cc @@ -53,7 +53,7 @@ header_v11_sign(struct header_v11 *header) } void -row_v11_fill(struct row_v11 *row, u64 lsn, uint16_t tag, u64 cookie, +row_v11_fill(struct row_v11 *row, int64_t lsn, uint16_t tag, uint64_t cookie, const char *metadata, size_t metadata_len, const char *data, size_t data_len) { diff --git a/src/lua/init.cc b/src/lua/init.cc index 3b6265bb7f60fddb893c1e51c0d99a1386656e21..6892af4b491e76bb23c406f38d5b899c100f08b8 100644 --- a/src/lua/init.cc +++ b/src/lua/init.cc @@ -191,7 +191,7 @@ lbox_time(struct lua_State *L) static int lbox_time64(struct lua_State *L) { - luaL_pushnumber64(L, (u64) ( ev_now() * 1000000 + 0.5 ) ); + luaL_pushnumber64(L, (uint64_t) ( ev_now() * 1000000 + 0.5 ) ); return 1; } diff --git a/src/memcached-grammar.cc b/src/memcached-grammar.cc index a4f5c6e3065cb6c0f09b5a17dbc42f6d313fd72f..2fa6ed2b1fecdc135f260b090ab9c82559259bc1 100644 --- a/src/memcached-grammar.cc +++ b/src/memcached-grammar.cc @@ -51,7 +51,7 @@ memcached_dispatch(struct ev_io *coio, struct iobuf *iobuf) const char *key; bool append, show_cas; int incr_sign; - u64 cas, incr; + uint64_t cas, incr; u32 flags, exptime, bytes; bool noreply = false; char *data = NULL; @@ -716,7 +716,7 @@ case 12: struct tbuf *b; const char *field; uint32_t field_len; - u64 value; + uint64_t value; key = tbuf_read_field(keys); struct tuple *tuple = memcached_find(key); @@ -780,7 +780,7 @@ case 12: struct tbuf *b; const char *field; uint32_t field_len; - u64 value; + uint64_t value; key = tbuf_read_field(keys); struct tuple *tuple = memcached_find(key); @@ -846,7 +846,7 @@ case 12: struct tbuf *b; const char *field; uint32_t field_len; - u64 value; + uint64_t value; key = tbuf_read_field(keys); struct tuple *tuple = memcached_find(key); diff --git a/src/memcached-grammar.rl b/src/memcached-grammar.rl index 25da667cdc5910ff24559b75c0c05052555f2188..35343c64308ac8e19a75cf40a90f92b64cc26707 100644 --- a/src/memcached-grammar.rl +++ b/src/memcached-grammar.rl @@ -42,7 +42,7 @@ memcached_dispatch(struct ev_io *coio, struct iobuf *iobuf) const char *key; bool append, show_cas; int incr_sign; - u64 cas, incr; + uint64_t cas, incr; u32 flags, exptime, bytes; bool noreply = false; char *data = NULL; @@ -125,7 +125,7 @@ memcached_dispatch(struct ev_io *coio, struct iobuf *iobuf) struct tbuf *b; const char *field; uint32_t field_len; - u64 value; + uint64_t value; key = tbuf_read_field(keys); struct tuple *tuple = memcached_find(key); diff --git a/src/memcached.cc b/src/memcached.cc index d311241986c36f5a2107a0f4a10198508144f9bd..5907198961d77ec8153fff8d98e66289c3a6d5f1 100644 --- a/src/memcached.cc +++ b/src/memcached.cc @@ -69,13 +69,13 @@ static struct iterator *memcached_it; struct meta { u32 exptime; u32 flags; - u64 cas; + uint64_t cas; } __packed__; -static u64 +static uint64_t memcached_natoq(const char *start, const char *end) { - u64 num = 0; + uint64_t num = 0; while (start < end) { uint8_t code = *start++; num = num * 10 + (code - '0'); @@ -124,7 +124,7 @@ memcached_store(const char *key, u32 exptime, u32 flags, u32 bytes, { u32 box_flags = 0; u32 field_count = 4; - static u64 cas = 42; + static uint64_t cas = 42; struct meta m; struct tbuf *req = tbuf_new(fiber->gc_pool); @@ -203,16 +203,16 @@ memcached_is_numeric(const char *field, u32 value_len) } static struct stats { - u64 total_items; + uint64_t total_items; u32 curr_connections; u32 total_connections; - u64 cmd_get; - u64 cmd_set; - u64 get_hits; - u64 get_misses; - u64 evictions; - u64 bytes_read; - u64 bytes_written; + uint64_t cmd_get; + uint64_t cmd_set; + uint64_t get_hits; + uint64_t get_misses; + uint64_t evictions; + uint64_t bytes_read; + uint64_t bytes_written; } stats; struct salloc_stat_memcached_cb_ctx { @@ -257,7 +257,7 @@ memcached_print_stats(struct obuf *out) tbuf_printf(buf, "STAT evictions %" PRIu64 "\r\n", stats.evictions); tbuf_printf(buf, "STAT bytes_read %" PRIu64 "\r\n", stats.bytes_read); tbuf_printf(buf, "STAT bytes_written %" PRIu64 "\r\n", stats.bytes_written); - tbuf_printf(buf, "STAT limit_maxbytes %" PRIu64 "\r\n", (u64)(cfg.slab_alloc_arena * (1 << 30))); + tbuf_printf(buf, "STAT limit_maxbytes %" PRIu64 "\r\n", (uint64_t)(cfg.slab_alloc_arena * (1 << 30))); tbuf_printf(buf, "STAT threads 1\r\n"); tbuf_printf(buf, "END\r\n"); obuf_dup(out, buf->data, buf->size); diff --git a/src/palloc.cc b/src/palloc.cc index c1b009eca7201dde58b1d5f9541849bb8ae3f9ea..6d6f5ec39f7ff8ad31e0799929e5b36b90edf63f 100644 --- a/src/palloc.cc +++ b/src/palloc.cc @@ -455,8 +455,8 @@ palloc_stat(struct tbuf *buf) ", free_chunks: %- 6i, busy_chunks: %- 6i }" CRLF, clazz->allocated_size, free_chunks, clazz->chunks_count - free_chunks); } - u64 palloc_total = 0; - u64 palloc_used = 0; + uint64_t palloc_total = 0; + uint64_t palloc_used = 0; SLIST_FOREACH(pool, &pools, link) { SLIST_FOREACH(chunk, &pool->chunks, busy_link) { palloc_total += chunk->size; diff --git a/src/recovery.cc b/src/recovery.cc index 4882ae336046975066f8c199ac7713f9b1172220..dee9f8cec6c337d4403834a1a983ba4230fbb379 100644 --- a/src/recovery.cc +++ b/src/recovery.cc @@ -100,7 +100,7 @@ struct recovery_state *recovery_state; -static const u64 snapshot_cookie = 0; +static const uint64_t snapshot_cookie = 0; const char *wal_mode_STRS[] = { "none", "write", "fsync", "fsync_delay", NULL }; @@ -943,7 +943,8 @@ wal_writer_pop(struct wal_writer *writer, struct wal_fifo *input) * @return 0 in case of success, -1 on error. */ static int -wal_opt_rotate(struct log_io **wal, int rows_per_wal, struct log_dir *dir, u64 lsn) +wal_opt_rotate(struct log_io **wal, int rows_per_wal, struct log_dir *dir, + int64_t lsn) { struct log_io *l = *wal, *wal_to_close = NULL; @@ -1105,7 +1106,7 @@ wal_writer_thread(void *worker_args) * to be written to disk and wait until this task is completed. */ int -wal_write(struct recovery_state *r, int64_t lsn, u64 cookie, +wal_write(struct recovery_state *r, int64_t lsn, uint64_t cookie, uint16_t op, const char *row, u32 row_len) { say_debug("wal_write lsn=%" PRIi64, lsn); diff --git a/test/big/hash.result b/test/big/hash.result index 1734cc3de78fc9df1f894d1266f36c53b15695d5..6ed4f4de56e5b290a058e9a90c02ef66e1793578 100644 --- a/test/big/hash.result +++ b/test/big/hash.result @@ -32,7 +32,7 @@ lua box.space[10]:insert(3, 'value1 v1.0', 'value2 v1.0') lua box.space[10]:insert('invalid key', 'value1 v1.0', 'value2 v1.0') --- -error: 'Supplied key field type does not match index type: expected u32' +error: 'Supplied key field type does not match index type: expected NUM' ... #-----------------------------------------------------------------------------# @@ -59,7 +59,7 @@ lua box.space[10]:replace(2, 'value1 v1.43', 'value2 1.92') lua box.space[10]:replace('invalid key', 'value1 v1.0', 'value2 v1.0') --- -error: 'Supplied key field type does not match index type: expected u32' +error: 'Supplied key field type does not match index type: expected NUM' ... #-----------------------------------------------------------------------------# @@ -177,23 +177,23 @@ lua box.space[11]:insert(3ULL, 'value1 v1.0', 'value2 v1.0') lua box.space[11]:insert(100, 'value1 v1.0', 'value2 v1.0') --- -error: 'Supplied key field type does not match index type: expected u64' +error: 'Supplied key field type does not match index type: expected NUM64' ... lua box.space[11]:insert(101, 'value1 v1.0', 'value2 v1.0') --- -error: 'Supplied key field type does not match index type: expected u64' +error: 'Supplied key field type does not match index type: expected NUM64' ... lua box.space[11]:insert(102, 'value1 v1.0', 'value2 v1.0') --- -error: 'Supplied key field type does not match index type: expected u64' +error: 'Supplied key field type does not match index type: expected NUM64' ... lua box.space[11]:insert(103, 'value1 v1.0', 'value2 v1.0') --- -error: 'Supplied key field type does not match index type: expected u64' +error: 'Supplied key field type does not match index type: expected NUM64' ... lua box.space[11]:insert('invalid key', 'value1 v1.0', 'value2 v1.0') --- -error: 'Supplied key field type does not match index type: expected u64' +error: 'Supplied key field type does not match index type: expected NUM64' ... #-----------------------------------------------------------------------------# @@ -220,19 +220,19 @@ lua box.space[11]:replace(2ULL, 'value1 v1.43', 'value2 1.92') lua box.space[11]:replace(3, 'value1 v1.31', 'value2 1.12') --- -error: 'Supplied key field type does not match index type: expected u64' +error: 'Supplied key field type does not match index type: expected NUM64' ... lua box.space[11]:replace(1, 'value1 v1.32', 'value2 1.72') --- -error: 'Supplied key field type does not match index type: expected u64' +error: 'Supplied key field type does not match index type: expected NUM64' ... lua box.space[11]:replace(2, 'value1 v1.43', 'value2 1.92') --- -error: 'Supplied key field type does not match index type: expected u64' +error: 'Supplied key field type does not match index type: expected NUM64' ... lua box.space[11]:replace('invalid key', 'value1 v1.0', 'value2 v1.0') --- -error: 'Supplied key field type does not match index type: expected u64' +error: 'Supplied key field type does not match index type: expected NUM64' ... #-----------------------------------------------------------------------------#