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

Refactor code in order to seperate all classes in single files instead of using nested classes. #2

Closed
hazelcast opened this issue Mar 23, 2012 · 1 comment
Labels
Source: Internal PR or issue was opened by an employee Type: Enhancement

Comments

@hazelcast
Copy link
Collaborator

What steps will reproduce the problem?

  1. Many classes used in Hazelcast are nested in other classes.

What is the expected output? What do you see instead?
Each class should have its own file. If classes are related to one super
class, create a new sub-package.

Please use labels and text to provide additional information.
This is only for coding style, but makes the source files much smaller and
easier to read.

Migrated from http://code.google.com/p/hazelcast/issues/detail?id=79


earlier comments

john.channing said, at 2009-06-05T21:41:00.000Z:

I agree. Currently there are some *very* large classes which are making the code difficult to understand and test.

oztalip said, at 2009-12-03T11:30:58.000Z:

We are not there yet but we are certainly making progress as classes like CMap, Record, MapMigrator are taken out of ConcurrentMapManager. I agree with the fact that ConcurrentMapManager is still huge.

nguba@rivet-studios.com said, at 2011-12-20T10:41:28.000Z:

I am not sure that readability is that much an issue. Testing however, is a big one. The better a projects supports testing (TDD) the better I like it :)

@mdogan
Copy link
Contributor

mdogan commented Aug 21, 2013

Code completely refactored in 3.0

@mdogan mdogan closed this as completed Aug 21, 2013
lburgazzoli pushed a commit to lburgazzoli/hazelcast that referenced this issue Jul 2, 2015
Set version to 3.6-HEP2-SNAPSHOT to avoid conflicts
metanet added a commit to metanet/hazelcast that referenced this issue Sep 13, 2018
Consider the following scenarios where client1 and client2 run on
different threads:

SCENARIO hazelcast#1:
- STEP 1: client1.lock();
  Lock is acquired by client1.
- STEP 2: client2.lock();
  Wait key is added to the lock for client2.
  After some time, client2.lock() call fails with operation timeout
- STEP3: client2.unlock();
  Fails with IllegalMonitorStateException because client2 is not
  holder of the lock. However, its wait key is still present.
  So the lock will be assigned to client2 when client1 releases it.

SCENARIO hazelcast#2:
- STEP 1: client1.lock();
  Lock is acquired by client1.
- STEP 2: client2.lock();
  Wait key is added to the lock for client2.
  After some time, client2.lock() call fails with operation timeout
- STEP 3: client2.lock();
  A new wait key is added to the lock for client2, because its second
  lock() call has a new invocation uuid.
- STEP 4: client1.unlock();
  The lock will be assigned to client2 for its first lock() call.
  Now the lock is held by client2 and its lock count is just 1.
  However, nothing will be done for its other wait key in the list.
- STEP 5: client2.unlock();
  Client2 releases the lock, but since it has another wait key
  in the list, it will get the lock again.

 We need two separate fixes to resolve these issues.

 First, unlock() call should cancel all pending wait keys
 of the lock endpoint, if the lock is not currently held by itself.

 Second, if a lock() call is received while there is another wait key
 by the same client, the first lock() call must be cancelled via
 deleting its wait key from the wait list of the lock.
metanet added a commit to metanet/hazelcast that referenced this issue Sep 21, 2018
Consider the following scenarios where client1 and client2 run on
different threads:

SCENARIO hazelcast#1:
- STEP 1: client1.lock();
  Lock is acquired by client1.
- STEP 2: client2.lock();
  Wait key is added to the lock for client2.
  After some time, client2.lock() call fails with operation timeout
- STEP3: client2.unlock();
  Fails with IllegalMonitorStateException because client2 is not
  holder of the lock. However, its wait key is still present.
  So the lock will be assigned to client2 when client1 releases it.

SCENARIO hazelcast#2:
- STEP 1: client1.lock();
  Lock is acquired by client1.
- STEP 2: client2.lock();
  Wait key is added to the lock for client2.
  After some time, client2.lock() call fails with operation timeout
- STEP 3: client2.lock();
  A new wait key is added to the lock for client2, because its second
  lock() call has a new invocation uuid.
- STEP 4: client1.unlock();
  The lock will be assigned to client2 for its first lock() call.
  Now the lock is held by client2 and its lock count is just 1.
  However, nothing will be done for its other wait key in the list.
- STEP 5: client2.unlock();
  Client2 releases the lock, but since it has another wait key
  in the list, it will get the lock again.

 We need two separate fixes to resolve these issues.

 First, unlock() call should cancel all pending wait keys
 of the lock endpoint, if the lock is not currently held by itself.

 Second, if a lock() call is received while there is another wait key
 by the same client, the first lock() call must be cancelled via
 deleting its wait key from the wait list of the lock.
@mmedenjak mmedenjak added the Source: Internal PR or issue was opened by an employee label Jan 28, 2020
petrpleshachkov referenced this issue in petrpleshachkov/hazelcast Jul 8, 2020
# This is the 1st commit message:

HD SQL: integrate concurrent off-heap B+tree index into the old query engine

* Introduced a global system property to enable global HD indexes;

* Introduced a new HDOrderedConcurrentIndexStore (based on BPlusTree) for global HD indexes
support;

* Fallback to the old partitioned HD index if the global indices are
disabled for HD.

Closes https://github.com/hazelcast/hazelcast-enterprise/issues/3652

# This is the commit message #2:

Disabled global lock for on-heap indexes

Otherwise the updates are not atomic
SeriyBg referenced this issue in SeriyBg/hazelcast Jul 9, 2021
Use SRV lookups for DNS resolving
SeriyBg referenced this issue in SeriyBg/hazelcast Jul 9, 2021
SeriyBg referenced this issue in SeriyBg/hazelcast Jul 9, 2021
Initial implementation of Hazelcast GCP Plugin
SeriyBg referenced this issue in SeriyBg/hazelcast Jul 9, 2021
SPI Should not report deallocated VMs
SeriyBg referenced this issue in SeriyBg/hazelcast Jul 9, 2021
Document Azure Configuration and Mention Template
blazember added a commit to blazember/hazelcast that referenced this issue Oct 1, 2021
WAN historically has problems when connecting to target endpoints that
are defined by hostnames and not IPs. This fix aims to provide a fix
for that.

The current behavior
--------------------
The initator member establishes a connection to the target by using the
known hostname instead of using the IP for the reasons like the hostname
is the configured one and the users expect to see that in the logs etc.
During establishing the connection, the source registers the new
connection as in progress, with the configured hostname. If the target
responds with an IP in the handshake response, the source can't find the
address in its in progress connection list and drops the handshake
response, despite the handshake in fact was successful.

The proposed change
-------------------
Since the handshake is successful in this case, we have a mapping
problem only. This change solves it by registering the in-progress
connection with all of the addresses that it resolve, which are:
- `host`: the configured host or IP
- `canonicalHost`: the hostname `host` is resolved to
- `ip`: the resolved IP address of `host`

These - at most - three addresses are all registered and linked
together, treating `host` as the primary one. When processing the
handshake, the below address lookup algorithm is followed where
`remoteAddress` is the address from the handshake response of the
target:

```
if remoteAddress is registered as in-progress then
  if remoteAddress is registered as primary then
    return remoteAddress

  for linkedAddress in remoteAddress.linkedAddresses
    if linkedAddress is registered as in-progress and it is primary then
      return linkedAddress // we return the configured host here

return null
```

With this algorithm we can mark the in-progress connection as connected
and WAN replication can start operating.

Limitation of the proposal
--------------------------
This proposal does not work if the target responds with an address that
can't be resolved to with the configured hostname on the source side.

Alternative option
------------------
Instead of connecting with the hostname, we can use the IP always. But
that would lead to harder to read configuration and it also can't be
used for DNS-based balancing (resolving the same hostname to different
IPs at different times).

Alternative option hazelcast#2
---------------------
We can register in-progress connections with a UUID and make that UUID
part of the handshake request and response. It requires more changes
though and most probably it incurs compatibility problems.
@blazember blazember mentioned this issue Oct 1, 2021
6 tasks
ldziedziul added a commit that referenced this issue May 11, 2023
Fixes: #24424
Fixes: https://hazelcast.atlassian.net/browse/HZ-2391 

Throws `SilentException` from `TaskletExecutionService to avoid
duplicated error logs`
Breaking changes (list specific methods/types/messages):

