Cassandra DB中的日期插入:非平凡的1h班次问题(后续)

This is a follow-up of this other original post.

ENVIRONMENT:

Cassandra running on OpenSuse (over its Java Virtual Machine).

Server set as timezone "Europe/Zurich".

The tests include this server only. No other servers involved.

TEST:

"BEGIN BATCH USING CONSISTENCY ONE insert into tsmeasures(id,'2015-01-01 00:00:00','2015-06-01 00:00:00') values ('2812621',1,2) APPLY BATCH"

RESULTS OBSERVED FROM PHP (on the same Cassandra sever):

"SELECT '2014-06-01'..'2015-12-01' FROM tsmeasures WHERE id IN(2812621)"
unpacked_value=1420066800, str_time='2015-01-01 00:00:00' <= OK
unpacked_value=1433113200, str_time='2015-06-01 01:00:00' <= NOT OK !

Thus the dates were interpreted as GMT+1.

SOLUTION:

In "cassandra_env.sh", add the option -Duser.timezone when running Java:

JVM_OPTS="$JVM_OPTS -Duser.timezone=Europe/Zurich"

REPEATING TEST AFTER THE FIX:

"BEGIN BATCH USING CONSISTENCY ONE insert into tsmeasures(id,'2015-01-01 00:00:00','2015-06-01 00:00:00') values ('2812621',1,2) APPLY BATCH"

NEW RESULTS OBSERVED FROM PHP AFTER THE FIX (on the same Cassandra sever):

"SELECT '2014-06-01'..'2015-12-01' FROM tsmeasures WHERE id IN(2812621)"
unpacked_value=1420066800, str_time='2015-01-01 00:00:00' <= OK
unpacked_value=1433113200, str_time='2015-06-01 00:00:00' <= OK

Dates interpreted as:

  • Central European Winter Time = GMT+1
  • Central European Summer Time = GMT+2