Background Image
조회 수 1390 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

1. 큐브리드 10.1 에서 윤초(leap second)지원이 가능

설정 파일 CUBRID/conf/cubrid.conf 에 아래와 같이 윤초 지원 옵션을 yes 로 설정한다.

tz_leap_second_support=yes


아래 표는 윤초 지원 옵션을 사용할 경우와 그렇지 않을 경우를 비교한 것이다. 


표1 . tz_leap_second_support 를 적용할 경우와 그렇지 않을 경우 비교

 

 

tz_leap_second_support=yes

tz_leap_second_support=no

비고



csql> SELECT TIMESTAMPLTZ'2016-12-31 23:59:59 UTC';
=== <Result of SELECT Command in Line 1> ===
  timestampltz '2016-12-31 23:59:59 UTC'
=============================================
 08:59:59 AM 01/01/2017 Asia/Seoul KST
1 row selected. (0.009868 sec) Committed.
1 command(s) successfully processed.



csql> SELECT TIMESTAMPLTZ'2016-12-31 23:59:59 UTC';
=== <Result of SELECT Command in Line 1> ===
  timestampltz '2016-12-31 23:59:59 UTC'
=============================================
 
08:59:59 AM 01/01/2017 Asia/Seoul KST
1 row selected. (0.011462 sec) Committed.
1 command(s) successfully processed.

unix timestamp = 1483196399

csql> SELECT TIMESTAMPLTZ'2016-12-31 23:59:59 UTC'+1;
=== <Result of SELECT Command in Line 1> ===
  timestampltz '2016-12-31 23:59:59 UTC'+1
=============================================
 
08:59:59 AM 01/01/2017 Asia/Seoul KST
1 row selected. (0.009906 sec) Committed.
1 command(s) successfully processed.

csql> SELECT TIMESTAMPLTZ'2016-12-31 23:59:59 UTC'+1;
=== <Result of SELECT Command in Line 1> ===
  timestampltz '2016-12-31 23:59:59 UTC'+1
=============================================
 09:00:00 AM 01/01/2017 Asia/Seoul KST
1 row selected. (0.010832 sec) Committed.
1 command(s) successfully processed.

+1 을 해도 같은 시간 1483196400을 무시하고 같은 시간으로 취급
tz_leap_second_support=no
일 경우 그냥 1초 증가



csql> SELECT TIMESTAMPLTZ'2016-12-31 23:59:59 UTC'+2;
=== <Result of SELECT Command in Line 1> ===
  timestampltz '2016-12-31 23:59:59 UTC'+2
=============================================
 
09:00:00 AM 01/01/2017 Asia/Seoul KST
1 row selected. (0.011239 sec) Committed.
1 command(s) successfully processed.

csql> SELECT TIMESTAMPLTZ'2016-12-31 23:59:59 UTC'+2;
=== <Result of SELECT Command in Line 1> ===
  timestampltz '2016-12-31 23:59:59 UTC'+2
=============================================
 
09:00:01 AM 01/01/2017 Asia/Seoul KST
1 row selected. (0.010025 sec) Committed.
1 command(s) successfully processed.

+2를 해야 1초 증가한 시간
즉 윤초가 적용되었기 때문에 유닉스 타임스탬프 보정

 




2. 윤초가 발생한 시간은 실제 발생한 것이 아닌 가상의 시간이다.  

SELECT TO_DATETIME_TZ ('2016-12-31 23:59:60 UTC') ;  

Conversion error in timestamp format.

 

실제로 타임스탬프의 초가 60이 되는 경우는 없기 때문에 위 에러는 정상입니다.

 

Mysql 의 경우

SELECT * FROM t1 WHERE ts = '2008-12-31 23:59:60';

Empty set, 2 warnings (0.00 sec)

Warning 처리함.

참고 :  https://dev.mysql.com/doc/refman/5.7/en/time-zone-leap-seconds.html


3. 윤초를 사용하려면 OS 의 타임존 데이터 값을  먼저 업데이트 해야 한다.

리눅스에서 사용하는 타임존 패키지는 두가지가 있다.

tzdata 패키지와 tzdata-java 이다.

 

3.1 tzdata

Name        : tzdata                       Relocations: (not relocatable)

Version     : 2017b                             Vendor: CentOS

Release     : 1.el6                         Build Date: Mon 03 Apr 2017 11:15:25 PM KST

Install Date: Wed 21 Jun 2017 10:22:44 AM KST      Build Host: c1bm.rdu2.centos.org

Group       : System Environment/Base       Source RPM: tzdata-2017b-1.el6.src.rpm

Size        : 1785109                          License: Public Domain

