-
Notifications
You must be signed in to change notification settings - Fork 492
[KV] Kvstore snapshot queries #2409
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
base: main
Are you sure you want to change the base?
Conversation
| } | ||
| } | ||
|
|
||
| public void startKeepAlivePeriodically(int keepAliveIntervalMs) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where do we plan to start to start keepalives? This method seems currently unused.
Separately, I wonder if we're giving clients too much control over holding server resources with keepalives. I can see issue where clients forget to close and server starts leaking iterators.
Should we simplify and get rid of keepalives and refresh iterator TTL on server side whenever a ScanKvRequest is made?
It's a two-way door to release this feature without keepalive. We cannot easily remove keepalive mechanism once added as it would break clients who rely on keepalive mechanism.
| * Creates a new {@link SnapshotQuery} for this table to configure and execute a snapshot query | ||
| * to read all current data in a table bucket (requires to be a Primary Key Table). | ||
| */ | ||
| SnapshotQuery newSnapshotQuery(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: SnapshotQuery sounds like querying an existing snapshot. I cannot think of any name though.. maybe just Query?
| public void keepAlive(byte[] scannerId) { | ||
| ScannerContext context = scanners.get(ByteBuffer.wrap(scannerId)); | ||
| if (context != null) { | ||
| context.updateLastAccessTime(clock.milliseconds()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this thread safe? What if the context is cleaned right after you retrieve it from the map?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think every scanner should have an access lock protection, just like what kudu does: https://github.com/apache/kudu/blob/master/src/kudu/tserver/scanners.h#L384
| this.scannerTtlMs = conf.get(ConfigOptions.SERVER_SCANNER_TTL).toMillis(); | ||
| this.cleanupExecutor = | ||
| Executors.newSingleThreadScheduledExecutor( | ||
| new ExecutorThreadFactory("scanner-cleanup-thread")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we reuse the scheduler defined in TabletServer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
absolutely
No description provided.