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

yona 1.14.0 h2 버전 -> 1.16.0 h2 버전 업그레이드 실패 #771

Closed
lindolsang opened this issue Jan 21, 2023 · 3 comments
Closed

yona 1.14.0 h2 버전 -> 1.16.0 h2 버전 업그레이드 실패 #771

lindolsang opened this issue Jan 21, 2023 · 3 comments

Comments

@lindolsang
Copy link

안녕하세요.

yona 1.14.0 h2 버전을 설치해서 사용하는 중에 1.16.0 h2 릴리즈 소식을 보고
업그레이드를 시도중입니다.

기존에 1.13.0 h2 버전을 1.14.0 h2 버전으로 업그레이드 할 때는 동일 방법으로 잘 업그레이드가 되었으나,
1.14.0 h2 버전은 1.16.0 h2 버전으로 업그레이드는 아래와 같은 오류가 발생하고 있습니다.

도움 부탁드립니다.

  • 1.15.0 h2 버전은 구할수 없어서 부득이 1.14.0 h2 -> 1.16.0 h2 로 업그레이드를 시도해보게 되었습니다.

감사합니다.

설치 환경

Java

lindol@lindol:/my_tracker/yona-1.16.0$ java -version
openjdk version "1.8.0_352"
OpenJDK Runtime Environment (build 1.8.0_352-8u352-ga-1
20.04-b08)
OpenJDK 64-Bit Server VM (build 25.352-b08, mixed mode)

Linux 배포버전

lindol@lindol:~/my_tracker/yona-1.16.0$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.5 LTS
Release: 20.04
Codename: focal

업그레이드 과정

$ unzip yona-h2-v1.16.0-bin.zip

$ cd yona-1.16.0
~yona-1.16.0 $ cp ../yona-1.14.0/yona.h2.db .

lindol@lindol:~/my_tracker/yona-1.16.0$ sh start.sh

start.sh 에서 YONA_DATA 설정 및 bin/yona 실행

실행 로그

Play server process ID is 35933
[info] play - database [default] connected at jdbc:h2:file:./yona
[warn] play - Your production database [default] needs evolutions, including downs! 

# !!! WARNING! This script contains DOWNS evolutions that are likely destructives

# --- Rev:130,Downs - 6b4ed7c
ALTER TABLE issue DROP COLUMN updated_by_author_id;
ALTER TABLE posting DROP COLUMN updated_by_author_id;

# --- Rev:129,Downs - 01e7e72
ALTER TABLE webhook CHANGE git_push git_push_only tinyint(1);
UPDATE webhook SET git_push_only = 1 WHERE webhook_type = 3;
UPDATE webhook SET webhook_type = 0 WHERE webhook_type = 3;

# --- Rev:128,Downs - 78be6df
DROP TABLE webhook_thread;

# --- Rev:128,Ups - 7b88448
CREATE TABLE webhook_thread (
id                        BIGINT,
webhook_id                BIGINT,
resource_type             VARCHAR(20),
resource_id               VARCHAR(255),
thread_id                 VARCHAR(2000),
created_at                DATETIME,
CONSTRAINT pk_webhook_thread PRIMARY KEY (id),
CONSTRAINT fk_webhook_thread_webhook FOREIGN KEY (webhook_id) REFERENCES webhook (id) ON DELETE CASCADE
)
;

create sequence webhook_thread_seq;

CREATE index ix_webhook_thread_webhook_1 ON webhook_thread (webhook_id);
CREATE index ix_webhook_thread_resource_2 ON webhook_thread (resource_type, resource_id);

# --- Rev:129,Ups - 01e7e72
UPDATE webhook SET webhook_type = 3 WHERE git_push_only = 1;
ALTER TABLE webhook CHANGE git_push_only git_push tinyint(1);

# --- Rev:130,Ups - 6b4ed7c
ALTER TABLE issue ADD COLUMN updated_by_author_id bigint;
ALTER TABLE posting ADD COLUMN updated_by_author_id bigint;

# --- Rev:131,Ups - 276bfbc
CREATE TABLE recent_issue (
id           BIGINT,
user_id      BIGINT,
issue_id     BIGINT,
posting_id   BIGINT,
title        VARCHAR(255),
url          VARCHAR(255),
created_date datetime,
CONSTRAINT pk_recent_issue PRIMARY KEY (id),
CONSTRAINT uq_recent_issue_user_id_issue_id_1 UNIQUE (user_id, issue_id),
CONSTRAINT uq_recent_issue_user_id_posting_id_1 UNIQUE (user_id, posting_id),
CONSTRAINT fk_recent_issue_user FOREIGN KEY (user_id) REFERENCES n4user (id) on DELETE CASCADE,
CONSTRAINT fk_recent_issue_issue FOREIGN KEY (issue_id) REFERENCES issue (id) on DELETE CASCADE
);

create sequence recent_issue_seq;

