Skip to content

Conversation

@StevenLuMT
Copy link
Member

@StevenLuMT StevenLuMT commented Jul 28, 2022

Descriptions of the changes in this PR:

Motivation

Fixes #3430, make cookie validation is compatible with old version.
I think we should check indexDirs when configuration‘s indexDirectories is setted rather than avoiding the check

Changes

  1. add compatible check
  2. add testcase to cover the new code

@StevenLuMT
Copy link
Member Author

@horizonzy thanks for your issue,
have a look, does this solve your problem?

@hangc0276 hangc0276 added this to the 4.16.0 milestone Jul 29, 2022
@StevenLuMT StevenLuMT force-pushed the master_indexDirCompatibleFix branch from 1a88ef0 to a7e3c28 Compare July 29, 2022 07:39
@StevenLuMT StevenLuMT force-pushed the master_indexDirCompatibleFix branch from a7e3c28 to 905d317 Compare July 29, 2022 07:55
Copy link
Member

@horizonzy horizonzy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

@hangc0276 hangc0276 merged commit f06800c into apache:master Jul 31, 2022
gaozhangmin pushed a commit to gaozhangmin/bookkeeper that referenced this pull request Feb 23, 2023
Descriptions of the changes in this PR:

### Motivation
Fixes apache#3430, make cookie validation is compatible with old version.
I think we should check indexDirs when configuration‘s indexDirectories is setted  rather than avoiding the check

### Changes
1. add compatible check
2. add testcase to cover the new code

(cherry picked from commit f06800c)
@fvigotti
Copy link

fvigotti commented Sep 21, 2023

I'm not sure if I am missing something because this is a year old merged bug .. but updating a cluster from 4.15.4 to 4.16.3 (both using the dockerhub official images )
I still get this incompatibility issue , shouldn't the cookie be compatible and get updated once the 4.16+ bookie starts ?

