clintropolis commented on code in PR #19830:
URL: https://github.com/apache/druid/pull/19830#discussion_r3938059499
##########
extensions-core/druid-catalog/src/main/java/org/apache/druid/catalog/storage/sql/SQLCatalogManager.java:
##########
@@ -71,6 +73,17 @@
private static final String PROPERTIES_COL = "properties";
private static final String COLUMNS_COL = "columns";
+ /**
+ * The version for a row being written: the current time, but strictly after
{@code lastVersion}, which is the
+ * version the writer read ({@code 0} when there is none, as for a new row).
The version doubles as the
+ * compare-and-set token and as the cache's ordering key, so it must
actually advance on every write, even when two
+ * writes land in the same millisecond.
+ */
+ private static long nextVersion(long lastVersion)
+ {
+ return Math.max(System.currentTimeMillis(), lastVersion + 1);
Review Comment:
this value is only persisted when the compare-and-set (updateTime =
oldVersion) matches the stored version, so the only path where a user supplies
this value would at most prevent update from happening. Other callers are just
reading the existing value from the table, and the value itself is
inserted/updated as derived from current time millis, so shouldn't be at risk
of overflow.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]