Comments (7)
Can you elaborate why this is a postgresql-specific problem? Steps and configurations to reproduce it?
from jsr352.
I'm using postgresql an h2 databases. The h2 database is inside server and in the same timezone.
I very possible to happen on all SQL servers but i don't know for others.
To reproduce error change the running wildlfy instance timezone value from command line like -Duser.timezone=UTC and try to clean jdbc repository for job executions older than by example 3 hours using sql.
from jsr352.
I changed WildFly timezone to be UTC, and also ran my postgres database server with the default timezone. When inserting new job execution data (including created time, end time, etc) into jdbc job repository, the assumed timezone is the one from WildFly runtime (e.g., UTC). If you query the job repository directly with sql (tools like psql), it will display date values that are correct if interpreted with UTC (WildFly timezone), but incorrect in the database server's timezone.
postgres=# select jobexecutionid, endtime, batchstatus from job_execution;
jobexecutionid | endtime | batchstatus
----------------+-------------------------+-------------
1 | 2018-06-05 03:23:55.448 | COMPLETED
(1 row)
From the above sql output, the endtime is 2018-06-05 03:23:55, which is tomorrow morning in my timezone (also my postgres db timezone) and hence seems incorrect. But it is the correct timestamp in my WildFly server's timezone (UTC).
If you have your batch client query the job data through java api (e.g., JobOperator.getJobExecution(), etc), the timestamps are displayed correctly.
curl -s http://localhost:8080/restAPI/api/jobexecutions/1 | python -m json.tool
{
"batchStatus": "COMPLETED",
"createTime": 1528169035355,
"endTime": 1528169035448,
"executionId": 1,
"exitStatus": "COMPLETED",
"href": "http://localhost:8080/restAPI/api/jobexecutions/1",
"jobInstanceId": 1,
"jobName": "restJob1",
"jobParameters": {},
"lastUpdatedTime": 1528169035453,
"startTime": 1528169035371
}
The above createTime 1528169035355 is Mon 4 June 2018
23:23:55, which is the correct local time I ran this test.
from jsr352.
If using timestamp with timezone, the date value is displayed correctly in psql output in postgres server's timezone:
postgres=# \d job_execution
Table "public.job_execution"
Column | Type | Collation | Nullable | Default
-----------------+--------------------------+-----------+----------+-------------------------------------------------------
jobexecutionid | bigint | | not null | nextval('job_execution_jobexecutionid_seq'::regclass)
jobinstanceid | bigint | | not null |
version | integer | | |
createtime | timestamp with time zone | | |
starttime | timestamp with time zone | | |
endtime | timestamp with time zone | | |
lastupdatedtime | timestamp with time zone | | |
batchstatus | character varying(30) | | |
exitstatus | character varying(512) | | |
jobparameters | character varying(3000) | | |
restartposition | character varying(255) | | |
Indexes:
"job_execution_pkey" PRIMARY KEY, btree (jobexecutionid)
Foreign-key constraints:
"fk_job_execution_job_instance" FOREIGN KEY (jobinstanceid) REFERENCES job_instance(jobinstanceid) ON DELETE CASCADE
Referenced by:
TABLE "step_execution" CONSTRAINT "fk_step_exe_job_exe" FOREIGN KEY (jobexecutionid) REFERENCES job_execution(jobexecutionid) ON DELETE CASCADE
postgres=# select jobexecutionid, endtime, batchstatus from job_execution;
jobexecutionid | endtime | batchstatus
----------------+----------------------------+-------------
1 | 2018-06-05 11:02:48.313-04 | COMPLETED
from jsr352.
A job repository database may hold job data from multiple WildFly instances that may be in different timezone. Therefore, it makes sense to use timestamp with timezone in postgres to be able to view all date values in consistant and predictable timezones.
from jsr352.
Cloned this issue to JIRA: https://issues.jboss.org/browse/JBERET-419
from jsr352.
from jsr352.
Related Issues (20)
- Mongo support for storing batch metadata? HOT 2
- PurgeBatchlet doesn't work with JdbcJobRepository HOT 2
- "JBERET000651: The requested permits (%d) is greater than the maximum number of permits (%d) allowed in the thread pool."; HOT 2
- user guide HOT 2
- Support Java 17 HOT 10
- Injection of batch artifact properties does not work HOT 10
- Job versioning does not appear to be supported in JBeret HOT 1
- Error using Oracle DB as default job repository HOT 2
- sync SECURITY.md with wildfly/SECURITY.md HOT 1
- There are `com.caucho.quercus.Quercus` related exception throw in the `scripting` test.
- Currently the `jberet-2.x.yml` only tests on `macos` and `windows` and no `ubuntu`
- Update the CODEOWNERS file HOT 4
- Enable Support to get DB Username/Password from enivonment variable for jberet.properties HOT 5
- Fix the random test failures on ubuntu HOT 3
- disable Caucho and PHP script tests
- Fix the random test failure of `purgeInMemoryRepository`
- fix the random test failure: `jobExecutionIdFromIncludeRunningOnes`
- Write a blog post for the new feature: Enable Support to get DB Username/Password from environment variable for `jberet.properties` HOT 1
- Add a `layer-spec` similar to the ones in `resteasy-spring` HOT 3
- Add deployment tests into the project by using the provisioned WildFly server with the update-to-date project module(by using Galleon `feature-pack` or WildFly Channel).
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jsr352.