Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@olavloite
Copy link

A user can specify a read-only staleness value to use for a read-only transaction by executing a statement that is parsed by the client. This util parses the possible staleness values and can translate these back to text values.

@olavloite olavloite requested a review from kolea2 July 24, 2019 05:42
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jul 24, 2019
class ReadOnlyStalenessUtil {
private static final TimeZone GMT = TimeZone.getTimeZone("GMT");
/** Regular expression for parsing RFC3339 times with nanosecond precision. */
private static final String RFC3339_REGEX =
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Author

Choose a reason for hiding this comment

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

The RFC parser in the http client has millisecond precision, both for parsing and converting to string values. Switching to that one is possible, but would mean that we would not be able to support microsecond or nanosecond precision.

Copy link
Contributor

Choose a reason for hiding this comment

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

In that case, let's add the enhanced precision to the http client repository, and use the current http client implementation with a todo for now since this is still in a branch.

Copy link
Author

Choose a reason for hiding this comment

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

I've changed the JDBC implementation to use the parser in the http client, and I've added a PR in the http client for adding nanosecond support.

@olavloite olavloite requested a review from kolea2 July 25, 2019 11:34
}
}

static final class GetMaxStaleness implements DurationValueGetter {
Copy link
Contributor

Choose a reason for hiding this comment

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

minor - can address now or in future commit - I would rename to "MaxStalenessGetter"

/**
* Parses an RFC3339 date/time value with millisecond precision and returns this as a {@link
* Timestamp}. Although {@link Timestamp} has nanosecond precision, this method is only used for
* parsing read-only staleness values, and more than millisecond precision is not needed for that.
Copy link
Contributor

Choose a reason for hiding this comment

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

minor can address in upcoming - I would just replace this with a todo for nanosecond precision

@olavloite olavloite merged commit 30e2530 into googleapis:spanner-jdbc Jul 25, 2019
olavloite added a commit to olavloite/google-cloud-java that referenced this pull request Aug 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants