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
sql: ExtendLease() returns existing valid unexpired lease #7781
Conversation
Review status: 0 of 2 files reviewed at latest revision, 10 unresolved discussions. sql/schema_changer.go, line 81 [r1] (raw file):
if you feel so inclined, let's change this to not use sql/schema_changer.go, line 150 [r1] (raw file):
rename to sql/schema_changer.go, line 150 [r1] (raw file):
Comment that this needs to be called early and often when performing schema changes. sql/schema_changer.go, line 161 [r1] (raw file):
sql/schema_changer.go, line 161 [r1] (raw file):
I'd say let's move this out of the txn, since it's the common case, and the txn reading the descriptor is expensive. sql/schema_changer_test.go, line 59 [r1] (raw file):
Let's keep fighting the crusade changing such globals :). They lead to races and overall headaches. Pass it through the params. If you keep the lease life value, instead of changing it below (which you couldn't easily do through the Of course, the correct thing to do is neither changing the value, nor introducing a knob, but advancing the clock, but alas the sql/schema_changer_test.go, line 87 [r1] (raw file):
use sql/schema_changer_test.go, line 103 [r1] (raw file):
I think a better error would be "lease was not extended" sql/schema_changer_test.go, line 106 [r1] (raw file):
Can you explain why this is expected to fail? I suspect we're using this failure to Maybe we can also improve the schema changer interface so that it's more stupid-proof (less likely for someone to forget to call ExtendLease). How about we make all the code in schema changer only get table descriptor through a (schema change) lease (so the lease would have a sql/schema_changer_test.go, line 112 [r1] (raw file):
is the fact that releasing an old lease fails important, or just an implementation artifact? If it's not important, I'd say remove it from the test. Comments from Reviewable |
ExtendLease() was always writing to the table descriptor resulting in the system config getting gossiped more often than needed. This change writes a lease with a new expiration time only when the lease is closer to its expiration time. With schema changes now executing in chunks and ExtendLease() being called more often after each chunk is processed, forcing a new expiration time is unnecessary.
436bacb
to
9e64e5a
Compare
Thanks for reviewing this change! Review status: 0 of 2 files reviewed at latest revision, 10 unresolved discussions, some commit checks pending. sql/schema_changer.go, line 81 [r1] (raw file):
|
Review status: 0 of 2 files reviewed at latest revision, 10 unresolved discussions, all commit checks successful. sql/schema_changer.go, line 161 [r1] (raw file):
|
Review status: 0 of 2 files reviewed at latest revision, 10 unresolved discussions, all commit checks successful. sql/schema_changer.go, line 161 [r1] (raw file):
|
Review status: 0 of 2 files reviewed at latest revision, 10 unresolved discussions, all commit checks successful. sql/schema_changer.go, line 161 [r1] (raw file):
|
Review status: 0 of 2 files reviewed at latest revision, 10 unresolved discussions, all commit checks successful. sql/schema_changer.go, line 161 [r1] (raw file):
|
Review status: 0 of 2 files reviewed at latest revision, 10 unresolved discussions, all commit checks successful. sql/schema_changer.go, line 161 [r1] (raw file):
|
thanks. There is also the option to return a lease instead of using a On Thu, Jul 14, 2016 at 7:35 PM Andrei Matei notifications@github.com
|
ExtendLease() was always writing to the table descriptor resulting
in the system config getting gossiped more often than needed.
This change writes a lease with a new expiration time only when the
lease is closer to its expiration time. With schema changes now
executing in chunks and ExtendLease() being called more often after
each chunk is processed, forcing a new expiration time is
unnecessary.
fixes #7724
This change is