lamber-ken commented on a change in pull request #3243: [CARBONDATA-3401] fix
the java sdk create wrong carbondata filename
URL: https://github.com/apache/carbondata/pull/3243#discussion_r288371901
##########
File path:
store/sdk/src/main/java/org/apache/carbondata/sdk/file/CarbonWriterBuilder.java
##########
@@ -580,7 +580,7 @@ private void setCsvHeader(CarbonLoadModel model) {
public CarbonLoadModel buildLoadModel(Schema carbonSchema)
throws IOException, InvalidLoadOptionException {
- timestamp = System.nanoTime();
+ timestamp = System.currentTimeMillis();
Review comment:
> in Concurrency (in same JVM multiple threads) System.currentTimeMillis()
can be same , which can overwrite existing carbonfile .
Hi @BJangir, thanks for your mention about the concurrent problem. I have
some points from my side.
**First**, the filename is consisted of (taskNo, batch_prefix, batchNo,
bucketNumber, segmentNo, factUpdateTimestamp), I think the filename may nerver
same.
**Second**, it's a wrong way to use `System.nanoTime()` to assign to the
timestamp, the value returned represents nanoseconds since some fixed but
arbitrary origin time (perhaps in the future, so values may be negative), so
the filename may like this
```
53353670335116_batchno0-0-null--12341312341.carbonindex
part-0--100010000_batchno0-0-null--12341312341.carbondata
```
**Thrid**, from the java doc, it says the values returned by this method
become meaningful only when the difference between two such values, obtained
within the same instance of a Java virtual machine, is computed.
[Java Platform SE doc](https://docs.oracle.com/javase/8/docs/api/index.html)
Please correct me if I am wrong, thanks.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services