Skip to content

Commit

Permalink
System Versioning pre0.12
Browse files Browse the repository at this point in the history
Merge remote-tracking branch 'origin/archive/2017-10-17' into 10.3
  • Loading branch information
midenok committed Nov 6, 2017
2 parents 835cbbc + ce66d5b commit d8d7251
Show file tree
Hide file tree
Showing 354 changed files with 20,614 additions and 1,637 deletions.
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
*-t
*.ctest
*.reject
*.orig
*.spec
*.bak
*.dgcov
*.rpm
.*.swp
.#*
.vimrc
.editorconfig
.kateconfig
*.kdev4
*.ninja
.ninja_*
.gdb_history
Expand Down Expand Up @@ -494,3 +500,7 @@ UpgradeLog*.htm

# Microsoft Fakes
FakesAssemblies/

compile_commands.json
.clang-format
.kscope/
86 changes: 86 additions & 0 deletions BUILD/capture_warnings.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
#!/bin/bash
warn_path=$1
warn_mode=$2 # 'late', 'early' or 'both'
shift 2

warn_file="$warn_path/compile.warnings"
suppress_file="$warn_path/suppress.warnings"

# suppress_warnings:
#
# 1. treat STDIN as sequence of warnings (w) delimited by ^~~~... lines
#
# 2. sanitize each w to matchable m:
# a. ignore 'In file included from' lines;
# b. protect BRE chars;
# c. ignore text coords (NNN:NNN);
# d. convert multiline to X-delimited single line.
#
# 3. match sanitized m against X-delimited suppress.warnings:
# if match not found print w to STDOUT.

