Electronic device and method for managing database using high-speed storage
By determining the appropriate use of high-speed storage for journaling operations within the electronic device, the method addresses performance and fragmentation issues in traditional database management systems, resulting in improved efficiency and storage optimization.
Patent Information
- Application Number
- PCT/KR2024/019358
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-02-06
- Filing Date
- 2024-11-29
- Publication Date
- 2025-06-26
AI Technical Summary
Existing database management systems face challenges in efficiently utilizing high-speed storage for journaling operations, leading to performance issues and fragmentation in traditional storage systems.
The electronic device employs a method to determine whether to use a faster second storage area for managing a database, generating journal information, and updating it based on transactions, while also handling cases where the journal information is not generated in the second storage.
This approach enhances database management efficiency by utilizing high-speed storage for journaling, reducing fragmentation, and improving overall system performance by optimizing storage usage.
Smart Images

Figure KR2024019358_26062025_PF_FP_ABST
Abstract
Description
Electronic device and method for managing a database using high-speed storage
[0001] The present disclosure relates to an electronic device and method for managing a database using high-speed storage.
[0002] An electronic device may include a storage device. A database, which is a collection of data, may be stored within the storage device. The electronic device may configure a system for managing the database.
[0003] The above information may be provided as background art to aid in understanding the present disclosure. No claim or determination is made as to whether any of the above is applicable as prior art in connection with the present disclosure.
[0004] According to one embodiment, an electronic device may include a memory including a first storage and a second storage having an access speed faster than that of the first storage; and a processor. Instructions stored in the memory, when executed by the processor, may cause the electronic device to determine whether an authorization is granted to perform a read and write operation of the database using the second storage among the first storage or the second storage, using information related to a database stored in the memory. Instructions stored in the memory, when executed by the processor, may cause the electronic device to execute a function of generating journal information related to the database stored in the first storage in the second storage based on the determination that the authorization is granted. The instructions stored in the memory, when executed by the processor, may cause the electronic device to update the journal information stored in the second storage according to a transaction related to the database, based on the execution of the function, based on the journal information stored in the second storage. The instructions stored in the memory, when executed by the processor, may cause the electronic device to generate the journal information in the first storage based on the determination that the journal information was not generated in the second storage by the execution of the function.
[0005] In one embodiment, an electronic device may include a memory and a processor, the memory including a first storage area and a second storage area having a faster access speed than the first storage area. Instructions stored in the memory, when executed by the processor, may cause the electronic device to determine, using information related to a database stored in the memory, whether management of the database using the second storage area among the first storage area or the second storage area is permitted. Instructions stored in the memory, when executed by the processor, may cause the electronic device to execute a function of generating journal information related to the database stored in the first storage area in the second storage area based on determining that management of the database using the second storage area is permitted. Instructions stored in the memory, when executed by the processor, may cause the electronic device to update the journal information stored in the second storage area according to a transaction related to the database based on the execution of the function, based on the journal information stored in the second storage area. The instructions stored in the memory, when executed by the processor, may cause the journal information to be generated in the first storage area based on the execution of the function, and based on the determination that the journal information is not generated in the second storage area by the execution of the function.
[0006] In one embodiment, a method performed by an electronic device including a memory including a first storage and a second storage having an access speed faster than the first storage may include an operation of determining whether management of the database using the second storage among the first storage or the second storage is permitted, using information related to a database stored in the memory. The method may include an operation of executing a function of generating journal information related to the database stored in the first storage in the second storage based on determining whether management of the database using the second storage is permitted. The method may include an operation of updating the journal information stored in the second storage according to a transaction related to the database based on the execution of the function, based on the journal information stored in the second storage. The method may include an operation of generating the journal information in the first storage based on determining that the journal information was not generated in the second storage by the execution of the function, based on the execution of the function.
[0007] In one embodiment, a computer-readable storage medium may store one or more programs. The one or more programs, when executed by a processor of an electronic device including a memory including a first storage and a second storage having an access speed faster than the first storage, may cause the electronic device to determine, using information related to a database stored in the memory, whether management of the database using the second storage among the first storage or the second storage is permitted. The one or more programs, when executed by the processor, may cause the electronic device to execute a function of generating journal information related to the database stored in the first storage in the second storage based on determining that management of the database using the second storage is permitted. The one or more programs, when executed by the processor, may cause the electronic device to update the journal information stored in the second storage according to a transaction related to the database based on the journal information stored in the second storage based on the execution of the function. The one or more programs, when executed by the processor, may cause the electronic device to create the journal information in the first storage based on the determination that the journal information is not created in the second storage by the execution of the function.
[0008] FIG. 1 is a block diagram of an electronic device within a network environment according to various embodiments.
[0009] FIG. 2 is a block diagram illustrating a program according to various embodiments.
[0010] FIG. 3 is an exemplary block diagram of an electronic device according to one embodiment.
[0011] FIG. 4 is an exemplary block diagram of an electronic device according to one embodiment.
[0012] FIG. 5 is an exemplary flowchart illustrating a method for setting up high-speed storage journaling according to one embodiment.
[0013] FIG. 6 is an exemplary flowchart illustrating a method for determining whether high-speed storage is used, according to one embodiment.
[0014] FIG. 7 is an exemplary flowchart illustrating a method for creating a journal directory of high-speed storage according to one embodiment.
[0015] FIG. 8 is an exemplary flowchart illustrating a method for checking journal file path information according to one embodiment.
[0016] FIG. 9 is an exemplary flowchart illustrating a method for processing transactions using high-speed storage in rollback journal mode, according to one embodiment.
[0017] FIG. 10 is an exemplary flowchart illustrating a method for generating a journal file in WAL mode according to one embodiment.
[0018] FIG. 11 is an exemplary flowchart illustrating a method of processing a transaction using high-speed storage in WAL mode according to one embodiment.
[0019] FIG. 12 is an exemplary flowchart illustrating a method for determining whether a path change of a journal file is required by pre-examining the capacity of high-speed storage according to one embodiment.
[0020] Figure 13 is an exemplary flowchart illustrating a method for changing a journal file path in WAL mode according to an example.
[0021] FIG. 14 is an exemplary flowchart illustrating a method for updating journal information in WAL mode according to one embodiment.
[0022] FIG. 1 is a block diagram of an electronic device (101) within a network environment (100) according to various embodiments. Referring to FIG. 1, in the network environment (100), the electronic device (101) may communicate with the electronic device (102) via a first network (198) (e.g., a short-range wireless communication network), or may communicate with at least one of the electronic device (104) or the server (108) via a second network (199) (e.g., a long-range wireless communication network). According to one embodiment, the electronic device (101) may communicate with the electronic device (104) via the server (108). According to one embodiment, the electronic device (101) may include a processor (120), a memory (130), an input module (150), an audio output module (155), a display module (160), an audio module (170), a sensor module (176), an interface (177), a connection terminal (178), a haptic module (179), a camera module (180), a power management module (188), a battery (189), a communication module (190), a subscriber identification module (196), or an antenna module (197). In some embodiments, the electronic device (101) may omit at least one of these components (e.g., the connection terminal (178)), or may have one or more other components added. In some embodiments, some of these components (e.g., the sensor module (176), the camera module (180), or the antenna module (197)) may be integrated into one component (e.g., the display module (160)).
[0023] The processor (120) may control at least one other component (e.g., a hardware or software component) of the electronic device (101) connected to the processor (120) by executing, for example, software (e.g., a program (140)), and may perform various data processing or calculations. According to one embodiment, as at least a part of the data processing or calculation, the processor (120) may store a command or data received from another component (e.g., a sensor module (176) or a communication module (190)) in a volatile memory (132), process the command or data stored in the volatile memory (132), and store the resulting data in a non-volatile memory (134). According to one embodiment, the processor (120) may include a main processor (121) (e.g., a central processing unit or an application processor) or a secondary processor (123) (e.g., a graphics processing unit, a neural processing unit (NPU), an image signal processor, a sensor hub processor, or a communication processor) that can operate independently or together therewith. For example, if the electronic device (101) includes a main processor (121) and a secondary processor (123), the secondary processor (123) may be configured to use less power than the main processor (121) or to be specialized for a specified function. The secondary processor (123) may be implemented separately from the main processor (121) or as a part thereof.
[0024] The auxiliary processor (123) may control at least a portion of functions or states associated with at least one component (e.g., a display module (160), a sensor module (176), or a communication module (190)) of the electronic device (101), for example, on behalf of the main processor (121) while the main processor (121) is in an inactive (e.g., sleep) state, or together with the main processor (121) while the main processor (121) is in an active (e.g., application execution) state. In one embodiment, the auxiliary processor (123) (e.g., an image signal processor or a communication processor) may be implemented as a part of another functionally related component (e.g., a camera module (180) or a communication module (190)). In one embodiment, the auxiliary processor (123) (e.g., a neural network processing unit) may include a hardware structure specialized for processing artificial intelligence models. The artificial intelligence models may be generated through machine learning. This learning can be performed, for example, on the electronic device (101) itself where the artificial intelligence model is executed, or can be performed through a separate server (e.g., server (108)). The learning algorithm can include, for example, supervised learning, unsupervised learning, semi-supervised learning, or reinforcement learning, but is not limited to the examples described above. The artificial intelligence model can include multiple artificial neural network layers.The artificial neural network may be one of a deep neural network (DNN), a convolutional neural network (CNN), a recurrent neural network (RNN), a restricted Boltzmann machine (RBM), a deep belief network (DBN), a bidirectional recurrent deep neural network (BRDNN), a deep Q-network, or a combination of two or more of the above, but is not limited to the examples described above. In addition to, or alternatively to, a hardware structure, an artificial intelligence model may include a software structure.
[0025] The memory (130) can store various data used by at least one component (e.g., processor (120) or sensor module (176)) of the electronic device (101). The data can include, for example, software (e.g., program (140)) and input data or output data for commands related thereto. The memory (130) can include volatile memory (132) or non-volatile memory (134).
[0026] The program (140) may be stored as software in memory (130) and may include, for example, an operating system (142), middleware (144), or an application (146).
[0027] The input module (150) can receive commands or data to be used in a component of the electronic device (101) (e.g., a processor (120)) from an external source (e.g., a user) of the electronic device (101). The input module (150) can include, for example, a microphone, a mouse, a keyboard, a key (e.g., a button), or a digital pen (e.g., a stylus pen).
[0028] The audio output module (155) can output audio signals to the outside of the electronic device (101). The audio output module (155) can include, for example, a speaker or a receiver. The speaker can be used for general purposes, such as multimedia playback or recording playback. The receiver can be used to receive incoming calls. According to one embodiment, the receiver can be implemented separately from the speaker or as part of the speaker.
[0029] The display module (160) can visually provide information to an external party (e.g., a user) of the electronic device (101). The display module (160) may include, for example, a display, a holographic device, or a projector and a control circuit for controlling the device. According to one embodiment, the display module (160) may include a touch sensor configured to detect a touch, or a pressure sensor configured to measure the intensity of a force generated by the touch.
[0030] The audio module (170) can convert sound into an electrical signal, or vice versa, convert an electrical signal into sound. According to one embodiment, the audio module (170) can acquire sound through the input module (150), output sound through the sound output module (155), or an external electronic device (e.g., electronic device (102)) (e.g., speaker or headphone) directly or wirelessly connected to the electronic device (101).
[0031] The sensor module (176) can detect the operating status (e.g., power or temperature) of the electronic device (101) or the external environmental status (e.g., user status) and generate an electrical signal or data value corresponding to the detected status. According to one embodiment, the sensor module (176) can include, for example, a gesture sensor, a gyro sensor, a barometric pressure sensor, a magnetic sensor, an acceleration sensor, a grip sensor, a proximity sensor, a color sensor, an IR (infrared) sensor, a biometric sensor, a temperature sensor, a humidity sensor, or an illuminance sensor.
[0032] The interface (177) may support one or more designated protocols that may be used to directly or wirelessly connect the electronic device (101) with an external electronic device (e.g., the electronic device (102)). In one embodiment, the interface (177) may include, for example, a high definition multimedia interface (HDMI), a universal serial bus (USB) interface, an SD card interface, or an audio interface.
[0033] The connection terminal (178) may include a connector through which the electronic device (101) may be physically connected to an external electronic device (e.g., electronic device (102)). According to one embodiment, the connection terminal (178) may include, for example, an HDMI connector, a USB connector, an SD card connector, or an audio connector (e.g., a headphone connector).
[0034] A haptic module (179) can convert electrical signals into mechanical stimuli (e.g., vibration or movement) or electrical stimuli that a user can perceive through tactile or kinesthetic sensations. According to one embodiment, the haptic module (179) can include, for example, a motor, a piezoelectric element, or an electrical stimulation device.
[0035] The camera module (180) can capture still images and videos. According to one embodiment, the camera module (180) may include one or more lenses, image sensors, image signal processors, or flashes.
[0036] The power management module (188) can manage power supplied to the electronic device (101). According to one embodiment, the power management module (188) can be implemented as, for example, at least a part of a power management integrated circuit (PMIC).
[0037] A battery (189) may power at least one component of the electronic device (101). In one embodiment, the battery (189) may include, for example, a non-rechargeable primary battery, a rechargeable secondary battery, or a fuel cell.
[0038] The communication module (190) may support the establishment of a direct (e.g., wired) communication channel or a wireless communication channel between the electronic device (101) and an external electronic device (e.g., electronic device (102), electronic device (104), or server (108)), and the performance of communication through the established communication channel. The communication module (190) may operate independently from the processor (120) (e.g., application processor) and may include one or more communication processors that support direct (e.g., wired) communication or wireless communication. According to one embodiment, the communication module (190) may include a wireless communication module (192) (e.g., a cellular communication module, a short-range wireless communication module, or a global navigation satellite system (GNSS) communication module) or a wired communication module (194) (e.g., a local area network (LAN) communication module, or a power line communication module). Among these communication modules, the corresponding communication module can communicate with an external electronic device (104) via a first network (198) (e.g., a short-range communication network such as Bluetooth, Wi-Fi (wireless fidelity) direct, or IrDA (infrared data association)) or a second network (199) (e.g., a long-range communication network such as a legacy cellular network, a 5G network, a next-generation communication network, the Internet, or a computer network (e.g., a LAN or WAN)). These various types of communication modules can be integrated into a single component (e.g., a single chip) or implemented as multiple separate components (e.g., multiple chips). The wireless communication module (192) can verify or authenticate the electronic device (101) within a communication network such as the first network (198) or the second network (199) by using subscriber information (e.g., an international mobile subscriber identity (IMSI)) stored in the subscriber identification module (196).
[0039] The wireless communication module (192) can support 5G networks and next-generation communication technologies following the 4G network, such as NR access technology (new radio access technology). The NR access technology can support high-speed transmission of high-capacity data (eMBB (enhanced mobile broadband)), minimization of terminal power and connection of multiple terminals (mMTC (massive machine type communications)), or high reliability and low latency (URLLC (ultra-reliable and low-latency communications)). The wireless communication module (192) can support, for example, a high-frequency band (e.g., mmWave band) to achieve a high data transmission rate. The wireless communication module (192) can support various technologies for securing performance in a high-frequency band, such as beamforming, massive multiple-input and multiple-output (MIMO), full dimensional MIMO (FD-MIMO), array antenna, analog beam-forming, or large scale antenna. The wireless communication module (192) can support various requirements specified in the electronic device (101), an external electronic device (e.g., the electronic device (104)), or a network system (e.g., the second network (199)). According to one embodiment, the wireless communication module (192) may support a peak data rate (e.g., 20 Gbps or more) for eMBB realization, a loss coverage (e.g., 164 dB or less) for mMTC realization, or a U-plane latency (e.g., 0.5 ms or less for downlink (DL) and uplink (UL), or 1 ms or less for round trip) for URLLC realization.
[0040] The antenna module (197) can transmit or receive signals or power to or from an external device (e.g., an external electronic device). According to one embodiment, the antenna module (197) may include an antenna including a radiator formed of a conductor or a conductive pattern formed on a substrate (e.g., a PCB). According to one embodiment, the antenna module (197) may include a plurality of antennas (e.g., an array antenna). In this case, at least one antenna suitable for a communication method used in a communication network, such as the first network (198) or the second network (199), may be selected from the plurality of antennas by, for example, the communication module (190). A signal or power may be transmitted or received between the communication module (190) and an external electronic device via the selected at least one antenna. According to some embodiments, in addition to the radiator, another component (e.g., a radio frequency integrated circuit (RFIC)) may be additionally formed as a part of the antenna module (197).
[0041] According to various embodiments, the antenna module (197) may form a mmWave antenna module. According to one embodiment, the mmWave antenna module may include a printed circuit board, an RFIC disposed on or adjacent a first side (e.g., a bottom side) of the printed circuit board and capable of supporting a designated high-frequency band (e.g., a mmWave band), and a plurality of antennas (e.g., an array antenna) disposed on or adjacent a second side (e.g., a top side or a side side) of the printed circuit board and capable of transmitting or receiving signals in the designated high-frequency band.
[0042] At least some of the above components can be interconnected and exchange signals (e.g., commands or data) with each other via a communication method between peripheral devices (e.g., a bus, GPIO (general purpose input and output), SPI (serial peripheral interface), or MIPI (mobile industry processor interface)).
[0043] According to one embodiment, commands or data may be transmitted or received between the electronic device (101) and an external electronic device (104) via a server (108) connected to a second network (199). Each of the external electronic devices (102 or 104) may be the same or a different type of device as the electronic device (101). According to one embodiment, all or part of the operations executed in the electronic device (101) may be executed in one or more of the external electronic devices (102, 104, or 108). For example, when the electronic device (101) is to perform a certain function or service automatically or in response to a request from a user or another device, the electronic device (101) may, instead of or in addition to executing the function or service by itself, request one or more external electronic devices to perform the function or at least a part of the service. One or more external electronic devices that receive the request may execute at least a portion of the requested function or service, or an additional function or service related to the request, and transmit the result of the execution to the electronic device (101). The electronic device (101) may process the result as is or additionally and provide it as at least a portion of a response to the request. For this purpose, cloud computing, distributed computing, mobile edge computing (MEC), or client-server computing technology may be used, for example. The electronic device (101) may provide an ultra-low latency service by using distributed computing or mobile edge computing, for example. In another embodiment, the external electronic device (104) may include an Internet of Things (IoT) device. The server (108) may be an intelligent server utilizing machine learning and / or a neural network. According to one embodiment, the external electronic device (104) or the server (108) may be included in the second network (199).The electronic device (101) can be applied to intelligent services (e.g., smart home, smart city, smart car, or healthcare) based on 5G communication technology and IoT-related technology.
[0044] Figure 2 is a block diagram (200) illustrating a program (140) according to various embodiments. According to one embodiment, the program (140) may include an operating system (142), middleware (144), or an application (146) executable in the operating system (142) for controlling one or more resources of the electronic device (101). The operating system (142) may be, for example, Android. TM , iOS TM , Windows TM , Symbian TM , Tizen TM , or Bada TM At least some of the programs (140) may be preloaded onto the electronic device (101), for example, at the time of manufacture, or may be downloaded or updated from an external electronic device (e.g., electronic device (102 or 104), or server (108)) when used by the user.
[0045] The operating system (142) may control the management (e.g., allocation or retrieval) of one or more system resources (e.g., processes, memory, or power) of the electronic device (101). The operating system (142) may additionally or alternatively include one or more driver programs for driving other hardware devices of the electronic device (101), for example, an input module (150), an audio output module (155), a display module (160), an audio module (170), a sensor module (176), an interface (177), a haptic module (179), a camera module (180), a power management module (188), a battery (189), a communication module (190), a subscriber identification module (196), or an antenna module (197).
[0046] Middleware (144) can provide various functions to the application (146) so that functions or information provided from one or more resources of the electronic device (101) can be used by the application (146). Middleware (144) can include, for example, an application manager (201), a window manager (203), a multimedia manager (205), a resource manager (207), a power manager (209), a database manager (211), a package manager (213), a connectivity manager (215), a notification manager (217), a location manager (219), a graphics manager (221), a security manager (223), a call manager (225), or a voice recognition manager (227).
[0047] The application manager (201) can manage, for example, the life cycle of the application (146). The window manager (203) can manage, for example, one or more GUI resources used on the screen. The multimedia manager (205) can, for example, identify one or more formats required for playing media files, and perform encoding or decoding of a corresponding media file among the media files using a codec suitable for the corresponding format selected among the media files. The resource manager (207) can manage, for example, the source code of the application (146) or the memory space of the memory (130). The power manager (209) can manage, for example, the capacity, temperature, or power of the battery (189), and determine or provide related information necessary for the operation of the electronic device (101) using the corresponding information. According to one embodiment, the power manager (209) can be linked with the basic input / output system (BIOS) (not shown) of the electronic device (101).
[0048] The database manager (211) can, for example, create, search, or modify a database to be used by the application (146). The package manager (213) can, for example, manage the installation or update of an application distributed in the form of a package file. The connectivity manager (215) can, for example, manage a wireless connection or direct connection between the electronic device (101) and an external electronic device. The notification manager (217) can, for example, provide a function for notifying a user of the occurrence of a specified event (e.g., an incoming call, a message, or an alarm). The location manager (219) can, for example, manage location information of the electronic device (101). The graphics manager (221) can, for example, manage one or more graphic effects to be provided to the user or a user interface related thereto.
[0049] The security manager (223) may provide, for example, system security or user authentication. The telephony manager (225) may manage, for example, a voice call function or a video call function provided by the electronic device (101). The voice recognition manager (227) may, for example, transmit the user's voice data to the server (108) and receive, from the server (108), a command corresponding to a function to be performed in the electronic device (101) based at least in part on the voice data, or text data converted based at least in part on the voice data. In one embodiment, the middleware (244) may dynamically delete some existing components or add new components. In one embodiment, at least a portion of the middleware (144) may be included as a part of the operating system (142) or implemented as separate software different from the operating system (142).
[0050] The application (146) may include, for example, a home (251), a dialer (253), an SMS / MMS (255), an instant message (IM) (257), a browser (259), a camera (261), an alarm (263), a contact (265), a voice recognition (267), an email (269), a calendar (271), a media player (273), an album (275), a watch (277), a health (279) (e.g., measuring biometric information such as the amount of exercise or blood sugar), or an environmental information (281) (e.g., measuring barometric pressure, humidity, or temperature information) application. According to one embodiment, the application (146) may further include an information exchange application (not shown) that can support information exchange between the electronic device (101) and an external electronic device. The information exchange application may include, for example, a notification relay application configured to transmit designated information (e.g., a call, a message, or an alarm) to an external electronic device, or a device management application configured to manage an external electronic device. The notification relay application may, for example, transmit notification information corresponding to a designated event (e.g., receipt of an email) that occurred in another application (e.g., an email application (269)) of the electronic device (101) to the external electronic device. Additionally or alternatively, the notification relay application may receive notification information from the external electronic device and provide the information to a user of the electronic device (101).
[0051] A device management application may, for example, control the power (e.g., turning on or off) or the function (e.g., brightness, resolution, or focus) of an external electronic device or a component thereof (e.g., a display module or a camera module of the external electronic device) that communicates with the electronic device (101). The device management application may additionally or alternatively support the installation, deletion, or update of an application running on the external electronic device.
[0052] FIG. 3 is an exemplary block diagram of an electronic device according to one embodiment.
[0053] Referring to FIG. 3, an electronic device (301) according to one embodiment may be an example of the electronic device (101) of FIG. 1. For example, the electronic device (301) may include at least one of the components of the electronic device (101) of FIG. 1. For example, the electronic device (301) may include a processor (320) (e.g., the processor (120) of FIG. 1) and a memory (330) (e.g., the memory (130) of FIG. 1).
[0054] In one embodiment, the memory (330) may include a volatile memory (e.g., the volatile memory (132) of FIG. 1) and a non-volatile memory (e.g., the non-volatile memory (134) of FIG. 1). In one embodiment, the memory (330) (or the non-volatile memory) may include a first storage (332) and a second storage (334). In one embodiment, the first storage (332) and the second storage (334) may be formed in separate physically separated memories, or may be formed logically separated in one memory (330), or may be formed physically separated in one memory (330). In one embodiment, at least one of the first storage (332) or the second storage (334) may be formed in a structure that is electrically connected to a memory (not shown) external to the electronic device (301). In one embodiment, the electronic device (301) may include the first storage (332) and the second storage (334). In addition to storage (334), one or more additional storages may be included.
[0055] In one embodiment, the second storage (334) may have higher performance than the first storage (332). For example, the second storage (334) may have a faster access speed (e.g., input / output speed) than the first storage (332). In one embodiment, the second storage (334) having a faster access speed than the first storage (332) may be referred to as high-speed storage, and the first storage (332) may be referred to as low-speed storage or legacy storage. In one embodiment, the second storage (334) may have a smaller capacity than the first storage (332), but is not limited thereto.
[0056] In one embodiment, the first storage (332) and the second storage (334) may include storage devices of the same or different types. For example, the first storage (332) and / or the second storage (334) may include at least one of a persistent memory (PMEM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a mask ROM, a flash ROM, a flash memory, a hard drive, or a solid state drive (SSD).
[0057] In one embodiment, the first storage (332) and / or the second storage (334) may take the form of an internal memory included in the electronic device (301) or an external memory removable from the electronic device (301).
[0058] Although the first storage (332) and the second storage (334) have been described as independent or physically separate storage devices, they are not limited thereto. For example, the first storage (332) and / or the second storage (334) may include a storage area configured by one or more storage devices. For example, the first storage (332) and / or the second storage (334) may include a logical unit (LU) of flash memory that complies with the universal flash storage (UFS) standard (e.g., UFS 4.0) announced by the joint electron device engineering council (JEDEC). For example, the first storage (332) may include an LU of a UFS operating in a multi-level cell (MLC) mode or a triple level cell (TLC) mode, and the second storage (334) having a faster access speed than the first storage (332) may include an LU operating in a single level cell (SLC) mode or an MLC mode. In this respect, the first storage (332) and / or the second storage (334) may be referred to as a storage device or a storage area.
[0059] In one embodiment, the processor (320) may be operatively and / or electrically connected to the memory (330). The processor (320) may perform operations and / or data processing related to control and / or communication of various components of the electronic device (301) by executing instructions stored in the memory (330).
[0060] FIG. 4 is an exemplary block diagram of an electronic device according to one embodiment.
[0061] Referring to FIG. 4 together with FIG. 3, an electronic device (301) according to an embodiment may include an application (410) (e.g., the application (146) of FIG. 2), a database manager (420) (e.g., the database manager (211) of FIG. 2), and a file system (430) implemented on an operating system of the electronic device (301) (e.g., the operating system (142) of FIG. 2). For example, the application (410) and the database manager (420) may be executed on a user space, and the file system (430) may be executed on a kernel space. The user space may correspond to an area formed in a volatile memory (e.g., the volatile memory (132) of FIG. 1) of the electronic device (301) for executing an application program (e.g., the application (410)). The above kernel space may correspond to an area formed in the volatile memory of the electronic device (301) for the execution of other programs (e.g., system software included in the operating system (142)) different from the above application program.
[0062] In one embodiment, the application (410), the database manager (420), and the file system (430) may be executed by or on the processor (320) of the electronic device (301). For example, the application (410), the database manager (420), and the file system (430) may be stored in a memory (e.g., the memory (330) of FIG. 3) of the electronic device (301) in a form that may be executed by the processor (320). In one embodiment, the application (410), the database manager (420), and the file system (430) may be classified as software, and the first storage (332) and the second storage (334) may be classified as hardware.
[0063] In one embodiment, the file system (430) may mean rules for storing information in the memory (e.g., the non-volatile memory) of the electronic device (301), one or more programs configured to store, retrieve, and / or delete information in the memory according to the rules, or any combination thereof.
[0064] In one embodiment, a database manager (420), a database file (440), and an application (410) may constitute a database or database system of an electronic device (301).
[0065] In one embodiment, a processor of an electronic device (301) executing a database manager (420) (e.g., processor (320) of FIG. 3) may manage a database file (440). For example, but not limited to, the processor of the electronic device (301) may perform operations of reading (e.g., searching), updating, and adding data to the database file (440) using the database manager (420). For example, the database manager (420) may perform operations for changing data in the database file (440) according to various journal modes, which will be described later. The database manager (420) may perform the above-described operations based on commands received from an application (410) through an application programming interface (API), for example. In one embodiment, the database manager (420) may include various database management systems. For non-limiting examples, the database manager (420) may include SQLite, H2, HSQL, Apache Derby, and / or Firebird Embedded Server.
[0066] In one embodiment, the first storage (332) may store a database file (440). The database file (440) may store data related to the application (410). For example, the application (410) may invoke or call an API provided by the database manager (420) to access the database file (440), store data in the database file (440), or at least partially update the database file (440). For non-limiting examples, the database file (440) may include a database file based on SQLite. The number of database files (440) stored in the first storage (332) is not limited by the example illustrated in FIG. 4. For example, unlike the illustration, there may be multiple database files (440).
[0067] In one embodiment, the database file (440) may include a plurality of pages. Each page may have a fixed size. For a non-limiting example, the size of each page may be 4 KB. The first page of the plurality of pages may be composed of a database header and a schema, and the remaining pages may be composed of the contents of the database file (440) and a data structure for improving the search speed of the database file (440). The header of the database file (440) is used to verify the type and integrity of the file and may have a fixed size. For example, the header may have a size of 100 bytes in the case of SQLite, but is not limited thereto and may vary depending on the type of database. The header may include a magic string, page size, journal mode, total database size, and schema cookie of the database file (440). If the database file (440) is a relational database, the schema may be located on one or more pages of the database file. In one embodiment, each of the plurality of pages of the database file (440) may correspond to each node of data of a table stored in the form of a Btree. Leaf pages of the Btree may contain actual data. The first part of the page may include a page header including the type of page and the number of data. Following the page header, cell pointers corresponding to the number of records may be included. The cell pointers may indicate the location of record data within the page.
[0068] In one embodiment, a journaling method may be applied to ensure atomicity of a transaction related to a database file (440). The transaction may refer to a unit of operations performed to change the state of the database file (440). For example, the transaction may be a logical unit of work (LUW) of operations related to data of the database file (440), and may be a unit of interaction between the application (410) and the database file (440). The operation related to data of the database file (440) may refer to an operation of accessing the database file (440) based on a query language (Structured Query Language, SQL), which is a text starting with an operand (or query) such as OPEN, SELECT, INSERT, DELETE, UPDATE, and CLOSE. One transaction may refer to a set of one or more operations and / or queries related to data of the database file (440). In one embodiment, operations included in a transaction and related to data in a database file (440) may include data read operations, data add operations, data delete operations, and data modify operations. The commit of a transaction may mean that all operations related to data included in the transaction have been successfully performed. The atomicity may mean that the results of computing data in the database file (440) based on all operations included in a single transaction are either all reflected in the database file (440) or not all are reflected.
[0069] In one embodiment, the journaling method of the database file (440) may include, for example, a rollback journal mode and a write ahead logging (WAL) mode. In one embodiment, the journal file (450) may be used for the rollback journal mode or the WAL mode. The journal file (450) may store journal information according to a transaction of the rollback journal mode or the WAL mode.
[0070] The above rollback journal mode stores the original data of the database file (440) before being changed by a transaction in the journal file (450), and in this state, the data of the database file (440) can be changed (e.g., added, modified, or deleted) according to the transaction while the original data of the database file (440) is stored. Even if a problem occurs during the change of the database file (440), the database file (440) can be recovered using the original data of the database file (440) stored in the journal file (450). The journal file (450) in which the original data of the database file (440) is stored can be referred to as a rollback journal file. According to one embodiment, the database manager (420) can support various rollback methods, such as Persist, Truncate, and Delete, depending on the invalidation method for the journal file.
[0071] The above WAL mode (Write-Ahead logging) may generate a journal file (450) (e.g., a WAL file) before storing data in the database or performing an addition, modification, or deletion operation of an existing stored database, depending on the type of transaction. According to one embodiment, the WAL file may store an operation processing result related to the transaction. In one embodiment, before changing the database file (440) according to the transaction, the operation processing results according to the transaction (e.g., a change log of the database file (440)) may be stored in the journal file (450). Thereafter, by reflecting the operation processing results stored in the journal file (450) to the database file (440), the data of the database file (440) may be changed according to the transaction (e.g., adding, modifying, or deleting data). Accordingly, even if an error occurs while the operation processing results of the transaction are being stored in the journal file (450), the database file (440) is maintained in its original state, thereby ensuring data integrity. In WAL mode, a journal file (450) in which the results of operations processed according to a transaction are recorded may be referred to as a WAL file. In one embodiment, a checkpoint may be performed to transfer data written in the WAL file to a database file (440). Due to multiple write transactions, multiple pages reflecting modifications may be appended to the WAL file. Accordingly, the size of the WAL file may increase and read performance may deteriorate. For example, as the size of the WAL file increases, the storage capacity occupied by the WAL file may increase, resulting in inefficient storage usage. To prevent this problem, the checkpoint may be performed. Since the threads executing the checkpoint operate synchronously, other operations may not be performed until the checkpoint is completed.For example, while the checkpoint is in progress, other read and write transactions may not be allowed. By using the units of work referred to as threads (or instances, and / or processes), the processor of the electronic device (301) can execute instructions of different software applications substantially simultaneously. When performing operations (e.g., checkpoints) related to the database file (440) substantially simultaneously using each of the plurality of threads, the atomicity of the database file (440) may not be guaranteed, and therefore the processor may synchronously perform the operations of the plurality of threads related to the database file (440).
[0072] In one embodiment, the journal file (450) may be stored in the second storage (334). Upon completion of a write transaction in the rollback journal mode, the journal file (450) may be deleted or its size may be reduced to approximately 0 (e.g., truncate). In the WAL mode, after the checkpoint, the journal file (450) may be deleted or its size may be reduced to approximately 0.
[0073] In one embodiment, since the journal file (450) is temporarily stored to ensure atomicity in the write transaction of the database file (440), the creation and deletion of the journal file (450) may be repeated. If the journal file (450) is stored in the first storage (332) where the database file (440) is stored, the repeated creation and deletion of the journal file (450) may cause fragmentation and performance degradation of the first storage (332). To prevent this, the database file (440) may be directly stored in the second storage (334) which has higher performance than the first storage (332). However, this method may be impossible because the size of the database file (440) generally increases and the capacity of the second storage (334) is also limited. Additionally, when the journal file (450) is used in a fixed manner within the second storage (334), the execution of the transaction may fail due to insufficient available capacity of the second storage (334).
[0074] In order to reduce the fragmentation problem of the first storage (332) and to efficiently use the second storage (334), which is a high-speed storage, the electronic device (301) according to one embodiment may store the journal file (450) in the first storage (332) or the second storage (334) according to various conditions. For example, the electronic device (301) according to one embodiment may use the configuration information related to the database stored in the memory to determine whether management of the database using the second storage (334) among the first storage (332) or the second storage (334) is permitted. After determining that management of the database using the second storage (334) is permitted, the electronic device (301) may create a journal file (450) related to the database file (440) (or the database) stored in the first storage (332) in the second storage (334). The electronic device (301) may create a journal file (450) in the first storage (332) based on a failure in creating a journal file (450) in the second storage (334). According to one embodiment, in an electronic device (301) using two types of storage, a journal file path management technique utilizing xattr may be used to store a rollback journal file and a WAL journal file in a path of the second storage (334), which is a high-speed storage, rather than in a database path of the first storage (332), which is a legacy storage.
[0075] Hereinafter, operations of the electronic device (301) will be described with reference to FIGS. 3 and 4 together. The operations described below may be performed by at least one component of the electronic device (301). For example, the operations described below may be performed by the processor (320) of the electronic device (301). For example, instructions stored in the memory (130), when executed by the processor (320), may cause the electronic device (301) to perform the operations described below.
[0076] FIG. 5 is an exemplary flowchart illustrating a method for setting up high-speed storage journaling according to one embodiment. FIG. 5 illustrates operations for setting up journaling using a second storage (334), which is a high-speed storage, in an electronic device (301), according to one embodiment.
[0077] The operations illustrated in FIG. 5 may be performed sequentially, but are not necessarily performed sequentially. For example, the order of the operations may be changed, and at least two operations may be performed in parallel or substantially simultaneously. Optionally or alternatively, some of the operations illustrated in FIG. 5 may be omitted.
[0078] The operations of FIG. 5, for example, operation 510, may be initiated by a call to an API or a SQL statement (e.g., a PRAGMA command) specified in the application (410).
[0079] In operation 510, the processor (320) may determine whether high-speed storage is available. For example, the processor (320) may determine whether the second storage (334) among the first storage (332) and the second storage (334) is available. Operation 510 is described in detail with reference to FIG. 6. If it is determined in operation 510 that high-speed storage is available, operation 520 may be performed. Otherwise, operation 550 may be performed.
[0080] In operation 520, the processor (320) may create a journal directory of the high-speed storage. For example, the processor (320) may create a journal directory (or directory path) in the second storage (334) where the journal file (450) is stored. Operation 520 is described in detail with reference to FIG. 7. In operation 520, if the creation of the journal directory of the high-speed storage is successful (operation 530: Yes), operation 540 may be performed. Alternatively, in operation 520, if the creation of the journal directory of the high-speed storage fails (operation 530: No), operation 550 may be performed.
[0081] In operation 540, the processor (320) may configure the use of high-speed storage journaling. For example, the processor (320) may configure a configuration value indicating whether journaling using the second storage (334) is activated. The configuration value may be stored in an in-memory format. For example, the configuration value may be stored in a volatile memory of the memory (330) (e.g., the volatile memory (132) of FIG. 1).
[0082] In operation 550, the processor (320) may perform an error report. For non-limiting examples, the error report may include various information, such as whether an error occurred while performing an operation, what type of error occurred, and the execution process and result of the operation in which the error occurred.
[0083] FIG. 6 is an exemplary flowchart illustrating a method for determining whether high-speed storage is used, according to one embodiment.
[0084] The operations illustrated in FIG. 6 may include detailed operations of operation 510 of FIG. 5. The operations illustrated in FIG. 6 may be performed sequentially, but are not necessarily performed sequentially. For example, the order of the operations may be changed, and at least two operations may be performed in parallel or substantially simultaneously. Optionally or alternatively, some of the operations illustrated in FIG. 6 may be omitted.
[0085] Referring to FIG. 6, in operation 610, the processor (320) may check configuration information regarding whether high-speed storage is used. For example, the processor (320) may use configuration information regarding whether the second storage (334) is used in relation to the database file (440) (or the database) to check whether management of the database file (440) using the second storage (334) among the first storage (332) or the second storage (334) is permitted. For example, whether high-speed storage is used may be set by changing the library code of the database manager (420). In another example, whether high-speed storage is used may be set by setting the build environment (configuration) of the library of the database manager (420). In one embodiment, the configuration information regarding whether high-speed storage is used may be stored in an in-memory form. For example, setting information on whether to use high-speed storage may be stored in volatile memory of memory (330) (e.g., volatile memory (132) of FIG. 1).
[0086] In operation 620, the processor (320) may determine whether the use of high-speed storage is required. For example, the processor (320) may determine whether the use of high-speed storage is required using the configuration information regarding the use of high-speed storage, which was confirmed in operation 610. If it is determined that the use of high-speed storage is required (operation 620: Yes), operation 630 may be performed, and if not, operation 550 of FIG. 5 may be performed.
[0087] In operation 630, the processor (320) may check whether the journal mode of the database file (440) (or the database) is a rollback journal mode. For example, the processor (320) may transmit a command to check the journal mode of the database from the application (410) to the database manager (420). Through this, the processor (320) may check whether the journal mode of the database is a rollback journal mode. In operation 630, if it is confirmed that the journal mode of the database file (440) is a rollback journal mode (operation 630: Yes), operation 640 may be performed. In operation 630, if it is confirmed that the journal mode of the database file (440) is not a rollback journal mode (operation 630: No), operation 650 may be performed. For example, in operation 630, if the journal mode of the database file (440) is determined to be WAL mode rather than rollback journal mode (operation 630: No), operation 650 may be performed.
[0088] In operation 640, the processor (320) may determine whether the available capacity of the high-speed storage is sufficient based on the database file size. For example, the processor (320) may determine whether the available capacity of the second storage (334) exceeds the size of the database file (440). If the available capacity of the second storage (334) exceeds the size of the database file (440), the processor (320) may determine that the available capacity of the high-speed storage is sufficient. If the available capacity of the second storage (334) does not exceed the size of the database file (440), the processor (320) may determine that the available capacity of the high-speed storage is insufficient. If it is determined in operation 640 that the available capacity of the high-speed storage is sufficient (operation 640: Yes), operation 520 of FIG. 5 may be performed. Otherwise (action 640: No), action 650 may be performed. The available capacity of the storage may be capacity that is not occupied by files and folders.
[0089] At step 650, the processor (320) may review the available capacity of the high-speed storage. For example, the processor (320) may determine whether the ratio of the available capacity to the total capacity of the second storage (334) exceeds a threshold. For example, the threshold may be, but is not limited to, 10%.
[0090] At operation 660, the processor (320) may determine whether the available capacity of the high-speed storage is sufficient. For example, at operation 650, if it is determined that the available capacity of the second storage (334) exceeds the threshold, the processor (320) may determine that the available capacity of the high-speed storage is sufficient. At operation 650, if it is determined that the available capacity of the second storage (334) does not exceed the threshold, the processor (320) may determine that the available capacity of the high-speed storage is insufficient.
[0091] In operation 660, if it is determined that the available capacity of the high-speed storage is sufficient (operation 660: Yes), operation 520 of FIG. 5 may be performed, and if not (operation 660: No), operation 550 of FIG. 5 may be performed. For example, in operation 660, if it is determined that the available capacity of the high-speed storage is not sufficient (operation 660: No), operation 550 of FIG. 5 may be performed.
[0092] FIG. 7 is an exemplary flowchart illustrating a method for creating a journal directory of high-speed storage according to one embodiment.
[0093] The operations illustrated in FIG. 7 may include detailed operations of operation 520 of FIG. 5. The operations illustrated in FIG. 7 may be performed sequentially, but are not necessarily performed sequentially. For example, the order of the operations may be changed, and at least two operations may be performed in parallel or substantially simultaneously. Optionally or alternatively, some of the operations illustrated in FIG. 7 may be omitted.
[0094] Referring to FIG. 7, in operation 710, the processor (320) may replace the journal directory path with a path of high-speed storage. For example, the processor (320) may replace (or change) the journal directory path where the database file (440) is stored from the path of the first storage (332) to the path of the second storage (334). For example, the processor (320) may directly designate the path of the second storage (334) and store the designated path as the journal directory path of the database file (440) (or the database) in the memory (330) (e.g., the non-volatile memory (134) of FIG. 1). As another example, the processor (320) may check the file system partition of the first storage (332) and the file system partition of the second storage (334) that are currently being used as the journal directory path. The processor (320) can replace a partition of the first storage (332) of the journal directory path of the database file (440) with a partition of the second storage (334). For example, if the / data partition is a partition using the first storage (332) and the / fast partition is a partition using the second storage (334), the journal directory path can be replaced from / data / data / com.example.pacakge / databases, which is a path of the first storage (332), to / fast / data / com.example.package / databases, which is a path within the second storage (334).
[0095] In operation 720, the processor (320) can check whether a parent folder exists. For example, the processor (320) can check whether a parent folder exists among the folders in the second storage (334) corresponding to the journal directory path set in operation 710.
[0096] In operation 720, if it is determined that a folder corresponding to the path of the journal directory exists (operation 730: Yes), operation 740 may be performed, otherwise, operation 760 may be performed.
[0097] In operation 740, the processor (320) can check whether a subfolder exists. For example, the processor (320) can check whether a subfolder of the folder identified as existing in operation 720 or a subfolder of the folder created in operation 760 exists in the second storage (334).
[0098] In operation 750, the processor (320) may check whether all folders exist. For example, the processor (320) may check whether all folders corresponding to the journal directory path set in operation 710 exist in the second storage (334). In operation 750, if it is confirmed that all folders exist in the second storage (334), operation 540 of FIG. 5 may be performed, and if not, operation 720 may be performed. In operation 720 performed after operation 750, the processor (320) may check whether the topmost folder among the folders confirmed not to exist in operation 750 exists in the second storage (334).
[0099] In operation 760, the processor (320) may create a folder. For example, the processor (320) may create a folder that is determined not to exist in operation 730 in the second storage (334). For example, the database path of the application (410) may be in the form of / data / data / [package path] / databases / [database file name]. In this case, only applications and services having a user ID corresponding to [package path] can access the database path. For example, the database path of the application (410) may be / data / data / com.example.pacakge / databases / test.db, and the path and subfolders and files of / data / data / com.example.pacakge can all be accessed only by the user ID of com.example.package. Using this, the processor (320) can create a folder in the second storage (334) with a path corresponding to the journal directory path of the first storage (332) so that it has the same authority (e.g., user ID) as the application (410).
[0100] If the creation of the folder is successful in operation 760 (operation 770: Yes), operation 740 may be performed. If the creation of the folder is unsuccessful in operation 760 (operation 770: No), operation 550 of FIG. 5 may be performed.
[0101] FIG. 8 is an exemplary flowchart illustrating a method for checking journal file path information according to one embodiment.
[0102] The operations illustrated in FIG. 8 may be performed sequentially, but are not necessarily performed sequentially. For example, the order of the operations may be changed, and at least two operations may be performed in parallel or substantially simultaneously. Optionally or alternatively, some of the operations illustrated in FIG. 8 may be omitted.
[0103] If a problem occurs while journal information is being written to the secondary storage (334), a rollback operation may be required to stop the current transaction and restore the data of the database file (440) to its previous state. To perform the rollback operation, information about the journal file (450) may be required. Due to reasons such as a process kill, the path information where the journal file (450) is stored in the memory (330) of the electronic device (301) may not be available. In FIG. 8, a method for checking the journal file path information to perform the rollback operation is described.
[0104] Referring to FIG. 8, in operation 810, the processor (320) can determine whether high-speed storage is in use. For operation 810, the description of the operations of FIG. 6 can be applied in a substantially identical or corresponding manner.
[0105] In operation 810, if it is determined that high-speed storage is being used (operation 820: Yes), operation 830 may be performed. For example, if operation 620 of FIG. 6 is determined as 'Yes', operation 830 may be performed.
[0106] In operation 810, if it is determined that high-speed storage is not being used (operation 820: No), operation 860 may be performed. For example, if operation 620 of FIG. 6 is determined as 'No', operation 860 may be performed. For another example,
[0107] In operation 830, the processor (320) can check the journal file path information. For example, it can check the existence of an xattr of the database file (440) or another file (e.g., test.db-journalpath) in which journal file path information is stored, and check the journal file path of the database file (440) through the file.
[0108] In operation 840, the processor (320) may check whether journal file path information is set. For example, if the journal file path of the database file (440) is confirmed in operation 830 (operation 840: Yes), operation 850 may be performed. If the journal file path of the database file (440) is not confirmed in operation 830 (operation 840: No), operation 860 may be performed. In operation 850, the processor (320) may access the journal file stored in the high-speed storage. For example, the processor (320) may access the journal file (450) stored in the second storage (334) using the journal file path of the database file (440) confirmed in operation 830.
[0109] In operation 860, the processor (320) may access a journal file stored in legacy storage. For example, the processor (320) may access the journal file stored in the first storage (332) using information about the path of the first storage (332) where the database file (440) is stored.
[0110] FIG. 9 is an exemplary flowchart illustrating a method for processing transactions using high-speed storage in rollback journal mode, according to one embodiment.
[0111] The operations illustrated in FIG. 9 may be performed sequentially, but are not necessarily performed sequentially. For example, the order of the operations may be changed, and at least two operations may be performed in parallel or substantially simultaneously. Optionally or alternatively, some of the operations illustrated in FIG. 9 may be omitted.
[0112] Referring to FIG. 9, at operation 910, the processor (320) may initiate a write transaction in rollback journal mode. For example, the processor (320) may perform a write transaction on data of a database file (440) in rollback journal mode at the request of the application (410).
[0113] At operation 920, the processor (320) may write data to a rollback journal file. For example, after high-speed storage journaling is set by performing the operations of FIG. 5, the processor (320) may create a journal file (450) containing original data of the database file (440) in the second storage (334), or write the original data of the database file (440) to the journal file (450) stored in the second storage (334). Alternatively, when high-speed storage journaling is not set, the processor (320) may create a journal file (450) containing original data of the database file (440) in the first storage (332), or write the original data of the database file (440) to the journal file (450) stored in the first storage (332).
[0114] At operation 930, the processor (320) can determine whether writing data to the rollback journal file was successful. If writing data to the rollback journal file was successful at operation 920 (operation 930: Yes), operation 940 may be performed. Conversely, if writing data to the rollback journal file failed at operation 920 (operation 930: No), operation 960 may be performed.
[0115] At operation 940, the processor (320) may determine whether the journal file (450) is a high-speed storage path. For example, the processor (320) may determine whether the path where the journal file (450) is stored is a path of the second storage (334). If it is determined at operation 940 that the journal file (450) is a high-speed storage path (operation 940: Yes), operation 950 may be performed. Otherwise (operation 940: No), the performance of the operation may be terminated.
[0116] In operation 950, the processor (320) may write rollback journal file path information. For example, the processor (320) may record the path where the journal file (450) is stored in the xattr of the database file (440) or another file (e.g., test.db-journalpath) where the rollback journal file path information is stored. The information about the path where the journal file (450) is stored recorded in operation 950 may be used to check the journal file path information in operation 830 of FIG. 8.
[0117] If the result is 'No' in operation 940 or after operation 950 is performed, the processor (320) may perform a commit operation, and the journal file (450) stored in the first storage (332) or the second storage (334) may be processed depending on the setting of the rollback journal mode (e.g., delete, truncate, or persist) at the time of commit.
[0118] At operation 960, the processor (320) may determine whether the rollback journal file is a fast storage path and the failure to write data is due to an insufficient capacity error. For example, if the journal file (450) is a path of the second storage (334) and an ENOSPC error occurs in a write system call, the processor (320) may determine that the failure to write data is due to an insufficient available capacity of the second storage (334). At operation 960, if it is determined that the rollback journal file is a fast storage path and the failure to write data is due to an insufficient capacity error (operation 960: Yes), operation 970 may be performed. Otherwise (operation 960: No), operation 990 may be performed.
[0119] In operation 970, the processor (320) may switch the rollback journal file path. For example, the processor (320) may change the path (e.g., the journal directory path of operation 710 of FIG. 7) in which the journal file (450) according to the transaction of the database file (440) is stored from a path in the second storage (334) to a path in the first storage (332). Although not illustrated, before switching the path of the rollback journal file in operation 970, the processor (320) may copy the journal file stored in the path of the second storage (334) to the path of the first storage (332). If the copying operation is successful, operation 970 may be performed, and if not, operation 990 may be performed. If operation 970 is successful (operation 980: Yes), the processor (320) may delete the journal file copied to the path of the first storage (332).
[0120] If the rollback journal file path switching in operation 970 is successful (operation 980: Yes), the processor (320) may perform operation 920. Conversely, if the rollback journal file path switching in operation 970 fails (operation 980: No), the processor (320) may perform operation 990.
[0121] At operation 990, the processor (320) may perform an error report. For operation 990, the description provided with reference to operation 550 of FIG. 5 may be substantially identically applied.
[0122] In one embodiment, if no error occurs while writing the original page to the rollback journal file (e.g., operation 930 - Yes), the operation may be performed in the same manner as in the existing rollback journal mode, and the journal file may be processed according to the rollback journal mode (e.g., delete, truncate, persist, etc.) at the commit time when all operations are completed. If an error occurs while writing the original page to the rollback journal file (e.g., operation 930 - No), it may be determined whether the error is due to insufficient capacity, as in operation 960.
[0123] FIG. 10 is an exemplary flowchart illustrating a method for generating a journal file in WAL mode according to one embodiment.
[0124] The operations illustrated in FIG. 10 may be performed sequentially, but are not necessarily performed sequentially. For example, the order of the operations may be changed, and at least two operations may be performed in parallel or substantially simultaneously. Optionally or alternatively, some of the operations illustrated in FIG. 10 may be omitted.
[0125] Referring to FIG. 10, at operation 1010, the processor (320) may initiate the generation of a journal file (e.g., a WAL file) in WAL mode. For example, the processor (320) may initiate the generation of a WAL file in WAL mode at the request of an application (410) to connect or open a database file (440).
[0126] In operation 1020, the processor (320) can check whether high-speed storage (e.g., second storage (334)) is in use. For example, the processor (320) can check whether the second storage (334) is in use by checking a flag (or set value) indicating whether the second storage (334) is activated, which is stored in operation 540 of FIG. 5. For example, if the set value (e.g., '1') indicates activation of the second storage (334), the processor (320) can check that the high-speed storage is in use, and if not (e.g., if the set value is '0'), the processor (320) can check that the high-speed storage is not in use.
[0127] In operation 1020, if it is determined that high-speed storage is being used (operation 1020: Yes), operation 1030 may be performed, otherwise (operation 1020: No), operation 1040 may be performed.
[0128] In operation 1030, the processor (320) may create WAL file path information. The description of operation 1030 may be applied in a substantially identical or corresponding manner to the description provided with reference to operation 950 of FIG. 9. The WAL file path information created in operation 1030 may be confirmed through operation 830 of FIG. 8.
[0129] At operation 1040, the processor (320) may create a WAL file. For example, if it is determined that high-speed storage is used at operation 1020, the processor (320) may create a journal file (450) within the second storage (334). As another example, if it is determined that high-speed storage is not used at operation 1020, the processor (320) may create a journal file (450) within the first storage (332).
[0130] If the creation of the WAL file in operation 1040 is successful (operation 1050: Yes), the execution of the operation can be terminated. Unlike the city, if the creation of the WAL file in operation 1040 is successful (operation 1050: Yes), operation 1110 of FIG. 11 can be performed. If the creation of the WAL file in operation 1040 fails (operation 1050: No), operation 1060 can be performed.
[0131] At operation 1060, the processor (320) may perform an error report. For operation 1060, the description provided with reference to operation 990 of FIG. 9 may be substantially identically applied.
[0132] FIG. 11 is an exemplary flowchart illustrating a method of processing a transaction using high-speed storage in WAL mode according to one embodiment.
[0133] In one embodiment, WAL mode can write modified page data, rather than the original data, to a WAL file. For example, modified pages may be written to a WAL file at the commit point when a transaction is completed or at the reclaim point when the cached page is unloaded to free up memory. As described below, in situations where high-speed storage capacity is insufficient, the WAL file path can be changed to legacy storage, and the WAL file can then be written to the legacy storage.
[0134] The operations illustrated in Figure 11 may be performed sequentially, but are not necessarily performed sequentially. For example, the order of the operations may be changed, and at least two operations may be performed in parallel or substantially simultaneously. Optionally or alternatively, some of the operations illustrated in Figure 11 may be omitted.
[0135] Referring to FIG. 11, at operation 1110, the processor (320) may initiate a write transaction in WAL mode. For example, the processor (320) may perform a write transaction for a database file (440) in WAL mode at the request of the application (410).
[0136] In operation 1120, the processor (320) can determine whether a path change of the WAL file is necessary by pre-reviewing the capacity of the high-speed storage. Operation 1120 is described in detail with reference to FIG. 12. If it is determined in operation 1120 that a path change of the WAL file is not necessary (operation 1130: No), operation 1140 may be performed. Conversely, if it is determined in operation 1120 that a path change of the WAL file is necessary (operation 1130: Yes), operation 1170 may be performed.
[0137] In operation 1140, the processor (320) may write data to a WAL file. For example, the processor (320) may write data according to a transaction to a journal file (450) stored in the second storage (334). The journal file (450) may be created in the second storage (334) by performing operation 1040 of FIG. 10 .
[0138] If writing data to the WAL file at operation 1140 fails (operation 1150: No), operation 1160 may be performed. Alternatively, if writing data to the WAL file at operation 1140 succeeds (operation 1150: Yes), the write transaction operation may be terminated.
[0139] In operation 1160, the processor (320) may determine whether the WAL file is a high-speed storage path (e.g., a path of the second storage (334)) and whether the failure to write data is due to insufficient capacity. For operation 1160, the description of operation 960 of FIG. 9 may be applied in a substantially identical or corresponding manner. In operation 1160, if it is determined that the WAL file is a high-speed storage path and the failure to write data is due to an insufficient capacity error (operation 1160: Yes), operation 1170 may be performed. Otherwise (operation 1160: No), operation 1190 may be performed.
[0140] In operation 1170, the processor (320) may change the WAL file path. For example, the processor (320) may change the path (e.g., the journal directory path of operation 710 of FIG. 7) in which the journal file (450) in which data changes according to transactions of the database file (440) are recorded is stored, from a path within the second storage (334) to a path within the first storage (332). Operation 1170 will be described in detail with reference to FIG. 13.
[0141] If the WAL file path switching is successful in operation 1170 (operation 1180: Yes), the processor (320) may perform operation 1140. Conversely, if the WAL file path switching is unsuccessful in operation 1170 (operation 1180: No), the processor (320) may perform operation 1190.
[0142] At operation 1190, the processor (320) may perform an error report. For operation 1190, the description provided with reference to operation 990 of FIG. 9 may be substantially identically applied.
[0143] In operation 1140, which is performed after the determination of 'yes' in operation 1108, the processor (320) may write data according to the transaction to a journal file (450) within the path changed in operation 1170 (e.g., the path within the first storage (332)).
[0144] FIG. 12 is an exemplary flowchart illustrating a method for determining whether a path change of a journal file is required by pre-examining the capacity of high-speed storage according to one embodiment.
[0145] The operations illustrated in FIG. 12 may include detailed operations of operation 1120 of FIG. 11. The operations illustrated in FIG. 12 may be performed sequentially, but are not necessarily performed sequentially. For example, the order of the operations may be changed, and at least two operations may be performed in parallel or substantially simultaneously. Optionally or alternatively, some of the operations illustrated in FIG. 12 may be omitted.
[0146] Referring to FIG. 12, in operation 1210, the processor (320) may check whether a WAL file exists in the high-speed storage path. For example, since the WAL mode writes changed page data to the WAL file at the time of transaction termination or cache reclaim, the processor (320) may check whether a WAL file exists or the number of pages to be written before writing the changed page data. For example, the processor (320) may check whether a journal file (450) exists in the second storage (334). If the processor (320) determines that the WAL exists in the high-speed storage path (operation 1210: Yes), the processor (320) may perform operation 1220, and if not, the processor may determine that changing the path of the WAL file is not necessary (operation 1130: No).
[0147] In operation 1220, the processor (320) may calculate the capacity required for writing using the dirty list. For example, the processor (320) may parse the data of the dirty list to determine the number of pages to be written. The processor (320) may calculate the size of each page. For example, the size of each page may be the sum of the size of one WAL frame header (e.g., 24 bytes) and the size of the page (e.g., 4096 bytes). For example, when a WAL file is written for the first time, an additional capacity equivalent to the size of the WAL file header (e.g., 32 bytes) may be required. The processor (320) may calculate the capacity required for writing by multiplying the size of each page by the number of pages.
[0148] In operation 1230, the processor (320) may determine whether the available capacity of the high-speed storage is sufficient based on the capacity required for writing. For example, if the available capacity of the second storage (334) exceeds the capacity required for writing calculated in operation 1220, the processor (320) may determine that the available capacity of the high-speed storage is sufficient (operation 1230: Yes). If the available capacity of the second storage (334) does not exceed the capacity required for writing calculated in operation 1220, the processor (320) may determine that the available capacity of the high-speed storage is insufficient (operation 1230: No). If it is determined in operation 1230 that the available capacity of the storage is sufficient (operation 1230: Yes), operation 1250 may be performed. At operation 1250, the processor (320) may determine that a change in the path of the WAL file is not necessary (operation 1130: No).
[0149] In operation 1230, if it is determined that the available storage capacity is insufficient (operation 1230: No), operation 1240 may be performed. In operation 1240, the processor (320) may determine that a path change of the WAL file is required (operation 1130: Yes).
[0150] Figure 13 is an exemplary flowchart illustrating a method for changing a journal file path in WAL mode according to an example.
[0151] The operations illustrated in FIG. 13 may include detailed operations of operation 1170 of FIG. 11. The operations illustrated in FIG. 13 may be performed sequentially, but are not necessarily performed sequentially. For example, the order of the operations may be changed, and at least two operations may be performed in parallel or substantially simultaneously. Optionally or alternatively, some of the operations illustrated in FIG. 13 may be omitted.
[0152] Referring to FIG. 13, in operation 1310, the processor (320) may perform a checkpoint up to a previous transaction. For example, the processor (320) may perform a checkpoint up to a transaction prior to the transaction detected in operation 1110 of FIG. 11. Data up to a transaction prior to the current transaction may already be stored in the WAL file. According to one embodiment, since the processor (320) can check data up to a previous transaction, it may perform a WAL checkpoint on changed pages up to the corresponding transaction in the database.
[0153] If the checkpoint is successfully performed in operation 1310 (operation 1315: Yes), operation 1320 may be performed; otherwise (operation 1315: No), operation 1355 may be performed. For example, if a read transaction is in progress, the checkpoint lock may not be acquired, causing the checkpoint to fail.
[0154] At operation 1320, the processor (320) may open a WAL file in legacy storage. For example, the processor (320) may open a journal file (450) stored in the first storage (332).
[0155] In operation 1325, the processor (320) may write data according to the current transaction. For example, the processor (320) may write data according to the transaction of operation 1110 of FIG. 11 to the journal file (450) opened in operation 1320.
[0156] If the writing of data according to the current transaction is successful in operation 1325 (operation 1330: Yes), operation 1335 may be performed, otherwise (operation 1330: No), operation 1190 of FIG. 11 may be performed.
[0157] In operation 1335, the processor (320) may perform an update of WAL journal file information. For example, the processor (320) may update the WAL journal file information to indicate that the first storage (332) is being used rather than the second storage (334).
[0158] At operation 1340, the processor (320) may change the WAL file path to legacy storage (e.g., first storage (332)). Through this, changes to data resulting from transactions after the current timing may be stored in the WAL file within the first storage (332).
[0159] In operation 1345, the processor (320) may delete a WAL file of high-speed storage. For example, the processor (320) may delete a journal file (450) stored in the second storage (334). If the deletion of the WAL file in operation 1345 is successful (operation 1350: Yes), operation 1140 may be performed, and if not (operation 1350: No), operation 1190 of FIG. 11 may be performed.
[0160] In operation 1355, the processor (320) may copy the WAL file to legacy storage. In operation 1355, if the copying of the WAL file is successful (operation 1360: Yes), operation 1335 may be performed. Otherwise (operation 1360: No), operation 1190 of FIG. 11 may be performed. FIG. 14 is an exemplary flowchart illustrating a method for updating journal information in WAL mode according to one embodiment.
[0161] The operations illustrated in Figure 14 may be performed sequentially, but are not necessarily performed sequentially. For example, the order of the operations may be changed, and at least two operations may be performed in parallel or substantially simultaneously. Optionally or alternatively, some of the operations illustrated in Figure 14 may be omitted.
[0162] In rollback journal mode, since original data is written to the journal file, it may be necessary to record the path of the journal file at least at the time of commit. In contrast, in WAL mode, since new changed data exists in the WAL file and the WAL file must be accessed by a read transaction, information about the WAL file path may need to be stored in advance. Accordingly, unlike rollback journal mode, in WAL mode, the location of the WAL journal file may need to be updated when the WAL file is first opened (when the WAL index file is created). With reference to FIG. 14 below, the operations for updating the location of the WAL journal file will be described.
[0163] In operation 1410, the processor (320) may determine whether a WAL index file has been created. The WAL index file may store an index of the WAL file. The WAL index file may provide an index for efficiently searching records of database changes stored in the WAL file. The WAL index file may be stored in the same path as the database file. The processor (320) may check whether the WAL index file exists in the path of the database file. For example, if it is the first time that a WAL file is opened, the WAL index file may not have been created, and if not, the WAL index file may have been created. If it is determined in operation 1410 that the WAL index file has been created (operation 1410: Yes), operation 1450 may be performed, and if not, operation 1420 may be performed.
[0164] In operation 1420, the processor (320) can check whether high-speed storage is in use. In operation 1420, the processor (320) can check whether high-speed storage (e.g., second storage (334)) is in use. For example, the processor (320) can check whether the second storage (334) is in use by checking a flag (or setting value) indicating whether the second storage (334) is activated, which is stored through operation 540 of FIG. 5. For example, if the setting value (e.g., '1') indicates activation of the second storage (334), the processor (320) can check that the high-speed storage is in use, and if not (e.g., if the setting value is '0'), the processor (320) can check that the high-speed storage is not in use. At operation 1420, if it is determined that high-speed storage is being used (operation 1430: Yes), operation 14400 may be performed, otherwise (operation 1430: No), operation 1450 may be performed.
[0165] In operation 1450, the processor (320) may update WAL journal file information. For example, the processor (320) may update the path of the journal file (450) recorded in the xattr of the database file (440) or another file (e.g., test.db-journalpath) in which rollback journal file path information is stored, to the path of the second storage (334), which is a high-speed storage.
[0166] In operation 1450, the processor (320) may open a WAL file. For example, if operation 1410 is determined as 'yes', the processor (320) may open a previously stored WAL file. For example, if operation 1430 is determined as 'no', the processor (320) may create a WAL file in the path of the first storage (332), which is a legacy storage. For example, after performing operation 1440, the processor (320) may create a WAL file in the path of the second storage (334), which is a high-speed storage. If the opening of the WAL file in operation 1450 is successful (operation 1460: yes), the operation may be terminated, and if not (operation 1460: no), operation 1470 may be performed.
[0167] At operation 1470, the processor (320) may perform an error report. For operation 1470, the description provided with reference to operation 990 of FIG. 9 may be substantially identically applied.
[0168] According to one embodiment, an electronic device (e.g., the electronic device (301) of FIG. 4) may include a memory (e.g., the memory (330) of FIG. 3), which includes a first storage (e.g., the first storage (332) of FIG. 4) and a second storage (e.g., the second storage (334) of FIG. 4) having a faster access speed than the first storage (e.g., the first storage (332) of FIG. 4); and a processor (e.g., the processor (320) of FIG. 3). Instructions stored in the memory, when executed by the processor, may cause the electronic device to determine, using information related to a database stored in the memory, whether a read and write operation of the database using the second storage among the first storage or the second storage is granted. The instructions stored in the memory may, when executed by the processor, cause the electronic device to execute a function that generates journal information related to the database stored in the first storage in the second storage based on confirmation that the authorization has been granted. The instructions stored in the memory may, when executed by the processor, cause the electronic device to, based on execution of the function, update the journal information stored in the second storage according to a transaction related to the database based on the journal information stored in the second storage. The instructions stored in the memory may, when executed by the processor, cause the electronic device to, based on execution of the function, generate the journal information in the first storage based on confirmation that the journal information has not been generated in the second storage by execution of the function.
[0169] In one embodiment, the instructions stored in the memory, when executed by the processor, may cause the electronic device to determine whether the available capacity of the second storage satisfies a specified criterion in response to confirming that the electronic device has been granted the authority to perform write and read operations of the database using the second storage. The instructions stored in the memory, when executed by the processor, may cause the electronic device to set a path for storing journal information related to the database to the second storage if it is determined that the available capacity of the second storage satisfies the specified criterion.
[0170] In one embodiment, the instructions stored in the memory, when executed by the processor, may cause the electronic device to set a path in which the journal information is stored to the first storage to generate the journal information related to the database in the first storage based on the determination that the journal information is not generated in the second storage by the execution of the function.
[0171] In one embodiment, the instructions stored in the memory may, when executed by the processor, cause the electronic device to, in response to determining that the journal information was generated in the second storage by execution of the function, determine whether the path where the journal information is stored corresponds to the second storage. The instructions stored in the memory may, when executed by the processor, cause the electronic device to, in response to determining that the path where the journal information is stored corresponds to the second storage, store information about the path in the first storage.
[0172] In one embodiment, the instructions stored in the memory, when executed by the processor, may cause the electronic device to determine whether the available capacity of the second storage satisfies a specified criterion in response to confirming that the authority to perform write and read operations of the database using the second storage has been granted. The instructions stored in the memory, when executed by the processor, may cause the electronic device to create the journal information in the second storage if it determines that the available capacity of the second storage satisfies the specified criterion, and to store information about a path in which the journal information is stored in the first storage. The instructions stored in the memory, when executed by the processor, may cause the electronic device to create the journal information in the first storage if it determines that the available capacity of the second storage does not satisfy the specified criterion.
[0173] In one embodiment, the instructions stored in the memory may, when executed by the processor, cause the electronic device to determine, based on detecting a transaction related to the database, whether the available capacity of the second storage exceeds the capacity of data according to the transaction. The instructions stored in the memory may, when executed by the processor, cause the electronic device to record data according to the transaction in the journal information stored in the second storage, based on determining that the available capacity of the second storage exceeds the capacity of the data according to the transaction.
[0174] In one embodiment, the instructions stored in the memory may, when executed by the processor, cause the electronic device to change the database according to data related to another transaction prior to the transaction, recorded in the journal information stored in the second storage, based on determining that the available capacity of the second storage does not exceed the capacity of the data related to the transaction. The instructions stored in the memory may, when executed by the processor, cause the electronic device to, when determined that the database has been changed according to the data related to the other transaction, record data related to the transaction in other journal information stored in the first storage and associated with the database. The instructions stored in the memory may, when executed by the processor, cause the electronic device to, when determined that the database has been changed according to the data related to the other transaction, change a path in which journal information related to the database is stored from the second storage to the first storage.
[0175] In one embodiment, the instructions stored in the memory may, when executed by the processor, cause the electronic device to store a copy of the journal information stored in the second storage within the first storage based on a determination that the database has not been modified based on the data related to the other transaction. The instructions stored in the memory may, when executed by the processor, cause the electronic device to change a path in which journal information related to the database is stored from the second storage to the first storage based on a determination that the database has not been modified based on the data related to the other transaction.
[0176] In one embodiment, the transaction for changing data in the database may include a write transaction.
[0177] In one embodiment, the second storage may be mounted within the electronic device.
[0178] In one embodiment, the instructions stored in the memory, when executed by the processor, may cause the electronic device to determine, using the information related to the database stored in the memory, whether storing the journal information related to the database in the second storage among the first storage or the second storage is permitted.
[0179] In one embodiment, the journal information may include information about changes to the database caused by the transaction.
[0180] In one embodiment, a lack of available capacity of the second storage may cause a failure to create the journal information in the second storage.
[0181] In one embodiment, an electronic device (e.g., electronic device (301) of FIG. 4) may include a memory (e.g., memory (330) of FIG. 3) and a processor (e.g., processor (320) of FIG. 3) including a first storage area (e.g., first storage (332) of FIG. 4) and a second storage area (e.g., second storage (334) of FIG. 4) having a faster access speed than the first storage area. Instructions stored in the memory, when executed by the processor, may cause the electronic device to determine, using information related to a database stored in the memory, whether management of the database using the second storage area among the first storage area or the second storage area is permitted. The instructions stored in the memory may cause the processor, when executed by the processor, to execute a function of generating journal information related to the database stored in the first storage area in the second storage area based on a determination that management of the database using the second storage area is permitted. The instructions stored in the memory may cause the processor, when executed by the processor, to update the journal information stored in the second storage area according to a transaction related to the database based on the journal information stored in the second storage area based on the execution of the function. The instructions stored in the memory may cause the processor, when executed by the processor, to generate the journal information in the first storage area based on a determination that the journal information was not generated in the second storage area by the execution of the function.
[0182] In one embodiment, a method performed by an electronic device (e.g., the electronic device (301) of FIG. 4) including a memory that includes a first storage (e.g., the first storage (332) of FIG. 4) and a second storage (e.g., the second storage (334) of FIG. 4) having a faster access speed than the first storage may include an operation of determining, using information related to a database stored in the memory, whether management of the database using the second storage among the first storage or the second storage is permitted. The method may include an operation of executing a function of generating journal information related to the database stored in the first storage in the second storage based on determining that management of the database using the second storage is permitted. The method may include an operation of updating the journal information stored in the second storage according to a transaction related to the database based on the execution of the function, based on the journal information stored in the second storage. The method may include an operation of generating the journal information in the first storage based on the execution of the function, based on the determination that the journal information is not generated in the second storage by the execution of the function.
[0183] In one embodiment, the method may include, in response to determining that managing the database using the second storage is permitted, determining whether available capacity of the second storage satisfies a specified criterion. The method may include, if determining that the available capacity of the second storage satisfies the specified criterion, setting a path in which journal information related to the database is stored to the second storage. The method may include, based on determining that the journal information is not created in the second storage by execution of the function, setting a path in which the journal information is stored to the first storage to create the journal information related to the database in the first storage.
[0184] In one embodiment, the method may include, in response to determining that the journal information has been created in the second storage by the execution of the function, an operation of determining whether a path in which the journal information is stored is a path within the second storage. The method may include, in response to determining that the path in which the journal information is stored is a path within the second storage, an operation of storing information about the path within the second storage in the first storage.
[0185] In one embodiment, the method may include, in response to confirming that managing the database using the second storage is permitted, determining whether available capacity of the second storage satisfies a specified criterion. If the method determines that the available capacity of the second storage satisfies the specified criterion, the method may include creating the journal information within the second storage and storing information about a path in which the journal information is stored within the first storage. If the method determines that the available capacity of the second storage does not satisfy the specified criterion, the method may include creating the journal information within the first storage.
[0186] In one embodiment, the method may include an operation of determining whether the available capacity of the second storage exceeds the capacity of data according to the transaction based on detecting a transaction related to the database. The method may include an operation of recording data according to the transaction in the journal information stored in the second storage based on determining that the available capacity of the second storage exceeds the capacity of the data according to the transaction. The method may include an operation of modifying the database according to data up to another transaction prior to the transaction, recorded in the journal information stored in the second storage, based on determining that the available capacity of the second storage does not exceed the capacity of the data according to the transaction. The method may include an operation of recording data according to the transaction in another journal information related to the database and stored in the first storage based on determining that the database has been modified according to the data up to the another transaction prior to the transaction, recorded in the journal information. The method may include an operation of changing a path in which journal information related to the database is stored from the second storage to the first storage.
[0187] In one embodiment, a computer-readable storage medium may store one or more programs. The one or more programs, when executed by a processor of an electronic device (e.g., the electronic device (301) of FIG. 4) including a memory (e.g., the memory (330) of FIG. 3) including a first storage (e.g., the first storage (332) of FIG. 4) and a second storage (e.g., the second storage (334) of FIG. 4) having a faster access speed than the first storage, may cause the electronic device to determine, using information related to a database stored in the memory, whether management of the database using the second storage among the first storage or the second storage is permitted. The one or more programs, when executed by the processor, may cause the electronic device to execute a function of generating journal information related to the database stored in the first storage in the second storage based on determining that management of the database using the second storage is permitted. The one or more programs, when executed by the processor, may cause the electronic device to update the journal information stored in the second storage according to a transaction related to the database, based on the execution of the function, based on the journal information stored in the second storage. The one or more programs, when executed by the processor, may cause the electronic device to create the journal information in the first storage based on the determination that the journal information is not created in the second storage by the execution of the function.
[0188] Electronic devices according to the various embodiments disclosed in this document may take various forms. Electronic devices may include, for example, portable communication devices (e.g., smartphones), computer devices, portable multimedia devices, portable medical devices, cameras, wearable devices, or home appliances. Electronic devices according to the embodiments disclosed in this document are not limited to the aforementioned devices.
[0189] The various embodiments of this document and the terminology used therein are not intended to limit the technical features described in this document to specific embodiments, but should be understood to include various modifications, equivalents, or substitutes of the embodiments. In connection with the description of the drawings, similar reference numerals may be used for similar or related components. The singular form of a noun corresponding to an item may include one or more of the items, unless the context clearly indicates otherwise. In this document, each of the phrases "A or B", "at least one of A and B", "at least one of A or B", "A, B, or C", "at least one of A, B, and C", and "at least one of A, B, or C" can include any one of the items listed together in the corresponding phrase among those phrases, or all possible combinations thereof. Terms such as "first," "second," or "first" or "second" may be used merely to distinguish one component from another, and do not limit the components in any other respect (e.g., importance or order). When a component (e.g., a first component) is referred to as "coupled" or "connected" to another component (e.g., a second component), with or without the terms "functionally" or "communicatively," it means that the component can be connected to the other component directly (e.g., wired), wirelessly, or through a third component.
[0190] The term "module" used in various embodiments of this document may include a unit implemented in hardware, software, or firmware, and may be used interchangeably with terms such as logic, logic block, component, or circuit. A module may be an integral component, or a minimum unit or part of such a component that performs one or more functions. For example, according to one embodiment, a module may be implemented in the form of an application-specific integrated circuit (ASIC).
[0191] Various embodiments of the present document may be implemented as software (e.g., a program (140)) including one or more commands stored in a storage medium (e.g., an internal memory (136) or an external memory (138)) readable by a machine (e.g., an electronic device (101)). For example, a processor (e.g., a processor (120)) of the machine (e.g., an electronic device (101)) may call at least one command among the one or more commands stored from the storage medium and execute it. This enables the machine to operate to perform at least one function according to the at least one command called. The one or more commands may include code generated by a compiler or code executable by an interpreter. The machine-readable storage medium may be provided in the form of a non-transitory storage medium. Here, 'non-transitory' simply means that the storage medium is a tangible device and does not contain signals (e.g., electromagnetic waves), and the term does not distinguish between cases where data is stored semi-permanently or temporarily on the storage medium.
[0192] According to one embodiment, the method according to the various embodiments disclosed in the present document may be provided as included in a computer program product. The computer program product may be traded as a product between a seller and a buyer. The computer program product may be distributed in the form of a machine-readable storage medium (e.g., compact disc read only memory (CD-ROM)), or may be distributed online (e.g., downloaded or uploaded) via an application store (e.g., Play Store™) or directly between two user devices (e.g., smart phones). In the case of online distribution, at least a portion of the computer program product may be temporarily stored or temporarily generated in a machine-readable storage medium, such as the memory of a manufacturer's server, an application store's server, or an intermediary server.
[0193] According to various embodiments, each component (e.g., a module or a program) of the above-described components may include one or more entities, and some of the entities may be separated and placed in other components. According to various embodiments, one or more components or operations of the aforementioned components may be omitted, or one or more other components or operations may be added. Alternatively or additionally, a plurality of components (e.g., a module or a program) may be integrated into a single component. In such a case, the integrated component may perform one or more functions of each of the plurality of components identically or similarly to those performed by the corresponding component among the plurality of components prior to the integration. According to various embodiments, the operations performed by a module, program, or other component may be executed sequentially, in parallel, iteratively, or heuristically, or one or more of the operations may be executed in a different order, omitted, or one or more other operations may be added.
Claims
1. In an electronic device (301), A memory (330) including a first storage (332) and a second storage (334) having a faster access speed than the first storage (332); and Contains a processor (320), The instructions stored in the above memory (330), when executed by the processor, cause the electronic device (301) to: Using information related to the database stored in the above memory (330), it is checked whether permission is granted to perform read and write operations of the database using the second storage (334) among the first storage (332) or the second storage (334); Based on the confirmation that the above authority has been granted, a function of generating journal information related to the database stored in the first storage (332) in the second storage (334) is executed; and Based on the execution of the above functions: Based on the journal information stored in the second storage (334), updating the journal information stored in the second storage (334) according to a transaction related to the database; and Based on the determination that the journal information is not created in the second storage (334) by the execution of the function, causing the journal information to be created in the first storage (332). Electronic devices.
2. In claim 1, The instructions stored in the above memory (330), when executed by the processor, cause the electronic device (301) to: In response to confirming that the above authority has been granted, determining whether the available capacity of the second storage (334) satisfies the specified criteria; and If it is determined that the available capacity of the second storage (334) satisfies the above-mentioned criteria, the path where the journal information related to the database is stored is set to the second storage (334). Electronic devices.
3. In claim 1 or claim 2, The instructions stored in the above memory (330), when executed by the processor, cause the electronic device (301) to: An electronic device that causes a path in which the journal information is stored to be set to the first storage (332), so as to create the journal information related to the database in the first storage (332), based on the determination that the journal information is not created in the second storage (334) by the execution of the function.
4. In any one of claims 1 to 3, The instructions stored in the above memory (330), when executed by the processor, cause the electronic device (301) to: In response to determining that the journal information has been created in the second storage (334) by the execution of the function, determining whether the path where the journal information is stored corresponds to the second storage (334); and In response to confirming that the path where the above journal information is stored corresponds to the second storage (334), causing information about the path to be stored in the first storage (332). Electronic devices.
5. In claim 1, The instructions stored in the above memory (330), when executed by the processor, cause the electronic device (301) to: In response to confirming that the above authority has been granted, determine whether the available capacity of the second storage (334) satisfies the specified criteria; If it is determined that the available capacity of the second storage (334) satisfies the specified criteria, the journal information is created in the second storage (334), and information about the path where the journal information is stored is stored in the first storage (332); and If it is determined that the available capacity of the second storage (334) does not satisfy the specified criteria, causing the journal information to be generated in the first storage (332), Electronic devices.
6. In claim 1 or claim 5, The instructions stored in the above memory (330), when executed by the processor, cause the electronic device (301) to: Based on detecting a transaction related to the above database, determining whether the available capacity of the second storage (334) exceeds the capacity of data according to the transaction; and Based on determining that the available capacity of the second storage (334) exceeds the capacity of the data according to the transaction, causing the data according to the transaction to be recorded in the journal information stored in the second storage (334). Electronic devices.
7. In claim 6, The instructions stored in the above memory (330), when executed by the processor, cause the electronic device (301) to: Based on determining that the available capacity of the second storage (334) does not exceed the capacity of the data according to the transaction, changing the database according to data related to another transaction prior to the transaction, recorded in the journal information stored in the second storage (334); and Based on the verification that said database has been changed based on said data related to said other transaction: Recording data according to the transaction in other journal information related to the above database and stored in the first storage (332); and Causing the path where journal information related to the above database is stored to be changed from the second storage (334) to the first storage (332). Electronic devices.
8. In claim 7, The instructions stored in the above memory (330), when executed by the processor, cause the electronic device (301) to: Based on the verification that the said database has not been altered according to the said data related to the said other transaction: Storing a copy of the journal information stored in the second storage (334) in the first storage (332); and Causing the path where journal information related to the above database is stored to be changed from the second storage (334) to the first storage (332). Electronic devices.
9. In any one of claims 6 to 8, The transaction for changing the data of the above database includes a write transaction, Electronic devices.
10. In any one of claims 1 to 9, The above second storage (334) is mounted within the electronic device (301). Electronic devices.
11. In any one of claims 1 to 10, The instructions stored in the above memory (330), when executed by the processor, cause the electronic device (301) to: Using the information related to the database stored in the memory (330), it is determined whether it is permitted to store the journal information related to the database in the second storage (334) among the first storage (332) or the second storage (334). Electronic devices.
12. In claim 1, The above journal information includes information about changes to the database caused by the above transaction, The lack of available capacity of the second storage (334) causes the failure of creation of the journal information in the second storage (334). Electronic devices.
13. A method performed by an electronic device (301) including a memory including a first storage (332) and a second storage (334) having a faster access speed than the first storage (332), An operation of using information related to a database stored in the memory (330) to check whether management of the database using the second storage (334) among the first storage (332) or the second storage (334) is permitted; An operation of executing a function of generating journal information related to the database stored in the first storage (332) in the second storage (334) based on verifying that it is permitted to manage the database using the second storage (334); Based on the execution of the above functions: An operation of updating the journal information stored in the second storage (334) according to a transaction related to the database based on the journal information stored in the second storage (334); and An operation of generating the journal information in the first storage (332) based on the determination that the journal information is not generated in the second storage (334) by the execution of the function. method.
14. In claim 13, The above method, In response to confirming that it is permitted to manage the database using the second storage (334), an operation of determining whether the available capacity of the second storage (334) satisfies a specified criterion; If it is determined that the available capacity of the second storage (334) satisfies the specified criteria, an operation of setting the path where journal information related to the database is stored to the second storage (334); and An operation of setting a path where the journal information is stored to the first storage (332) to generate the journal information related to the database in the first storage (332) based on the confirmation that the journal information is not generated in the second storage (334) by the execution of the function; method.
15. In a computer-readable storage medium having one or more programs stored therein, The above one or more programs, when executed by a processor of an electronic device (301) including a memory (330) including a first storage (332) and a second storage (334) (334) having a faster access speed than the first storage (332), cause the electronic device (301) to: Using information related to the database stored in the above memory (330), it is confirmed whether management of the database using the second storage (334) among the first storage (332) or the second storage (334) is permitted; Based on the confirmation that it is permitted to manage the database using the second storage (334), a function of creating journal information related to the database stored in the first storage (332) in the second storage (334) is executed; and Based on the execution of the above functions: Based on the journal information stored in the second storage (334), updating the journal information stored in the second storage (334) according to a transaction related to the database; and Based on the determination that the journal information is not created in the second storage (334) by the execution of the function, causing the journal information to be created in the first storage (332). Computer readable storage medium.
Citation Information
Patent Citations
Journal output system
JP1997062553A
Historical Information Management Method for Online Database System
JP2804504B2
Database management apparatus and method
KR101669722B1
Storage system and writing method thereof
KR1020150018682A
Electronic apparatus and method for journaling file data thereof
KR1020170136366A