In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
Today, I will talk to you about how to specify OID as Date type in Sequoiadb. Many people may not know much about it. In order to let you know more, Xiaobian summarizes the following contents for you. I hope you can gain something according to this article.
[Problem Description]
Specify OID type as Date. Will this cause duplicate oid values in scenarios with high concurrency? For example:
1. Create threads, insert OID of type Date into each thread:
BSONObject obj = new BasicBSONObject();
Date now = new Date();
obj.put("date", now);
2. Start multiple threads at the same time. Is oid repeated in case of multiple concurrent insertions?
[Solution]
1. OID is a 12-byte BSON data type. Generation rule: 4 bytes timestamp accurate to seconds
3 byte system (physical machine) identification
2 byte process ID
3 byte sequence number starting with a random number
2. From the above generation rules, OID is globally unique in a cluster environment
3. Java BSON OID generation rules are slightly different, Java OID 12 byte content consists of three parts:
4 byte timestamp accurate to the second
4 byte system (physical machine) identification
4 byte sequence number starting with a random number
4. Therefore, OIDs generated using java drivers are guaranteed to be unique within a group, not globally in a clustered environment
After reading the above, do you have any further understanding of how to specify OID as Date type in Sequoiadb? If you still want to know more knowledge or related content, please pay attention to the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.