Signature   : RSA/SHA1, Wed 05 Apr 2017 01:33:48 AM KST, Key ID 0946fca2c105b9de

Packager    : CentOS BuildSystem <http://bugs.centos.org>

URL         : https://www.iana.org/time-zones

Summary     : Timezone data

Description :

This package contains data files with rules for various timezones around the world.

 

 

The Time Zone Database (often called tz or zoneinfo) contains code and

data that represent the history of local time for many representative

locations around the globe.  It is updated periodically to reflect

changes made by political bodies to time zone boundaries, UTC offsets,

and daylight-saving rules.

 

https://www.iana.org/time-zones/repository/tz-link.html

 

tzdata 패키지의 내용

/usr/share/doc/tzdata-2017b

/usr/share/doc/tzdata-2017b/README

/usr/share/doc/tzdata-2017b/Theory

/usr/share/doc/tzdata-2017b/tz-link.html

/usr/share/zoneinfo

/usr/share/zoneinfo/Africa

...

...

/usr/share/zoneinfo/right/Universal

/usr/share/zoneinfo/right/W-SU

/usr/share/zoneinfo/right/WET

/usr/share/zoneinfo/right/Zulu

/usr/share/zoneinfo/zone.tab

/usr/share/zoneinfo/zone1970.tab

 

 

3.2. tzdata-java

Name        : tzdata-java                  Relocations: (not relocatable)

Version     : 2017b                             Vendor: CentOS

Release     : 1.el6                         Build Date: Mon 03 Apr 2017 11:15:25 PM KST

Install Date: Wed 21 Jun 2017 10:23:50 AM KST      Build Host: c1bm.rdu2.centos.org

Group       : System Environment/Base       Source RPM: tzdata-2017b-1.el6.src.rpm

Size        : 371020                           License: Public Domain

Signature   : RSA/SHA1, Wed 05 Apr 2017 01:33:48 AM KST, Key ID 0946fca2c105b9de

Packager    : CentOS BuildSystem <http://bugs.centos.org>

URL         : https://www.iana.org/time-zones

Summary     : Timezone data for Java

Description :

This package contains timezone information for use by Java runtimes.

 

tzdata-java

/usr/share/javazi

/usr/share/javazi-1.8

/usr/share/javazi-1.8/tzdb.dat

/usr/share/javazi/Africa

/usr/share/javazi/Africa/Abidjan

/usr/share/javazi/Africa/Accra

/usr/share/javazi/Africa/Algiers

...

...

/usr/share/javazi/SystemV/MST7MDT

/usr/share/javazi/SystemV/PST8

/usr/share/javazi/SystemV/PST8PDT

/usr/share/javazi/SystemV/YST9

/usr/share/javazi/SystemV/YST9YDT

/usr/share/javazi/WET

/usr/share/javazi/ZoneInfoMappings

 

tzdata 패키지를 최신으로 설치하면 아래와 같은 정보를 확인할 수 있습니다.

 

[user_xx@rndpv100 zoneinfo]$  zdump -v right/Asia/Seoul  | grep 2017 | grep Sat

right/Asia/Seoul  Sat Dec 31 23:59:60 2016 UTC = Sun Jan  1 08:59:60 2017 KST isdst=0 gmtoff=32400

 

2016 à 2017 이동시 발생했던 윤초 정보를 확인할 수 있습니다. 

 

ntp, ptp 를 사용하는 리눅스 서버는 윤초 보정에 대응 할 필요없음

ntp 또는 ptp 를 사용하지 않을 경우 윤초에 대응할 수 있는 tzdata 와 커널로 업데이트해야 함

 참고 :  https://access.redhat.com/articles/15145

 

커널의 경우 2012년 리눅스 커널 버그로 인해 문제 (윤초가 추가된 후 CPU 사용량 증가와 Kernel Deadlock)가 발생함.

따라서 최신 리눅스 커널 버전인지 확인하는 것이 중요함

(이 문제는 2012년에 처리되어 2015년 이후 발생하지 않음)

 

3.3 큐브리드에서 타임존 라이브러리를 사용하기 위해서는 아래 붉은색으로 표시된 것처럼 타임존을 먼저 업데이트 하고 큐브리드의 타임존 라이브러리를 컴파일 후 데이터베이스를 다시 시작해야 한다. 

CUBRID supports IANA timezone, and a user can use the IANA timezone library in the CUBRID installation package as it is.

If you want to update as the recent timezone, update timezone first,

compile timezone library, and restart the database.


 




Contact Cubrid

대표전화 070-4077-2110 / 기술문의 070-4077-2113 / 영업문의 070-4077-2112 / Email. contact_at_cubrid.com
Contact Sales