* API
* client protocol format
* serialized form
* snapshot format

Checklist:
- [x] Labels (`Team:`, `Type:`, `Source:`, `Module:`) and Milestone set
- [x] Label `Add to Release Notes` or `Not Release Notes content` set
- [x] Request reviewers if possible
- [x] Send backports/forwardports if fix needs to be applied to
past/future releases
- [x] New public APIs have `@Nonnull/@Nullable` annotations
- [x] New public APIs have `@since` tags in Javadoc

- Before:
```
13:22:16,136  INFO || - [TaskletExecutionService] hz.InsertJdbcSqlConnectorTest_upbeat_johnson.jet.blocking.thread-0 - [127.0.0.1]:5701 [dev] [5.3.0-SNAPSHOT] Exception in ProcessorTasklet{09d4-4eb6-8787-0001/Insert([table_o_f5aba5fe_3c5a_42b1_8976_7c5710d7e806])#0}
com.hazelcast.jet.JetException: org.h2.jdbc.JdbcBatchUpdateException: Unique index or primary key violation: "PRIMARY KEY ON PUBLIC.table_o_f5aba5fe_3c5a_42b1_8976_7c5710d7e806(id) ( /* key:0 */ 0, 'name-0')"; SQL statement:
INSERT INTO "table_o_f5aba5fe_3c5a_42b1_8976_7c5710d7e806" ( "id","name" )  VALUES (?, ?) [23505-214]
	at com.hazelcast.jet.impl.util.ExceptionUtil.peeledAndUnchecked(ExceptionUtil.java:142) ~[classes/:?]
	at com.hazelcast.jet.impl.util.ExceptionUtil.rethrow(ExceptionUtil.java:153) ~[classes/:?]
	at com.hazelcast.jet.impl.connector.WriteJdbcP.process(WriteJdbcP.java:234) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.ProcessorTasklet.lambda$processInbox$2f647568$2(ProcessorTasklet.java:490) ~[classes/:?]
	at com.hazelcast.jet.function.RunnableEx.run(RunnableEx.java:31) ~[classes/:?]
	at com.hazelcast.jet.impl.util.Util.doWithClassLoader(Util.java:533) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.ProcessorTasklet.processInbox(ProcessorTasklet.java:490) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.ProcessorTasklet.stateMachineStep(ProcessorTasklet.java:341) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.ProcessorTasklet.stateMachineStep(ProcessorTasklet.java:336) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.ProcessorTasklet.stateMachineStep(ProcessorTasklet.java:328) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.ProcessorTasklet.call(ProcessorTasklet.java:291) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.TaskletExecutionService$BlockingWorker.run(TaskletExecutionService.java:315) [classes/:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) [?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
	at java.lang.Thread.run(Thread.java:833) [?:?]
Caused by: org.h2.jdbc.JdbcBatchUpdateException: Unique index or primary key violation: "PRIMARY KEY ON PUBLIC.table_o_f5aba5fe_3c5a_42b1_8976_7c5710d7e806(id) ( /* key:0 */ 0, 'name-0')"; SQL statement:
INSERT INTO "table_o_f5aba5fe_3c5a_42b1_8976_7c5710d7e806" ( "id","name" )  VALUES (?, ?) [23505-214]
	at org.h2.jdbc.JdbcPreparedStatement.executeBatch(JdbcPreparedStatement.java:1269) ~[h2-2.1.214.jar:2.1.214]
	at com.zaxxer.hikari.pool.ProxyStatement.executeBatch(ProxyStatement.java:127) ~[HikariCP-4.0.3.jar:?]
	at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeBatch(HikariProxyPreparedStatement.java) ~[HikariCP-4.0.3.jar:?]
	at com.hazelcast.jet.impl.connector.WriteJdbcP.executeBatch(WriteJdbcP.java:315) ~[classes/:?]
	at com.hazelcast.jet.impl.connector.WriteJdbcP.process(WriteJdbcP.java:220) ~[classes/:?]
	... 14 more
13:22:16,140 ERROR || - [InitExecutionOperation] hz.InsertJdbcSqlConnectorTest_upbeat_johnson.cached.thread-1 - [127.0.0.1]:5701 [dev] [5.3.0-SNAPSHOT] Exception in ProcessorTasklet{09d4-4eb6-8787-0001/Insert([table_o_f5aba5fe_3c5a_42b1_8976_7c5710d7e806])#0}: com.hazelcast.jet.JetException: org.h2.jdbc.JdbcBatchUpdateException: Unique index or primary key violation: "PRIMARY KEY ON PUBLIC.table_o_f5aba5fe_3c5a_42b1_8976_7c5710d7e806(id) ( /* key:0 */ 0, 'name-0')"; SQL statement:
INSERT INTO "table_o_f5aba5fe_3c5a_42b1_8976_7c5710d7e806" ( "id","name" )  VALUES (?, ?) [23505-214]
com.hazelcast.jet.JetException: Exception in ProcessorTasklet{09d4-4eb6-8787-0001/Insert([table_o_f5aba5fe_3c5a_42b1_8976_7c5710d7e806])#0}: com.hazelcast.jet.JetException: org.h2.jdbc.JdbcBatchUpdateException: Unique index or primary key violation: "PRIMARY KEY ON PUBLIC.table_o_f5aba5fe_3c5a_42b1_8976_7c5710d7e806(id) ( /* key:0 */ 0, 'name-0')"; SQL statement:
INSERT INTO "table_o_f5aba5fe_3c5a_42b1_8976_7c5710d7e806" ( "id","name" )  VALUES (?, ?) [23505-214]
	at com.hazelcast.jet.impl.execution.TaskletExecutionService.handleTaskletExecutionError(TaskletExecutionService.java:286) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.TaskletExecutionService.access$600(TaskletExecutionService.java:80) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.TaskletExecutionService$BlockingWorker.run(TaskletExecutionService.java:325) ~[classes/:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
	at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: com.hazelcast.jet.JetException: org.h2.jdbc.JdbcBatchUpdateException: Unique index or primary key violation: "PRIMARY KEY ON PUBLIC.table_o_f5aba5fe_3c5a_42b1_8976_7c5710d7e806(id) ( /* key:0 */ 0, 'name-0')"; SQL statement:
INSERT INTO "table_o_f5aba5fe_3c5a_42b1_8976_7c5710d7e806" ( "id","name" )  VALUES (?, ?) [23505-214]
	at com.hazelcast.jet.impl.util.ExceptionUtil.peeledAndUnchecked(ExceptionUtil.java:142) ~[classes/:?]
	at com.hazelcast.jet.impl.util.ExceptionUtil.rethrow(ExceptionUtil.java:153) ~[classes/:?]
	at com.hazelcast.jet.impl.connector.WriteJdbcP.process(WriteJdbcP.java:234) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.ProcessorTasklet.lambda$processInbox$2f647568$2(ProcessorTasklet.java:490) ~[classes/:?]
	at com.hazelcast.jet.function.RunnableEx.run(RunnableEx.java:31) ~[classes/:?]
	at com.hazelcast.jet.impl.util.Util.doWithClassLoader(Util.java:533) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.ProcessorTasklet.processInbox(ProcessorTasklet.java:490) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.ProcessorTasklet.stateMachineStep(ProcessorTasklet.java:341) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.ProcessorTasklet.stateMachineStep(ProcessorTasklet.java:336) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.ProcessorTasklet.stateMachineStep(ProcessorTasklet.java:328) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.ProcessorTasklet.call(ProcessorTasklet.java:291) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.TaskletExecutionService$BlockingWorker.run(TaskletExecutionService.java:315) ~[classes/:?]
	... 5 more
Caused by: org.h2.jdbc.JdbcBatchUpdateException: Unique index or primary key violation: "PRIMARY KEY ON PUBLIC.table_o_f5aba5fe_3c5a_42b1_8976_7c5710d7e806(id) ( /* key:0 */ 0, 'name-0')"; SQL statement:
INSERT INTO "table_o_f5aba5fe_3c5a_42b1_8976_7c5710d7e806" ( "id","name" )  VALUES (?, ?) [23505-214]
	at org.h2.jdbc.JdbcPreparedStatement.executeBatch(JdbcPreparedStatement.java:1269) ~[h2-2.1.214.jar:2.1.214]
	at com.zaxxer.hikari.pool.ProxyStatement.executeBatch(ProxyStatement.java:127) ~[HikariCP-4.0.3.jar:?]
	at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeBatch(HikariProxyPreparedStatement.java) ~[HikariCP-4.0.3.jar:?]
	at com.hazelcast.jet.impl.connector.WriteJdbcP.executeBatch(WriteJdbcP.java:315) ~[classes/:?]
	at com.hazelcast.jet.impl.connector.WriteJdbcP.process(WriteJdbcP.java:220) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.ProcessorTasklet.lambda$processInbox$2f647568$2(ProcessorTasklet.java:490) ~[classes/:?]
	at com.hazelcast.jet.function.RunnableEx.run(RunnableEx.java:31) ~[classes/:?]
	at com.hazelcast.jet.impl.util.Util.doWithClassLoader(Util.java:533) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.ProcessorTasklet.processInbox(ProcessorTasklet.java:490) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.ProcessorTasklet.stateMachineStep(ProcessorTasklet.java:341) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.ProcessorTasklet.stateMachineStep(ProcessorTasklet.java:336) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.ProcessorTasklet.stateMachineStep(ProcessorTasklet.java:328) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.ProcessorTasklet.call(ProcessorTasklet.java:291) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.TaskletExecutionService$BlockingWorker.run(TaskletExecutionService.java:315) ~[classes/:?]
	... 5 more
13:22:16,142 ERROR || - [SubmitJobOperation] hz.InsertJdbcSqlConnectorTest_upbeat_johnson.cached.thread-1 - [127.0.0.1]:5701 [dev] [5.3.0-SNAPSHOT] Execution on a member failed: com.hazelcast.jet.JetException: Exception in ProcessorTasklet{09d4-4eb6-8787-0001/Insert([table_o_f5aba5fe_3c5a_42b1_8976_7c5710d7e806])#0}: com.hazelcast.jet.JetException: org.h2.jdbc.JdbcBatchUpdateException: Unique index or primary key violation: "PRIMARY KEY ON PUBLIC.table_o_f5aba5fe_3c5a_42b1_8976_7c5710d7e806(id) ( /* key:0 */ 0, 'name-0')"; SQL statement:
INSERT INTO "table_o_f5aba5fe_3c5a_42b1_8976_7c5710d7e806" ( "id","name" )  VALUES (?, ?) [23505-214]
com.hazelcast.jet.JetException: Execution on a member failed: com.hazelcast.jet.JetException: Exception in ProcessorTasklet{09d4-4eb6-8787-0001/Insert([table_o_f5aba5fe_3c5a_42b1_8976_7c5710d7e806])#0}: com.hazelcast.jet.JetException: org.h2.jdbc.JdbcBatchUpdateException: Unique index or primary key violation: "PRIMARY KEY ON PUBLIC.table_o_f5aba5fe_3c5a_42b1_8976_7c5710d7e806(id) ( /* key:0 */ 0, 'name-0')"; SQL statement:
INSERT INTO "table_o_f5aba5fe_3c5a_42b1_8976_7c5710d7e806" ( "id","name" )  VALUES (?, ?) [23505-214]
	at com.hazelcast.jet.impl.LightMasterContext.findError(LightMasterContext.java:326) ~[classes/:?]
	at com.hazelcast.jet.impl.LightMasterContext.lambda$createContext$2(LightMasterContext.java:171) ~[classes/:?]
	at com.hazelcast.jet.impl.LightMasterContext.lambda$invokeOnParticipant$8(LightMasterContext.java:297) ~[classes/:?]
	at com.hazelcast.spi.impl.AbstractInvocationFuture$WhenCompleteNode.lambda$execute$0(AbstractInvocationFuture.java:1570) ~[classes/:?]
	at com.hazelcast.test.TestLoggingUtils$CustomTestNameAwareForkJoinPool$TestNameAwareRunnable.run(TestLoggingUtils.java:104) ~[test-classes/:?]
	at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1395) ~[?:?]
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) ~[?:?]
	at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) ~[?:?]
	at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) ~[?:?]
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) ~[?:?]
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) ~[?:?]
Caused by: com.hazelcast.jet.JetException: Exception in ProcessorTasklet{09d4-4eb6-8787-0001/Insert([table_o_f5aba5fe_3c5a_42b1_8976_7c5710d7e806])#0}: com.hazelcast.jet.JetException: org.h2.jdbc.JdbcBatchUpdateException: Unique index or primary key violation: "PRIMARY KEY ON PUBLIC.table_o_f5aba5fe_3c5a_42b1_8976_7c5710d7e806(id) ( /* key:0 */ 0, 'name-0')"; SQL statement:
INSERT INTO "table_o_f5aba5fe_3c5a_42b1_8976_7c5710d7e806" ( "id","name" )  VALUES (?, ?) [23505-214]
	at com.hazelcast.jet.impl.execution.TaskletExecutionService.handleTaskletExecutionError(TaskletExecutionService.java:286) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.TaskletExecutionService.access$600(TaskletExecutionService.java:80) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.TaskletExecutionService$BlockingWorker.run(TaskletExecutionService.java:325) ~[classes/:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
	at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: com.hazelcast.jet.JetException: org.h2.jdbc.JdbcBatchUpdateException: Unique index or primary key violation: "PRIMARY KEY ON PUBLIC.table_o_f5aba5fe_3c5a_42b1_8976_7c5710d7e806(id) ( /* key:0 */ 0, 'name-0')"; SQL statement:
INSERT INTO "table_o_f5aba5fe_3c5a_42b1_8976_7c5710d7e806" ( "id","name" )  VALUES (?, ?) [23505-214]
	at com.hazelcast.jet.impl.util.ExceptionUtil.peeledAndUnchecked(ExceptionUtil.java:142) ~[classes/:?]
	at com.hazelcast.jet.impl.util.ExceptionUtil.rethrow(ExceptionUtil.java:153) ~[classes/:?]
	at com.hazelcast.jet.impl.connector.WriteJdbcP.process(WriteJdbcP.java:234) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.ProcessorTasklet.lambda$processInbox$2f647568$2(ProcessorTasklet.java:490) ~[classes/:?]
	at com.hazelcast.jet.function.RunnableEx.run(RunnableEx.java:31) ~[classes/:?]
	at com.hazelcast.jet.impl.util.Util.doWithClassLoader(Util.java:533) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.ProcessorTasklet.processInbox(ProcessorTasklet.java:490) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.ProcessorTasklet.stateMachineStep(ProcessorTasklet.java:341) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.ProcessorTasklet.stateMachineStep(ProcessorTasklet.java:336) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.ProcessorTasklet.stateMachineStep(ProcessorTasklet.java:328) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.ProcessorTasklet.call(ProcessorTasklet.java:291) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.TaskletExecutionService$BlockingWorker.run(TaskletExecutionService.java:315) ~[classes/:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
	at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: org.h2.jdbc.JdbcBatchUpdateException: Unique index or primary key violation: "PRIMARY KEY ON PUBLIC.table_o_f5aba5fe_3c5a_42b1_8976_7c5710d7e806(id) ( /* key:0 */ 0, 'name-0')"; SQL statement:
INSERT INTO "table_o_f5aba5fe_3c5a_42b1_8976_7c5710d7e806" ( "id","name" )  VALUES (?, ?) [23505-214]
	at org.h2.jdbc.JdbcPreparedStatement.executeBatch(JdbcPreparedStatement.java:1269) ~[h2-2.1.214.jar:2.1.214]
	at com.zaxxer.hikari.pool.ProxyStatement.executeBatch(ProxyStatement.java:127) ~[HikariCP-4.0.3.jar:?]
	at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeBatch(HikariProxyPreparedStatement.java) ~[HikariCP-4.0.3.jar:?]
	at com.hazelcast.jet.impl.connector.WriteJdbcP.executeBatch(WriteJdbcP.java:315) ~[classes/:?]
	at com.hazelcast.jet.impl.connector.WriteJdbcP.process(WriteJdbcP.java:220) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.ProcessorTasklet.lambda$processInbox$2f647568$2(ProcessorTasklet.java:490) ~[classes/:?]
	at com.hazelcast.jet.function.RunnableEx.run(RunnableEx.java:31) ~[classes/:?]
	at com.hazelcast.jet.impl.util.Util.doWithClassLoader(Util.java:533) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.ProcessorTasklet.processInbox(ProcessorTasklet.java:490) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.ProcessorTasklet.stateMachineStep(ProcessorTasklet.java:341) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.ProcessorTasklet.stateMachineStep(ProcessorTasklet.java:336) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.ProcessorTasklet.stateMachineStep(ProcessorTasklet.java:328) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.ProcessorTasklet.call(ProcessorTasklet.java:291) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.TaskletExecutionService$BlockingWorker.run(TaskletExecutionService.java:315) ~[classes/:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
	at java.lang.Thread.run(Thread.java:833) ~[?:?]
```