2023-09-21T09:36:00,280 - ERROR - [main:Main@218] - Failed to build bookie server
org.apache.bookkeeper.bookie.BookieException$InvalidCookieException: Cookie [5
bookieHost: "bk1"
journalDir: "/data/bookkeeper/journal"
ledgerDirs: "1\t/data/bookkeeper/ledgers"
instanceId: "e44f080b-a6ba-4b5e-97f0-0a0303bfd295"
indexDirs: "1\t/data/bookkeeper/index"
] is not matching with [5
bookieHost: "bk1"
journalDir: "/data/bookkeeper/journal"
ledgerDirs: "1\t/data/bookkeeper/ledgers"
instanceId: "e44f080b-a6ba-4b5e-97f0-0a0303bfd295"

a fast check on the code and the problem maybe was because I've used a specified indexDirs instead of the default (ledgerdir) one ? but the code seems to assume that if the cookie is blank then it's the ledgerDirs ( and shouldn't assume that because can be configured differently in the configuration )

https://github.com/StevenLuMT/bookkeeper/blob/905d317c5ab6e700aa3195259c274b55a70540c5/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Cookie.java#L142-L143

as note for others in the same situation my workaround has been to do a rolling update with the reset cookie bin/bookkeeper shell bookieformat -deleteCookie on each bookie

@horizonzy
Copy link
Member

I'm not sure if I am missing something because this is a year old merged bug .. but updating a cluster from 4.15.4 to 4.16.3 (both using the dockerhub official images ) I still get this incompatibility issue , shouldn't the cookie be compatible and get updated once the 4.16+ bookie starts ?

2023-09-21T09:36:00,280 - ERROR - [main:Main@218] - Failed to build bookie server
org.apache.bookkeeper.bookie.BookieException$InvalidCookieException: Cookie [5
bookieHost: "bk1"
journalDir: "/data/bookkeeper/journal"
ledgerDirs: "1\t/data/bookkeeper/ledgers"
instanceId: "e44f080b-a6ba-4b5e-97f0-0a0303bfd295"
indexDirs: "1\t/data/bookkeeper/index"
] is not matching with [5
bookieHost: "bk1"
journalDir: "/data/bookkeeper/journal"
ledgerDirs: "1\t/data/bookkeeper/ledgers"
instanceId: "e44f080b-a6ba-4b5e-97f0-0a0303bfd295"

a fast check on the code and the problem maybe was because I've used a specified indexDirs instead of the default (ledgerdir) one ? but the code seems to assume that if the cookie is blank then it's the ledgerDirs ( and shouldn't assume that because can be configured differently in the configuration )

https://github.com/StevenLuMT/bookkeeper/blob/905d317c5ab6e700aa3195259c274b55a70540c5/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Cookie.java#L142-L143

as note for others in the same situation my workaround has been to do a rolling update with the reset cookie bin/bookkeeper shell bookieformat -deleteCookie on each bookie

Ok, let me check it.

@horizonzy
Copy link
Member

I'm not sure if I am missing something because this is a year old merged bug .. but updating a cluster from 4.15.4 to 4.16.3 (both using the dockerhub official images ) I still get this incompatibility issue , shouldn't the cookie be compatible and get updated once the 4.16+ bookie starts ?

2023-09-21T09:36:00,280 - ERROR - [main:Main@218] - Failed to build bookie server
org.apache.bookkeeper.bookie.BookieException$InvalidCookieException: Cookie [5
bookieHost: "bk1"
journalDir: "/data/bookkeeper/journal"
ledgerDirs: "1\t/data/bookkeeper/ledgers"
instanceId: "e44f080b-a6ba-4b5e-97f0-0a0303bfd295"
indexDirs: "1\t/data/bookkeeper/index"
] is not matching with [5
bookieHost: "bk1"
journalDir: "/data/bookkeeper/journal"
ledgerDirs: "1\t/data/bookkeeper/ledgers"
instanceId: "e44f080b-a6ba-4b5e-97f0-0a0303bfd295"

a fast check on the code and the problem maybe was because I've used a specified indexDirs instead of the default (ledgerdir) one ? but the code seems to assume that if the cookie is blank then it's the ledgerDirs ( and shouldn't assume that because can be configured differently in the configuration )

https://github.com/StevenLuMT/bookkeeper/blob/905d317c5ab6e700aa3195259c274b55a70540c5/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Cookie.java#L142-L143

as note for others in the same situation my workaround has been to do a rolling update with the reset cookie bin/bookkeeper shell bookieformat -deleteCookie on each bookie

Yes, it's indeed a problem. If the cookie doesn't has indexDirs, we shouldn't consider ledgerDirs as its value.

@horizonzy
Copy link
Member

I'm not sure if I am missing something because this is a year old merged bug .. but updating a cluster from 4.15.4 to 4.16.3 (both using the dockerhub official images ) I still get this incompatibility issue , shouldn't the cookie be compatible and get updated once the 4.16+ bookie starts ?

2023-09-21T09:36:00,280 - ERROR - [main:Main@218] - Failed to build bookie server
org.apache.bookkeeper.bookie.BookieException$InvalidCookieException: Cookie [5
bookieHost: "bk1"
journalDir: "/data/bookkeeper/journal"
ledgerDirs: "1\t/data/bookkeeper/ledgers"
instanceId: "e44f080b-a6ba-4b5e-97f0-0a0303bfd295"
indexDirs: "1\t/data/bookkeeper/index"
] is not matching with [5
bookieHost: "bk1"
journalDir: "/data/bookkeeper/journal"
ledgerDirs: "1\t/data/bookkeeper/ledgers"
instanceId: "e44f080b-a6ba-4b5e-97f0-0a0303bfd295"

a fast check on the code and the problem maybe was because I've used a specified indexDirs instead of the default (ledgerdir) one ? but the code seems to assume that if the cookie is blank then it's the ledgerDirs ( and shouldn't assume that because can be configured differently in the configuration )

https://github.com/StevenLuMT/bookkeeper/blob/905d317c5ab6e700aa3195259c274b55a70540c5/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Cookie.java#L142-L143

as note for others in the same situation my workaround has been to do a rolling update with the reset cookie bin/bookkeeper shell bookieformat -deleteCookie on each bookie

I think we should upgrade the cookie version, or we can't know the indexDirs is a really null or just a old version without indexDirs.

@horizonzy
Copy link
Member

I'm not sure if I am missing something because this is a year old merged bug .. but updating a cluster from 4.15.4 to 4.16.3 (both using the dockerhub official images ) I still get this incompatibility issue , shouldn't the cookie be compatible and get updated once the 4.16+ bookie starts ?

2023-09-21T09:36:00,280 - ERROR - [main:Main@218] - Failed to build bookie server
org.apache.bookkeeper.bookie.BookieException$InvalidCookieException: Cookie [5
bookieHost: "bk1"
journalDir: "/data/bookkeeper/journal"
ledgerDirs: "1\t/data/bookkeeper/ledgers"
instanceId: "e44f080b-a6ba-4b5e-97f0-0a0303bfd295"
indexDirs: "1\t/data/bookkeeper/index"
] is not matching with [5
bookieHost: "bk1"
journalDir: "/data/bookkeeper/journal"
ledgerDirs: "1\t/data/bookkeeper/ledgers"
instanceId: "e44f080b-a6ba-4b5e-97f0-0a0303bfd295"

a fast check on the code and the problem maybe was because I've used a specified indexDirs instead of the default (ledgerdir) one ? but the code seems to assume that if the cookie is blank then it's the ledgerDirs ( and shouldn't assume that because can be configured differently in the configuration )

https://github.com/StevenLuMT/bookkeeper/blob/905d317c5ab6e700aa3195259c274b55a70540c5/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Cookie.java#L142-L143

as note for others in the same situation my workaround has been to do a rolling update with the reset cookie bin/bookkeeper shell bookieformat -deleteCookie on each bookie

I have submitted a PR to fix it. Could you help to check it? #4087

Ghatage pushed a commit to sijie/bookkeeper that referenced this pull request Jul 12, 2024
Descriptions of the changes in this PR:

### Motivation
Fixes apache#3430, make cookie validation is compatible with old version.
I think we should check indexDirs when configuration‘s indexDirectories is setted  rather than avoiding the check 

### Changes
1. add compatible check 
2. add testcase to cover the new code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cookie compatible problem.

6 participants