CREATE index ix_recent_issue_user_1 ON recent_issue (user_id);
CREATE index ix_recent_issue_issue_2 ON recent_issue (user_id, issue_id);
CREATE index ix_recent_issue_posting_3 ON recent_issue (user_id, posting_id);

# --- Rev:132,Ups - 05e1814
ALTER TABLE issue ADD COLUMN is_draft tinyint(1) default 0;
CREATE index ix_issue_is_draft_1 ON issue (weight, is_draft, number, created_date);
CREATE index ix_issue_is_draft_2 ON issue (is_draft, author_login_id, project_id);

[warn] play - Run with -DapplyEvolutions.default=true and -DapplyDownEvolutions.default=true if you want to run them automatically, including downs (be careful, especially if your down evolutions drop existing data)
Oops, cannot start the server.
@80boio8gn: Database 'default' needs evolution!
	at play.api.db.evolutions.EvolutionsPlugin$$anonfun$onStart$1$$anonfun$apply$1.apply$mcV$sp(Evolutions.scala:502)
	at play.api.db.evolutions.EvolutionsPlugin.withLock(Evolutions.scala:531)
	at play.api.db.evolutions.EvolutionsPlugin$$anonfun$onStart$1.apply(Evolutions.scala:485)
	at play.api.db.evolutions.EvolutionsPlugin$$anonfun$onStart$1.apply(Evolutions.scala:483)
	at scala.collection.immutable.List.foreach(List.scala:318)
	at play.api.db.evolutions.EvolutionsPlugin.onStart(Evolutions.scala:483)
	at play.api.Play$$anonfun$start$1$$anonfun$apply$mcV$sp$1.apply(Play.scala:91)
	at play.api.Play$$anonfun$start$1$$anonfun$apply$mcV$sp$1.apply(Play.scala:91)
	at scala.collection.immutable.List.foreach(List.scala:318)
	at play.api.Play$$anonfun$start$1.apply$mcV$sp(Play.scala:91)
	at play.api.Play$$anonfun$start$1.apply(Play.scala:91)
	at play.api.Play$$anonfun$start$1.apply(Play.scala:91)
	at play.utils.Threads$.withContextClassLoader(Threads.scala:21)
	at play.api.Play$.start(Play.scala:90)
	at play.core.StaticApplication.<init>(ApplicationProvider.scala:55)
	at play.core.server.NettyServer$.createServer(NettyServer.scala:253)
	at play.core.server.NettyServer$$anonfun$main$3.apply(NettyServer.scala:289)
	at play.core.server.NettyServer$$anonfun$main$3.apply(NettyServer.scala:284)
	at scala.Option.map(Option.scala:145)
	at play.core.server.NettyServer$.main(NettyServer.scala:284)
	at play.core.server.NettyServer.main(NettyServer.scala)
@doortts
Copy link
Collaborator

doortts commented Jan 21, 2023

우선 h2 1.15 버전을 배포한적이 없어서 1.14 에서 업그레이드가 맞습니다.
해당 내용은 sql 문 수정이 있어서 128번 스크립트까지 down 으로 테이블 변경이 있을 예정이고 다시 sql 문이 실행될 예정이라는 경고문입니다.

개발환경에서는 발생하지 않았던 문제이지만 h2 환경은 테스트가 부족했을 수 있습니다.

우선 db 파일을 백업 받아 놓으신다음
start.sh 의 JAVA_OPTS 항목에 -DapplyDownEvolutions.default=true를 추가해서 실행해 보세요

@lindolsang
Copy link
Author

lindolsang commented Jan 22, 2023

@doortts 님, 안녕하세요. :)

start.sh 에 아래처럼 말씀해 주신 옵션을 추가한 후 실행해 보니,
잘 실행 되었습니다.

lindol@lindol:~/my_tracker/yona-1.16.0$ cat start.sh 
YONA_DATA=/home/lindol/my_tracker/my_yona_data;export YONA_DATA
JAVA_OPTS=-DapplyDownEvolutions.default=true;export JAVA_OPTS
bin/yona

이후에는, JAVA_OPTS 옵션은 다시 삭제하고 실행하였는데, 잘 동작하는 것 습니다.
JAVA_OPTS 옵션을 계속 추가해서 실행해야 할까요?

명절 연휴기간, 빠른 확인 감사합니다.
새해 복 많이 받으세요 :)

감사합니다.

@doortts
Copy link
Collaborator

doortts commented Jan 22, 2023

잘 실행되었다니 다행입니다! 한 번 정상 실행되었다면 DB 진화가 잘 되었다는 의미입니다.
이후 실행시에는 이미 작업하신것처럼 지우시면 됩니다.

참고로 실행 쉘 예제로 https://github.com/yona-projects/yona/blob/next/restart.sh 도 있습니다.

그럼 새 해 복 많이 받으세요 :)

@doortts doortts closed this as completed Jan 22, 2023
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

No branches or pull requests

2 participants