suppress_warnings()
{
[ -f "$suppress_file" ] || {
cat
return
}
[ -z "$suppress_file" ] && {
cat > /dev/null
return
}
local m w from
IFS=""
while read -r l
do
w="$w$l"$'\n'

[[ $l =~ ^"In file included from " ]] && {
from=1
continue
}

[[ $from && $l =~ ^[[:space:]]+"from " ]] &&
continue

unset from

if [[ $l =~ ^[[:space:]]*~*\^~*$ ]]
then
cat "$suppress_file" | tr '\n' 'X' | /bin/grep -Gq "$m" ||
echo "$w"
unset m w
else
# Protect BRE metacharacters \.[*^$
l=${l//\\/\\\\}
l=${l//./\\.}
l=${l//[/\\[}
l=${l//-/\\-}
l=${l//\*/\\*}
l=${l//^/\\^}
l=${l//\$/\\\$}
# replace text coords line:char with BRE wildcard
[[ $l =~ ^(.*:)[[:digit:]]+:[[:digit:]]+(.*)$ ]] &&
l=${BASH_REMATCH[1]}[[:digit:]]\\+:[[:digit:]]\\+${BASH_REMATCH[2]}
m="$m$l"$'X'
fi
done
}

exec 3>&1
"$@" 2>&1 1>&3 | suppress_warnings | (
cmderr=`cat`

if [[ -n "$cmderr" ]]; then
if [[ "$cmderr" =~ error: ]]; then
echo "$cmderr" >&2
exit
fi
[[ "$warn_mode" != "late" ]] &&
echo "$cmderr" >&2
[[ "$warn_mode" != "early" && "$cmderr" =~ (warning|note): ]] &&
echo "$cmderr" >> "$warn_file"
fi
)

exit ${PIPESTATUS}
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -503,3 +503,5 @@ IF(NON_DISTRIBUTABLE_WARNING)
MESSAGE(WARNING "
You have linked MariaDB with GPLv3 libraries! You may not distribute the resulting binary. If you do, you will put yourself into a legal problem with Free Software Foundation.")
ENDIF()

INCLUDE(${CMAKE_SOURCE_DIR}/cmake/print_warnings.cmake)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ https://github.com/MariaDB/server
Code status:
------------

* [![tests status](https://secure.travis-ci.org/MariaDB/server.png?branch=10.2)](https://travis-ci.org/MariaDB/server) travis-ci.org (10.2 branch)
* [![tests status](https://travis-ci.org/tempesta-tech/mariadb.svg?branch=natsys%2Ftrunk)](https://travis-ci.org/tempesta-tech/mariadb) travis-ci.org (natsys/trunk)
37 changes: 37 additions & 0 deletions cmake/print_warnings.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
IF(NOT DEFINED WARN_MODE)
IF(CMAKE_BUILD_TYPE MATCHES "Debug")
SET(WARN_MODE "late")
ELSE()
SET(WARN_MODE "early")
ENDIF()
ENDIF()

IF(NOT WARN_MODE STREQUAL "early" AND
NOT WARN_MODE STREQUAL "late" AND
NOT WARN_MODE STREQUAL "both")
MESSAGE(FATAL_ERROR "Unknown WARN_MODE: expected 'early', 'late' or 'both'")
ENDIF()

SET_DIRECTORY_PROPERTIES(PROPERTIES RULE_LAUNCH_COMPILE
"bash ${CMAKE_SOURCE_DIR}/BUILD/capture_warnings.sh ${CMAKE_BINARY_DIR} ${WARN_MODE}")
SET_DIRECTORY_PROPERTIES(PROPERTY ADDITIONAL_MAKE_CLEAN_FILES
"${CMAKE_BINARY_DIR}/compile.warnings")
ADD_CUSTOM_TARGET(rm_compile.warnings ALL
COMMAND rm -f compile.warnings
WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
ADD_CUSTOM_TARGET(print_warnings ALL
COMMAND bash -c '[ -f compile.warnings ] && { echo "Warnings found:" \; cat compile.warnings \; echo "" \; } \; true'
DEPENDS mysqld rm_compile.warnings
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}")

IF(TARGET explain_filename-t)
ADD_DEPENDENCIES(print_warnings explain_filename-t)
ENDIF()

IF(TARGET mysql_client_test)
ADD_DEPENDENCIES(print_warnings mysql_client_test)
ENDIF()

IF(TARGET udf_example)
ADD_DEPENDENCIES(print_warnings udf_example)
ENDIF()
1 change: 1 addition & 0 deletions include/m_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ extern ulonglong strtoull(const char *str, char **ptr, int base);
#define STRING_WITH_LEN(X) (X), ((size_t) (sizeof(X) - 1))
#define USTRING_WITH_LEN(X) ((uchar*) X), ((size_t) (sizeof(X) - 1))
#define C_STRING_WITH_LEN(X) ((char *) (X)), ((size_t) (sizeof(X) - 1))
#define LEX_STRING_WITH_LEN(X) (X).str, (X).length

typedef struct st_mysql_const_lex_string LEX_CSTRING;

Expand Down
4 changes: 4 additions & 0 deletions include/my_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,10 @@ enum ha_base_keytype {
when only HA_STATUS_VARIABLE but it won't be used.
*/
#define HA_STATUS_VARIABLE_EXTRA 128U
/*
Treat empty table as empty (ignore HA_STATUS_TIME hack).
*/
#define HA_STATUS_OPEN 256U

/*
Errorcodes given by handler functions
Expand Down
1 change: 1 addition & 0 deletions include/my_sys.h
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,7 @@ extern int my_sync(File fd, myf my_flags);
extern int my_sync_dir(const char *dir_name, myf my_flags);
extern int my_sync_dir_by_file(const char *file_name, myf my_flags);
extern const char *my_get_err_msg(uint nr);
extern void my_error_as(uint nr1, uint nr2, myf MyFlags, ...);
extern int my_error_register(const char** (*get_errmsgs) (int nr),
uint first, uint last);
extern my_bool my_error_unregister(uint first, uint last);
Expand Down
11 changes: 11 additions & 0 deletions include/mysql_com.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,17 @@ enum enum_indicator_type
#define FIELD_FLAGS_COLUMN_FORMAT_MASK (3U << FIELD_FLAGS_COLUMN_FORMAT)
#define FIELD_IS_DROPPED (1U << 26) /* Intern: Field is being dropped */

#define VERS_SYS_START_FLAG (1 << 27) /* autogenerated column declared with
`generated always as row start`
(see II.a SQL Standard) */
#define VERS_SYS_END_FLAG (1 << 28) /* autogenerated column declared with
`generated always as row end`
(see II.a SQL Standard).*/
#define VERS_OPTIMIZED_UPDATE_FLAG (1 << 29) /* column that doesn't support
system versioning when table
itself supports it*/
#define HIDDEN_FLAG (1 << 31) /* hide from SELECT * */

#define REFRESH_GRANT (1ULL << 0) /* Refresh grant tables */
#define REFRESH_LOG (1ULL << 1) /* Start on new log file */
#define REFRESH_TABLES (1ULL << 2) /* close all tables */
Expand Down
2 changes: 2 additions & 0 deletions libmysqld/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
../sql/temporary_tables.cc
../sql/session_tracker.cc
../sql/proxy_protocol.cc
../sql/item_vers.cc
../sql/vtmd.cc
${GEN_SOURCES}
${MYSYS_LIBWRAP_SOURCE}
)
Expand Down
2 changes: 2 additions & 0 deletions mysql-test/disabled.def
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ innodb-wl5522-debug-zip : broken upstream
innodb_bug12902967 : broken upstream
file_contents : MDEV-6526 these files are not installed anymore
max_statement_time : cannot possibly work, depends on timing
ssl_ca : natsys: fails in mariadb-10.2.2
innodb_load_xa : natsys: requires external innodb plugin
4 changes: 2 additions & 2 deletions mysql-test/extra/binlog_tests/blackhole.test
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ drop table if exists t1,t2;
--enable_warnings

CREATE TABLE t1 (
Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
Period_ smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
Varor_period smallint(4) unsigned DEFAULT '0' NOT NULL
) ENGINE=blackhole;

INSERT INTO t1 VALUES (9410,9412);

select period from t1;
select period_ from t1;
select * from t1;
select t1.* from t1;

Expand Down
Loading

0 comments on commit d8d7251

Please sign in to comment.