Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nicktorwald/gh 52 sql tests #7

Closed
wants to merge 21 commits into from
Closed

Conversation

nicktorwald
Copy link
Owner

No description provided.

nicktorwald and others added 18 commits March 30, 2019 08:49
There are two regressions from 9471340 ('Add CompletionStage support in
TarantoolClient'):

* TarantoolClientImpl#complete() uses a response code instead of a
  request code to determine whether an operation was SQL or noSQL.
* SqlProtoUtils#readSqlResult() incorrectly parses a result with
  multiple rows.

The former one affects TarantoolClientImpl, the latter both
TarantoolClientImpl and TarantoolConnection. JDBC is not affected.

Fixes: tarantool#141
According to tarantool/tarantool#3505 and tarantool/tarantool#3506
'box.sql.execute' is no longer supported in new Tarantool releases.

Fix AbstractJdbcIT class which used the obsolete expression. Now SQL
init scripts are performed by 'box.execute' statement superseded old
version.

Fixes: tarantool#149
See also: tarantool/tarantool#3505, tarantool/tarantool#3506
Configure Checkstyle plugin for Maven. Add base rules to be checked.
Default Google's style was taken as a base for our rules (see,
http://checkstyle.sourceforge.net/google_style.html). Hoverer, some of
them were changed according to our own style vision or current code
base:
- require a new line at the end of file;
- line length must be shorter than 120 symbols;
- indentation sizes are changed;
- relax JavaDoc restrictions;
- import order is adapted for our fits;
- add exceptions for abbreviation rules (SQL,JDBC,URI,URL);
- most of operator signs must be at the same line;
- other misc.

Add a new travis stage to perform a fail-fast code checkstyle.

Move test resources to appropriate folders.
Add missed implementation of Wrapper interface for SQLDatabaseMetadata,
SQLResultSet, and SQL ResultSetMetaData classes.

Closes: tarantool#73
The current implementation lacks of timeout support because it would
require at least Statement.setQueryTimeout() and Statement.cancel().
This will be implemented in the scope of tarantool#155.

Closes: tarantool#75
Add a proper behaviour when Connection.prepareStatement,
Statement.execute, and Statement.executeUpdate are called with the
Statement.NO_GENERATED_KEYS flag.

Return an empty generated keys when the Statement.NO_GENERATED_KEYS is
set as a special case of a generated keys absence.

Fixes: tarantool#78
Add support for nullsAreSortedLow as a default sorting which is provided
by Tarantool DB.

Fixes: tarantool#120
Provide support for FORWARD_ONLY and INSENSITIVE scroll types. Now
statements as well as theirs resultSets can be built using a forward
only iterator or full implemented insensitive iterator. To achieve this
iteration logic was extracted into two separate classes to support two
scroll types respectively. This is a cross-cutting support through
SQLMetadata, SQLConnection, SQL(Prepared)Statement, SQLResultSet.

Add support for READ_ONLY concurrency level for a result set.

Extend SQLStates constants in scope of cursors and query execution.
0100E and 02000 for query results; 24000 for cursor iteration support.

Add missed implementation of a closing for SQLStatement and
SQLResultSet.

Deprecate JDBCBridge. This redundant class should be removed completely
in scope of another task. Mapping of field labels was moved to
SQLResultSet.

Closes: tarantool#85, tarantool#86
Affects: tarantool#119, tarantool#108
A state of a client is a set of the following flags: {READING, WRITING,
RECONNECT, CLOSED}. Let's name a state when no flags are set
UNINITIALIZED.

A reader thread sets READING, performs reading until an error or an
interruption, drops READING and tries to trigger reconnection (if a
state allows, see below). A writer do quite same things, but with the
WRITING flag. The key point here is that a reconnection is triggered
from a reader/writer thread and only when certain conditions are met.

The prerequisite to set RECONNECT and signal (unpark) a connector thread
is that a client has UNINITIALIZED state.

There are several problems here:

- Say, a reader stalls a bit after dropping READING, then a writer drops
WRITING and trigger reconnection. Then reader wokes up and set RECONNECT
again.

- Calling unpark() N times for a connector thread when it is alive
doesn't lead to skipping next N park() calls, so the problem above is
not just about extra reconnection, but lead the connector thread to be
stuck.

- Say, a reader stalls just before setting READING. A writer is hit by
an IO error and triggers reconnection (set RECONNECT, unpark connector).
Then the reader wakes up and set READING+RECONNECT state that disallows
a connector thread to proceed further (it expects pure RECONNECT). Even
when the reader drops READING it will not wake up (unpark) the connector
thread, because RECONNECT was already set (state is not UNINITIALIZED).

This commit introduces several changes that eliminate the problems
above:

- Use ReentrantLock + Condition instead of park() / unpark() to never
miss signals to reconnect, does not matter whether a connector is
parked.

- Ensure a reader and a writer threads from one generation (that are
created on the same reconnection iteration) triggers reconnection once.

- Hold RECONNECT state most of time a connector works (while acquiring
a new socket, connecting and reading Tarantool greeting) and prevent to
set READING/WRITING while RECONNECT is set.

- Ensure a new reconnection iteration will start only after old reader
and old writer threads exit (because we cannot receive a reconnection
signal until we send it).

Fixes: tarantool#142
Affects: tarantool#34, tarantool#136
Refactor SocketChannelProvider implementations. Now we have two
SingleSocketChannelProviderImpl and RoundRobinSocketProviderImpl used by
simple and cluster clients respectively. To achieve this a
BaseSocketChannelProvider was extracted.

Add a service discovery implementation based on a Tarantool stored
procedure which is called to obtain a new list of cluster nodes.

Integrate service discovery and current cluster client. The client now
is aware of potential nodes changing using a configurable background job
which periodically checks whether node addresses have changed. If so
the client refreshes the RoundRobinSocketProviderImpl and replaces old
nodes by new ones. It also requires some additional effort in case of
missing the current node in the list. We need to reconnect to another
node as soon as possible with a minimal delay between client requests.
To achieve this we currently try to catch a moment when the requests in
progress have been accomplished and we can finish reconnection process.

Closes: tarantool#34
See also: tarantool#142
Add missed checks on methods of the closed connection.

Closes: tarantool#72
Affects: tarantool#119, tarantool#74
Add await-versions of start/stop commands for TarantoolControl class.
Improve the waiting process with an extra monitoring PID of a running
Tarantool-instance using terminal kill -0 command

Fixes: tarantool#164
Added java-8 (LTS) and java-12 (most recent) JDKs, removed openjdk10
(EOL) and oraclejdk11.

The idea is to test against widely used JDKs (LTS ones) and also against
a most recent JDK (to catch possible problems with new versions of java
early).

OracleJDK is built from OpenJDK starting from java-7, so there is no
much need to test against it.
@nicktorwald nicktorwald force-pushed the nicktorwald/gh-52-sql-tests branch from b028c8b to 8445221 Compare May 15, 2019 19:40
Relax a socket provider contract. Now socket provider can throw a
transient error and the client will try to obtain a socket again instead
of being closed.

Make built-in socket providers configurable. Now the client can set
retries count and connection timeout for providers.

Update README doc im scope of new socket provider contract.

Closes: tarantool#167
Follows on: tarantool#144
@nicktorwald nicktorwald force-pushed the nicktorwald/gh-52-sql-tests branch 3 times, most recently from e5e576a to 9e64263 Compare May 17, 2019 12:10
@nicktorwald nicktorwald force-pushed the nicktorwald/gh-52-sql-tests branch 2 times, most recently from 0ec3b40 to c4bca4f Compare May 17, 2019 13:05
- Add new CI targets for the following TNT versions: 1.9, 1.10, 2x,
  and 2.2 against JDKs versions 8, 11, and 12.
- Add assume-style checks to skip Tarantool version incompatible tests.
- Update testing tools versions in POM.
- Update 'Building' section of README file how to run test w\o SQL part.

Closes: tarantool#52, tarantool#143
@nicktorwald nicktorwald force-pushed the nicktorwald/gh-52-sql-tests branch from c4bca4f to e412044 Compare May 17, 2019 13:18
@nicktorwald nicktorwald deleted the nicktorwald/gh-52-sql-tests branch May 20, 2019 08:12
nicktorwald added a commit that referenced this pull request Jul 1, 2019
Now client keeps actual schema metadata and sends schemaId header to be
checked against current Tarantool schema version. If client version
mismatches DB version client does schema reloading in the background.

Client operation interface was reworked in scope of support not only
number identifiers for spaces and indexes but also their string names.

Closes: #7, tarantool#137
nicktorwald added a commit that referenced this pull request Jul 1, 2019
Now client keeps actual schema metadata and sends schemaId header to be
checked against current Tarantool schema version. If client version
mismatches DB version client does schema reloading in the background.

Client operation interface was reworked in scope of support not only
number identifiers for spaces and indexes but also their string names.

Closes: #7, tarantool#137
nicktorwald added a commit that referenced this pull request Jul 1, 2019
Now client keeps actual schema metadata and sends schemaId header to be
checked against current Tarantool schema version. If client version
mismatches DB version client does schema reloading in the background.

Client operation interface was reworked in scope of support not only
number identifiers for spaces and indexes but also their string names.

Closes: #7, tarantool#137
nicktorwald added a commit that referenced this pull request Jul 1, 2019
Now client keeps actual schema metadata and sends schemaId header to be
checked against current Tarantool schema version. If client version
mismatches DB version client does schema reloading in the background.

Client operation interface was reworked in scope of support not only
number identifiers for spaces and indexes but also their string names.

Closes: #7, tarantool#137
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants