Data processing method and device, equipment and computer readable storage medium
By setting timeouts and managing the lifespan of DNS records in authoritative DNS servers, the problem of DNS record remnants during service outages is resolved, ensuring the stability and accuracy of the user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA MOBILE GROUP ZHEJIANG
- Filing Date
- 2022-04-24
- Publication Date
- 2026-05-05
AI Technical Summary
In existing technologies, DNS records still exist in the DNS system when the service is abnormal or terminated abnormally, resulting in a decline in user experience.
By setting a timeout in the authoritative DNS server, the lifespan of DNS records is monitored, and the corresponding DNS records are deleted when they expire. The storage and feedback of DNS records are managed in combination with record type and expiration value.
Effective deletion of expired DNS records ensures that users can still access the address accurately when the service is down, thus improving the user experience.
Smart Images

Figure CN116980385B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a data processing method, apparatus, device, and computer-readable storage medium. Background Technology
[0002] DNS (Domain Name System) is widely used for service discovery in various distributed systems. In systems that typically use DNS for service discovery, each service generally registers records such as A, AAAA, PTR, and SRV, which are then used by other services for access. This technology is widely used on the Internet. In traditional DNS service discovery, when a DNS server in a location receives a resolution request, it sends the request to the DNS server specified for the domain name to obtain the resolution record. After obtaining the record, the local DNS server stores it for a period of time. During this period, if it receives another resolution request for the same domain name, the DNS server will directly return the resolution record to the client without performing another recursive query.
[0003] In related technologies, DNS record updates rely on periodic service registration. When a service malfunctions or terminates abnormally, the corresponding DNS records still exist in the DNS system and do not disappear with the termination of the service. Summary of the Invention
[0004] The main objective of this invention is to provide a data processing method, apparatus, device, and computer-readable storage medium, which aims to solve the technical problem that when a service malfunctions or terminates abnormally, the corresponding DNS record still exists in the DNS system.
[0005] To achieve the above objectives, the present invention provides a data processing method applied in a DNS authoritative server, the data processing method comprising the following steps:
[0006] Determine if a target timeout has expired in the first timeout corresponding to the first DNS record in the database;
[0007] If a target timeout occurs, the target timeout is deleted, and the second DNS record corresponding to the target timeout and the current system time corresponding to the second DNS record are deleted from the database.
[0008] Furthermore, the data processing method further includes:
[0009] Upon receiving a registration request for a third DNS record, the first record type corresponding to the third DNS record is obtained;
[0010] If the first record type matches the preset record type, then obtain the first expiration value corresponding to the expiration field in the third DNS record;
[0011] If the first expiration value meets the preset conditions, then the second timeout corresponding to the third DNS record is started based on the first time to live in the third DNS record;
[0012] The current system time and the third DNS record are associated and stored in the database.
[0013] Furthermore, the data processing method further includes:
[0014] Upon receiving a DNS record query request, obtain the query domain name and the second record type corresponding to the query request;
[0015] If there is no first target DNS record in the database that is the same as the queried domain name and has the same second record type, then it is determined whether there is a second target DNS record in the database based on the queried domain name, wherein the second record type of the second target DNS record is a preset record type that matches the second record type;
[0016] If the second target DNS record exists, then the third target DNS record corresponding to the second target DNS record is returned.
[0017] Furthermore, the step of feeding back the third target DNS record corresponding to the second target DNS record if the second target DNS record exists includes:
[0018] Obtain the second expiration value corresponding to the expiration field in the second target DNS record;
[0019] If the second expiration value meets the preset conditions, then obtain the second time to live in the second target DNS record;
[0020] Based on the second time to live, determine the third target DNS record corresponding to the second target DNS record, and then provide feedback on the third target DNS record.
[0021] Further, the step of determining the third target DNS record corresponding to the second target DNS record based on the second time-to-live (TTL) and feeding back the third target DNS record includes:
[0022] Based on the second time to live, the current system time corresponding to the second target DNS record, and the current time, determine whether the second target DNS record has timed out;
[0023] If the second target DNS record has not expired, then the target time to live is determined based on the second time to live, the current system time corresponding to the second target DNS record, and the current time.
[0024] The second target DNS record is updated based on the target time to live and the second record type to obtain the fourth target DNS record;
[0025] Delete the expired field in the fourth target DNS record to obtain the third target DNS record, and then return the third target DNS record.
[0026] Furthermore, after the step of obtaining the second expiration value corresponding to the expiration field in the second target DNS record, the data processing method further includes:
[0027] If the second expiration value does not meet the preset conditions, the second target DNS record is updated based on the second record type to obtain the fifth target DNS record;
[0028] Delete the expired field from the fifth target DNS record to obtain the sixth target DNS record, and then return the sixth target DNS record.
[0029] Furthermore, the data processing method further includes:
[0030] If the first record type does not match the preset record type, or if the first expiration value does not meet the preset conditions, then the third DNS record is stored in the database.
[0031] Furthermore, to achieve the above objectives, the present invention also provides a data processing apparatus, the data processing apparatus comprising:
[0032] The determination module is used to determine whether there is a timeout target timeout in the first timeout corresponding to the first DNS record in the database;
[0033] The deletion module is used to delete the target timeout if a target timeout exists, and delete the second DNS record corresponding to the target timeout and the current system time corresponding to the second DNS record in the database.
[0034] In addition, to achieve the above objectives, the present invention also provides a data processing device, the data processing device comprising: a memory, a processor, and a data processing program stored in the memory and executable on the processor, wherein the data processing program, when executed by the processor, implements the steps of the aforementioned data processing method.
[0035] In addition, to achieve the above objectives, the present invention also provides a computer-readable storage medium storing a data processing program, which, when executed by a processor, implements the steps of the aforementioned data processing method.
[0036] This invention determines whether there is an expired target timeout in the first timeout corresponding to the first DNS record in the database. If there is an expired target timeout, the target timeout is deleted, and the second DNS record corresponding to the target timeout and the current system time corresponding to the second DNS record are deleted from the database. This can delete expired DNS records based on target timeouts, avoiding the problem that the corresponding DNS record still exists in the DNS system when a certain service is abnormal, and improving the user experience. Attached Figure Description
[0037] Figure 1 This is a schematic diagram of the structure of a data processing device in the hardware operating environment involved in the embodiments of the present invention;
[0038] Figure 2 This is a flowchart illustrating the first embodiment of the data processing method of the present invention;
[0039] Figure 3 This is a schematic diagram of the functional modules of an embodiment of the data processing device of the present invention.
[0040] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0041] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0042] Figure 1 This is a schematic diagram of the structure of a data processing device in the hardware operating environment involved in the embodiments of the present invention.
[0043] The terminal in this invention embodiment can be a PC, or a smartphone, tablet computer, e-book reader, MP3 (Moving Picture Experts Group Audio Layer III) player, MP4 (Moving Picture Experts Group Audio Layer IV) player, portable computer, or other portable terminal devices with display functions.
[0044] like Figure 1As shown, the terminal may include: a processor 1001, such as a CPU; a network interface 1004; a user interface 1003; a memory 1005; and a communication bus 1002. The communication bus 1002 is used to enable communication between these components. The user interface 1003 may include a display screen and an input unit such as a keyboard. Optionally, the user interface 1003 may also include a standard wired interface or a wireless interface. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface). The memory 1005 may be high-speed RAM or non-volatile memory, such as a disk drive. Optionally, the memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0045] Optionally, the terminal may also include a camera, RF (Radio Frequency) circuitry, sensors, audio circuitry, a WiFi module, and so on. Sensors may include light sensors, motion sensors, and other sensors. Specifically, light sensors may include ambient light sensors and proximity sensors. The ambient light sensor can adjust the display brightness according to the ambient light level, while the proximity sensor can turn off the display and / or backlight when the mobile terminal is moved to the ear. As a type of motion sensor, a gravity accelerometer can detect the magnitude of acceleration in various directions (generally three axes). When stationary, it can detect the magnitude and direction of gravity, and can be used for applications that identify the mobile terminal's posture (such as landscape / portrait switching, related games, magnetometer posture calibration), vibration recognition functions (such as pedometers, taps), etc. Of course, the mobile terminal may also be equipped with other sensors such as gyroscopes, barometers, hygrometers, thermometers, and infrared sensors, which will not be elaborated here.
[0046] Those skilled in the art will understand that Figure 1 The terminal structure shown does not constitute a limitation on the terminal and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0047] like Figure 1 As shown, the memory 1005, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and a data processing program.
[0048] exist Figure 1 In the terminal shown, the network interface 1004 is mainly used to connect to the backend server and communicate with the backend server; the user interface 1003 is mainly used to connect to the client (user terminal) and communicate with the client; and the processor 1001 can be used to call the data processing program stored in the memory 1005.
[0049] In this embodiment, the data processing device includes: a memory 1005, a processor 1001, and a data processing program stored in the memory 1005 and executable on the processor 1001. When the processor 1001 calls the data processing program stored in the memory 1005, it executes the steps of the data processing methods in the following embodiments.
[0050] This invention also provides a data processing method applied to a DNS authoritative server, see reference. Figure 2 , Figure 2 This is a flowchart illustrating the first embodiment of the data processing method of the present invention.
[0051] In this embodiment, the data processing method is applied to the authoritative DNS server and includes the following steps:
[0052] Step S101: Determine whether there is a timeout target timeout in the first timeout corresponding to the first DNS record in the database;
[0053] The database can be a storage module in the DNS authoritative server, or a storage device that communicates with and is connected to the DNS authoritative server.
[0054] In this embodiment, during DNS record registration, timeouts are pre-set for a subset of DNS records that meet certain conditions. The authoritative DNS server monitors all first timeouts in real time and determines whether there is a timeout target among the first timeouts corresponding to the first DNS records in the database. The first DNS records are the DNS records corresponding to all first timeouts in the database of the authoritative DNS server. Specifically, the first timeout starts counting from the current system time when the first timeout corresponding to the first DNS record is created. When the preset countdown timer reaches its limit, it is determined that there is a timeout target among the first timeouts corresponding to the first DNS records in the database. The duration of the first timeout can be set according to the second time-to-live (TTL) setting in the first DNS record. Specifically, when the TTL of the first DNS record is 3600 seconds, the first timeout can either count down or perform a countdown. When the countdown reaches 3600 seconds or the countdown reaches 0, the first timeout is determined to have timed out. In another method, the timeout time can be calculated based on the current system time and the time to live. For example, if the current Beijing time is 4:00 AM and the time to live of the first DNS record is 3600 seconds, then the timeout time corresponding to the first timeout is 5:00 AM Beijing time.
[0055] Step S102: If a target timeout exists, delete the target timeout and delete the second DNS record corresponding to the target timeout and the current system time corresponding to the second DNS record in the database.
[0056] In this embodiment, if there is a timeout target timeout, the second DNS record corresponding to the timeout target and the current system time corresponding to the second DNS record are found in the database according to the timeout target, and the second DNS record and the current system time are deleted. Then the timeout target timeout is deleted.
[0057] In this embodiment, by determining whether there is an expired target timeout in the first timeout corresponding to the first DNS record in the database, and then deleting the target timeout if there is an expired target timeout, and deleting the second DNS record corresponding to the target timeout and the current system time corresponding to the second DNS record in the database, expired DNS records can be deleted according to the target timeout, avoiding the problem that the DNS record corresponding to a certain service failure still exists in the DNS system, thus improving the user experience.
[0058] Based on the first embodiment, a second embodiment of the data processing method of the present invention is proposed. In this embodiment, the data processing method further includes:
[0059] Step S201: Upon receiving a registration request for a third DNS record, obtain the first record type corresponding to the third DNS record;
[0060] In this embodiment, the authoritative DNS server receives a large number of registration requests for third-party DNS records from various servers. These servers periodically send these registration requests, with the period itself configurable by the server's ISP. Upon receiving a registration request, the authoritative DNS server obtains the record type information corresponding to the third-party DNS record. This first record type information includes standard record types and preset record types. Standard record types include existing DNS resolution records such as A records, AAAA records, PTR records, and SRV records. Preset standard records can be manually set and can be, for example, SA records matching A records, SAAAA records matching AAAA records, SPTR records matching PTR records, and SSRV records matching SRV records.
[0061] Step S202: If the first record type matches the preset record type, then obtain the first expiration value corresponding to the expiration field in the third DNS record;
[0062] In this embodiment, the DNS authoritative server determines whether the first record type matches the preset record type. If the first record type matches the preset record type, it obtains the first expiration value corresponding to the expiration field in the third DNS record. The expiration field is the third DNS record with an expired field added to the rdata field of the standard record. The expiration field in the third DNS record can include an expiration value, which can be set to 0 or 1. When the expiration value corresponding to the third DNS record is 0, it indicates that the third DNS record has expired (dead), and the third DNS record is directly saved to the database. When the expiration value corresponding to the third DNS record is 1, it indicates that the third DNS record has not expired (dead), and step S103 is executed.
[0063] For example, the first default record type, SA, matches the standard DNS A record, with the format: domain name, effective date, network protocol type, record type field, 0 / 1, and the IPv4 address corresponding to the domain name, e.g., www.example.com 3600IN SA 1 127.0.0.1; the second record type, SAAAA, matches the standard DNS AAAA record, with the format: domain name, effective date, network protocol type, record type field, 0 / 1 (expired), and the IPv6 address corresponding to the domain name, e.g., www.example.com 3600IN SAAAA 1::1; the third record type, SPTR, matches the standard DNS PRT record, with the format: domain name, effective date, network protocol type, record type field, 0 / 1 (expired), and the domain name corresponding to the IP address, specifically, e.g., 1.0.0.127.in-addr.arpa 3600IN SPTR 1. www.example.com.; The fourth type of record, SSRV, matches the standard DNS SRV type record. The default format of the SRV record type is: domain name, effective time, record type field, network protocol type, 0 / 1 (expire), priority, weight, port, and corresponding domain name. For example, xmpp._tcp.example.com.86400IN SSRV 1 10 5 5223server.example.com.
[0064] Step S203: If the first expiration value meets the preset conditions, then the second timeout corresponding to the third DNS record is started based on the first time to live in the third DNS record, and the current system time and the third DNS record are associated and stored in the database.
[0065] In this embodiment, after obtaining the first expiration value corresponding to the expiration field in the third DNS record, the authoritative DNS server determines whether the first expiration value meets a preset condition. If the first expiration value is 0, the corresponding third DNS record is directly saved to the database. If the first expiration value is 1, a second timeout corresponding to the third DNS record is created based on the current system time and started. The current system time can be obtained through a computer program or set to Beijing time. In one method, the second timeout can be set according to the second time-to-live (TTL) in the third DNS record. Then, the current system time and the third DNS record are associated and stored in the database.
[0066] Specifically, when the time-to-live (TTL) of the third DNS record is 3600 seconds, the second timeout can either count down or count down. The timeout is determined to have expired when the countdown reaches 3600 seconds or the countdown reaches 0. Alternatively, the timeout can be calculated based on the current system time and the TTL. For example, if the current Beijing time is 4:00 AM and the TTL of the third DNS record is 3600 seconds, then the corresponding timeout for the second timeout is 5:00 AM Beijing time.
[0067] It should be noted that if the first expiration value meets the preset conditions, the authoritative DNS server can first determine whether a fourth DNS record identical to the third DNS record exists in the database. If it does not exist, step S203 is executed directly. If it exists, the timeout corresponding to the fourth DNS record is deleted, and the fourth DNS record and its corresponding current system time are deleted from the database. Then, step S203 is executed. Alternatively, if it exists, the timeout corresponding to the fourth DNS record is deleted, the second timeout corresponding to the third DNS record is started based on the first time-to-live in the third DNS record, and the current system time corresponding to the fourth DNS record in the database is updated based on the current system time.
[0068] This embodiment obtains the first record type corresponding to the third DNS record when a registration request for the third DNS record is received. If the first record type matches a preset record type, the first expiration value corresponding to the expiration field in the third DNS record is obtained. Then, if the first expiration value meets a preset condition, the second timeout corresponding to the third DNS record is started based on the first time-to-live in the third DNS record. The current system time and the third DNS record are then associated and stored in the database. This allows the timeout corresponding to the third DNS record to be started according to the preset record type and the first expiration value, which facilitates the subsequent deletion of expired DNS records based on the timeout. This avoids the problem that the corresponding DNS record still exists in the DNS system when a certain service is abnormal.
[0069] Based on the first embodiment, a third embodiment of the data processing method of the present invention is proposed. In this embodiment, the data processing method further includes:
[0070] Step S301: Upon receiving a DNS record query request, obtain the query domain name and the second record type corresponding to the query request;
[0071] In this embodiment, upon receiving a request, the recursive server determines the query domain name and second record type corresponding to the request, and sends a DNS record query request to the authoritative DNS server based on the query domain name and second record type. When the authoritative DNS server receives the DNS record query request, it obtains the query domain name and second record type corresponding to the query request. The second record type includes standard record types (existing DNS record types), such as A records, AAAA records, PTR records, and SRV records. Specifically, for example, if a user or other device needs to call the service "demo" using an A record, the local recursive server will initiate an A record query request for demo.example.com to the authoritative DNS server, thereby obtaining the query domain name and second record type for demo.example.com.
[0072] Step S302: If there is no first target DNS record in the database that is the same as the queried domain name and has the same second record type, then determine whether there is a second target DNS record in the database based on the queried domain name, wherein the second record type of the second target DNS record is a preset record type that matches the second record type;
[0073] If the database does not contain a first target DNS record with the same domain name and the same second record type as the queried domain name, when a first target DNS record with the same domain name but a different record type than the second record type is found in the database, the DNS authority server determines whether a second target DNS record exists in the database based on the queried domain name. If it does not exist, it returns null; if it exists, it executes step S303, where the second record type of the second target DNS record is a preset record type that matches the second record type. Specifically, for example, when the queried domain name is demo.example.com and the record type is A record, if no A record corresponding to demo.example.com is found in the database, it will continue to search for an SA record that matches the A record. When a record corresponding to demo.example.com with the preset record type SA is found in the database, it is determined that a second target DNS record exists; if no record corresponding to demo.example.com with the preset record type SA is found, a null value is directly returned.
[0074] Step S303: If the second target DNS record exists, then the third target DNS record corresponding to the second target DNS record is returned.
[0075] In this embodiment, if the DNS authoritative server finds a second target DNS record in the database, the DNS authoritative server will send the third target DNS record corresponding to the second target DNS record back to the recursive server.
[0076] In one embodiment, after obtaining the query domain name and the second record type corresponding to the query request, the DNS authoritative server first queries the database for the domain name and the record type corresponding to the domain name. If a first target DNS record with the same second record type as the query domain name exists in the database, the DNS authoritative server directly returns the first target DNS record to the recursive server. Specifically, for example, when the query domain name is demo.example.com and the record type is A record, the DNS authoritative server first queries the database for demo.example.com, then finds the record type corresponding to demo.example.com. If an A record corresponding to demo.example.com is found in the database, the first target DNS record corresponding to the A record is directly returned to the recursive server.
[0077] This embodiment, upon receiving a DNS record query request, obtains the query domain name and second record type corresponding to the query request. If no first target DNS record with the same query domain name and second record type exists in the database, then it determines whether a second target DNS record exists in the database based on the query domain name. The second record type of the second target DNS record is a preset record type that matches the second record type. If the second target DNS record exists, it provides feedback on the third target DNS record corresponding to the second target DNS record. Based on the determined third target DNS record corresponding to the second target DNS record, the user can accurately access the address within the lifetime of the third target DNS record, improving the user experience.
[0078] Based on the third embodiment, a fourth embodiment of the data processing method of the present invention is proposed. In this embodiment, step S303 includes:
[0079] S401, Obtain the second expiration value corresponding to the expiration field in the second target DNS record;
[0080] S402, if the second expiration value meets the preset condition, then obtain the second time to live in the second target DNS record;
[0081] S403, determine the third target DNS record corresponding to the second target DNS record based on the second time to live, and feed back the third target DNS record.
[0082] In this embodiment, the second expiration value corresponding to the expiration field in the second target DNS record is obtained. The second expiration value can be set to 1 or 0. In one implementation, when the expiration value is 0, after obtaining the second target DNS record, the expiration field in the second target DNS record is deleted, and the second target record is updated according to the second record type to obtain the corresponding third target DNS record. The third target DNS record is then sent back to the recursive server. An expiration value of 1 satisfies a preset condition. If the second expiration value is 1, the second time-to-live (TTL) in the second target DNS record is obtained. Based on the second TTL, the third target DNS record corresponding to the second target DNS record can be determined, and the third target DNS record is sent back to the recursive server.
[0083] This embodiment obtains the second expiration value corresponding to the expiration field in the second target DNS record. If the second expiration value meets the preset conditions, the second time-to-live (TTL) in the second target DNS record is obtained. Then, based on the second TTL, the third target DNS record corresponding to the second target DNS record is determined and the third target DNS record is fed back. The third target DNS record can be accurately determined according to the second expiration value and the second TTL, so that users can accurately access the address within the TTL of the third target DNS record, thereby improving the user experience.
[0084] Based on the fourth embodiment, a fifth embodiment of the data processing method of the present invention is proposed. In this embodiment, step S403 includes:
[0085] S501, based on the second time-to-live, the current system time corresponding to the second target DNS record, and the current time, determine whether the second target DNS record has timed out;
[0086] Based on the current system time corresponding to the second target DNS record, as well as the current time and the second time-to-live (TTL), the difference between the current time and the current system time can be calculated and compared with the TTL. If the difference between the current time and the current system time is greater than the TTL, the second target DNS record is determined to have timed out. If the difference between the current time and the current system time is less than the TTL, the second target DNS record is determined not to have timed out.
[0087] S502, if the second target DNS record has not expired, then the target time to live is determined based on the second time to live, the current system time corresponding to the second target DNS record, and the current time;
[0088] In this embodiment, when the second target DNS record has not timed out, the target lifetime can be obtained by calculating the difference between the current time and the current system time, and then subtracting the difference from the second lifetime. For example, in one implementation, the current absolute time is 5 PM, the current time is 5:01 PM, and the second lifetime is 120 seconds. Then, the difference between the current time and the absolute time is 60 seconds, and the target lifetime is the second lifetime minus the difference, i.e., 120 seconds minus 60 seconds. In another implementation, the current absolute time is 5 PM, the current time is 5:01 PM, and the second lifetime is the corresponding lifetime time of 5:02 PM. Then, the difference between the current time and the absolute time is 1 minute, and the target lifetime is the second lifetime minus the difference, i.e., 2 minutes minus 1 minute.
[0089] S503, update the second target DNS record based on the target time to live and the second record type to obtain the fourth target DNS record;
[0090] In this embodiment, the second target DNS record type and target time-to-live (TTL) are used to replace the record type and second TTL in the second target DNS record to obtain the fourth target DNS record. For example, if the second target DNS record type is A record and the target TTL is 1 minute, and the second TTL in the second target DNS record is 2 minutes and the record type is SA record, then the replaced second target DNS record will have a second TTL of 2 minutes and a record type of A record.
[0091] S504, delete the expired field in the fourth target DNS record, obtain the third target DNS record, and return the third target DNS record.
[0092] In this embodiment, after obtaining the fourth target DNS record, deleting the expired field in the fourth target DNS record will yield the corresponding third target DNS record, which will then be fed back to the recursive server.
[0093] This embodiment determines whether the second target DNS record has expired based on the second time-to-live (TTL), the current system time corresponding to the second target DNS record, and the current time. If the second target DNS record has not expired, the target TTL is determined based on the second TTL, the current system time corresponding to the second target DNS record, and the current time. Then, the second target DNS record is updated based on the target TTL and the second record type to obtain a fourth target DNS record. Subsequently, the expired field in the fourth target DNS record is deleted to obtain the third target DNS record, and the third target DNS record is fed back. The third target DNS record can be accurately obtained based on the second TTL, the current system time, and the current time. By modifying the TTL corresponding to the third target DNS record, the TTL of the third target DNS record cached by the recursive server is reduced, thereby avoiding the amplification of the effective time of the second target DNS record. This allows users to accurately access the address within the TTL of the third target DNS record, improving the user experience.
[0094] Based on the fourth embodiment, six embodiments of the data processing method of the present invention are proposed. In this embodiment, the method includes the following steps after step S401:
[0095] S601, if the second expiration value does not meet the preset conditions, then update the second target DNS record based on the second record type to obtain the fifth target DNS record;
[0096] S602, delete the expired field in the fifth target DNS record, obtain the sixth target DNS record, and return the sixth target DNS record.
[0097] In this embodiment, the record type in the second target DNS record is replaced with the record type in the second target DNS record to obtain the fifth target DNS record. Specifically, for example, if the second record type is A record and the record type of the second target DNS record is SA record, then the record type of the replaced second target DNS record is A record. Then, the expired field in the fifth target DNS record is deleted to obtain the sixth target DNS record, and the sixth target DNS record is fed back.
[0098] This embodiment updates the second target DNS record based on the second record type to obtain a fifth target DNS record if the second expiration value does not meet the preset conditions. Then, it deletes the expiration field in the fifth target DNS record to obtain a sixth target DNS record and feeds back the sixth target DNS record. This can accurately feed back the sixth target DNS record based on the second expiration value, allowing users to access the address accurately and improving the user experience.
[0099] Based on the first to sixth embodiments, seven embodiments of the data processing method of the present invention are proposed. In this embodiment, the data processing method includes the following steps:
[0100] S701, if the first record type does not match the preset record type, or if the first expiration value does not meet the preset condition, then the third DNS record is stored in the database.
[0101] In this embodiment, the server sends a registration request for a third DNS record, and the authoritative DNS server receives the registration request. It then obtains the first record type corresponding to the third DNS record. The first record type information includes standard record types and preset record types. Standard record types include existing DNS resolution records such as A records, AAAA records, PTR records, and SRV records. Preset standard records can be manually set and can be SA records matching A records, SAAAA records matching AAAA records, SPTR records matching PTR records, SSRV records matching SRV records, etc. When the first record type is one of the standard record types, the third DNS record is stored in the database. When the first record type is one of the preset record types, the server further obtains the first expiration value corresponding to the expiration field in the third DNS record. If the expiration value does not meet the preset conditions, the third DNS record is stored in the database. For example, when the server registers a third DNS record using an A record, the authoritative DNS server stores the third DNS record in the database. When a server registers a third DNS record using the SA record method, it further determines the first expiration value of a preset field in the third DNS record. If the first expiration value is 0, the preset condition is not met, and the authoritative DNS server stores the third DNS record in the database.
[0102] This embodiment stores the third DNS record in the database if the first record type does not match the preset record type, or if the first expiration value does not meet the preset conditions. This allows for compatibility with existing DNS service discovery technologies based on record type matching, enabling users to accurately access addresses and improving user experience.
[0103] The present invention also provides a data processing apparatus, with reference to Figure 3 The data processing device includes:
[0104] The determination module 10 is used to determine whether there is a timeout target timeout in the first timeout corresponding to the first DNS record in the database;
[0105] The deletion module 20 is used to delete the target timeout if there is a timeout, and delete the second DNS record corresponding to the target timeout and the current system time corresponding to the second DNS record in the database.
[0106] Furthermore, the data processing device is also used for:
[0107] Upon receiving a registration request for a third DNS record, the first record type corresponding to the third DNS record is obtained;
[0108] If the first record type matches the preset record type, then obtain the first expiration value corresponding to the expiration field in the third DNS record;
[0109] If the first expiration value meets the preset conditions, then the second timeout corresponding to the third DNS record is started based on the first time to live in the third DNS record, and the current system time and the third DNS record are associated and stored in the database.
[0110] Furthermore, the data processing device is also used for:
[0111] Upon receiving a DNS record query request, obtain the query domain name and the second record type corresponding to the query request;
[0112] If there is no first target DNS record in the database that is the same as the queried domain name and has the same second record type, then it is determined whether there is a second target DNS record in the database based on the queried domain name, wherein the second record type of the second target DNS record is a preset record type that matches the second record type;
[0113] If the second target DNS record exists, then the third target DNS record corresponding to the second target DNS record is returned.
[0114] Furthermore, the data processing device is also used for:
[0115] Obtain the second expiration value corresponding to the expiration field in the second target DNS record;
[0116] If the second expiration value meets the preset conditions, then obtain the second time to live in the second target DNS record;
[0117] Based on the second time to live, determine the third target DNS record corresponding to the second target DNS record, and then provide feedback on the third target DNS record.
[0118] Furthermore, the data processing device is also used for:
[0119] Based on the second time to live, the current system time corresponding to the second target DNS record, and the current time, determine whether the second target DNS record has timed out;
[0120] If the second target DNS record has not expired, then the target time to live is determined based on the second time to live, the current system time corresponding to the second target DNS record, and the current time.
[0121] The second target DNS record is updated based on the target time to live and the second record type to obtain the fourth target DNS record;
[0122] Delete the expired field in the fourth target DNS record to obtain the third target DNS record, and then return the third target DNS record.
[0123] Furthermore, the data processing device is also used for:
[0124] If the second expiration value does not meet the preset conditions, the second target DNS record is updated based on the second record type to obtain the fifth target DNS record;
[0125] Delete the expired field from the fifth target DNS record to obtain the sixth target DNS record, and then return the sixth target DNS record.
[0126] Furthermore, the data processing device is also used for:
[0127] If the first record type does not match the preset record type, or if the first expiration value does not meet the preset conditions, then the third DNS record is stored in the database.
[0128] Furthermore, this invention also proposes a data processing device, which includes: a memory, a processor, and a data processing program stored in the memory and executable on the processor. When executed by the processor, the data processing program implements the steps of the data processing method described above.
[0129] Furthermore, embodiments of the present invention also propose a computer-readable storage medium on which a data processing program is stored, wherein when the data processing program is executed by a processor, it implements the steps of the data processing method described above.
[0130] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.
[0131] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0132] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0133] The above are merely preferred embodiments of the present invention and do not limit the scope of the patent. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.
Claims
1. A data processing method, characterized in that, Applied to authoritative DNS servers in the Domain Name System, the data processing method includes the following steps: Determine if a target timeout has expired in the first timeout corresponding to the first DNS record in the database; If a target timeout occurs, delete the target timeout and delete the second DNS record corresponding to the target timeout and the current system time corresponding to the second DNS record in the database. The data processing method further includes: Upon receiving a registration request for a third DNS record, the first record type corresponding to the third DNS record is obtained; If the first record type matches the preset record type, then obtain the first expiration value corresponding to the expiration field in the third DNS record; If the first expiration value meets the preset conditions, then the second timeout corresponding to the third DNS record is started based on the first time to live in the third DNS record, and the current system time and the third DNS record are associated and stored in the database.
2. The data processing method as described in claim 1, characterized in that, The data processing method further includes: Upon receiving a DNS record query request, obtain the query domain name and the second record type corresponding to the query request; If there is no first target DNS record in the database that is the same as the queried domain name and has the same second record type, then it is determined whether there is a second target DNS record in the database based on the queried domain name, wherein the second record type of the second target DNS record is a preset record type that matches the second record type; If the second target DNS record exists, then the third target DNS record corresponding to the second target DNS record is returned.
3. The data processing method as described in claim 2, characterized in that, The step of providing feedback on the third target DNS record corresponding to the second target DNS record if the second target DNS record exists includes: Obtain the second expiration value corresponding to the expiration field in the second target DNS record; If the second expiration value meets the preset conditions, then obtain the second time to live in the second target DNS record; Based on the second time to live, determine the third target DNS record corresponding to the second target DNS record, and then provide feedback on the third target DNS record.
4. The data processing method as described in claim 3, characterized in that, The step of determining the third target DNS record corresponding to the second target DNS record based on the second time-to-live (TTL) and feeding back the third target DNS record includes: Based on the second time to live, the current system time corresponding to the second target DNS record, and the current time, determine whether the second target DNS record has timed out; If the second target DNS record has not expired, then the target time to live is determined based on the second time to live, the current system time corresponding to the second target DNS record, and the current time. The second target DNS record is updated based on the target time to live and the second record type to obtain the fourth target DNS record; Delete the expired field in the fourth target DNS record to obtain the third target DNS record, and then return the third target DNS record.
5. The data processing method as described in claim 3, characterized in that, After the step of obtaining the second expiration value corresponding to the expiration field in the second target DNS record, the data processing method further includes: If the second expiration value does not meet the preset conditions, the second target DNS record is updated based on the second record type to obtain the fifth target DNS record; Delete the expired field from the fifth target DNS record to obtain the sixth target DNS record, and then return the sixth target DNS record.
6. The data processing method according to any one of claims 1 to 5, characterized in that, The data processing method further includes: If the first record type does not match the preset record type, or if the first expiration value does not meet the preset conditions, then the third DNS record is stored in the database.
7. A data processing apparatus, characterized in that, The data processing device, used in authoritative DNS servers of the Domain Name System, includes: The determination module is used to determine whether there is a timeout target timeout in the first timeout corresponding to the first DNS record in the database; The deletion module is used to delete the target timeout if a target timeout exists, and delete the second DNS record corresponding to the target timeout and the current system time corresponding to the second DNS record in the database. The data processing device is further configured to: Upon receiving a registration request for a third DNS record, the first record type corresponding to the third DNS record is obtained; If the first record type matches the preset record type, then obtain the first expiration value corresponding to the expiration field in the third DNS record; If the first expiration value meets the preset conditions, then the second timeout corresponding to the third DNS record is started based on the first time to live in the third DNS record, and the current system time and the third DNS record are associated and stored in the database.
8. A data processing device, characterized in that, The data processing device includes: a memory, a processor, and a data processing program stored in the memory and executable on the processor, wherein when the data processing program is executed by the processor, it implements the steps of the data processing method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a data processing program, which, when executed by a processor, implements the steps of the data processing method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Method and system for optimizing DNS root service access
WO2017049789A1