- After:
```
13:21:10,994  INFO || - [TaskletExecutionService] hz.InsertJdbcSqlConnectorTest_objective_dirac.jet.blocking.thread-1 - [127.0.0.1]:5702 [dev] [5.3.0-SNAPSHOT] Exception in ProcessorTasklet{09d4-4e76-e106-0001/Insert([table_o_53a507a3_f770_434d_973c_cbc523ca0f89])#2}
com.hazelcast.jet.JetException: org.h2.jdbc.JdbcBatchUpdateException: Unique index or primary key violation: "PRIMARY KEY ON PUBLIC.table_o_53a507a3_f770_434d_973c_cbc523ca0f89(id) ( /* key:0 */ 0, 'name-0')"; SQL statement:
INSERT INTO "table_o_53a507a3_f770_434d_973c_cbc523ca0f89" ( "id","name" )  VALUES (?, ?) [23505-214]
	at com.hazelcast.jet.impl.util.ExceptionUtil.peeledAndUnchecked(ExceptionUtil.java:142) ~[classes/:?]
	at com.hazelcast.jet.impl.util.ExceptionUtil.rethrow(ExceptionUtil.java:153) ~[classes/:?]
	at com.hazelcast.jet.impl.connector.WriteJdbcP.process(WriteJdbcP.java:234) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.ProcessorTasklet.lambda$processInbox$2f647568$2(ProcessorTasklet.java:490) ~[classes/:?]
	at com.hazelcast.jet.function.RunnableEx.run(RunnableEx.java:31) ~[classes/:?]
	at com.hazelcast.jet.impl.util.Util.doWithClassLoader(Util.java:533) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.ProcessorTasklet.processInbox(ProcessorTasklet.java:490) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.ProcessorTasklet.stateMachineStep(ProcessorTasklet.java:341) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.ProcessorTasklet.stateMachineStep(ProcessorTasklet.java:336) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.ProcessorTasklet.stateMachineStep(ProcessorTasklet.java:328) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.ProcessorTasklet.call(ProcessorTasklet.java:291) ~[classes/:?]
	at com.hazelcast.jet.impl.execution.TaskletExecutionService$BlockingWorker.run(TaskletExecutionService.java:314) [classes/:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) [?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
	at java.lang.Thread.run(Thread.java:833) [?:?]
Caused by: org.h2.jdbc.JdbcBatchUpdateException: Unique index or primary key violation: "PRIMARY KEY ON PUBLIC.table_o_53a507a3_f770_434d_973c_cbc523ca0f89(id) ( /* key:0 */ 0, 'name-0')"; SQL statement:
INSERT INTO "table_o_53a507a3_f770_434d_973c_cbc523ca0f89" ( "id","name" )  VALUES (?, ?) [23505-214]
	at org.h2.jdbc.JdbcPreparedStatement.executeBatch(JdbcPreparedStatement.java:1269) ~[h2-2.1.214.jar:2.1.214]
	at com.zaxxer.hikari.pool.ProxyStatement.executeBatch(ProxyStatement.java:127) ~[HikariCP-4.0.3.jar:?]
	at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeBatch(HikariProxyPreparedStatement.java) ~[HikariCP-4.0.3.jar:?]
	at com.hazelcast.jet.impl.connector.WriteJdbcP.executeBatch(WriteJdbcP.java:315) ~[classes/:?]
	at com.hazelcast.jet.impl.connector.WriteJdbcP.process(WriteJdbcP.java:220) ~[classes/:?]
	... 14 more

```

---------

Co-authored-by: František Hartman <frant.hartm@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Source: Internal PR or issue was opened by an employee Type: Enhancement
Projects
None yet
Development

No branches or pull requests

2 participants