mirror of
				https://github.com/ClusterCockpit/cc-metric-store.git
				synced 2025-11-04 02:35:08 +01:00 
			
		
		
		
	Merge branch 'main' into hotfix
This commit is contained in:
		
							
								
								
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -25,3 +25,6 @@ test.creds
 | 
			
		||||
migrateTimestamps.pl
 | 
			
		||||
test_ccms_api.sh
 | 
			
		||||
test_ccms_free_api.sh
 | 
			
		||||
test_ccms_write_api.sh
 | 
			
		||||
sample_alex.txt
 | 
			
		||||
sample_fritz.txt
 | 
			
		||||
@@ -313,7 +313,20 @@ func decodeLine(dec *lineprotocol.Decoder,
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if t, err = dec.Time(lineprotocol.Second, t); err != nil {
 | 
			
		||||
			return fmt.Errorf("host %s: timestamp : %#v with error : %#v", host, lineprotocol.Second, err.Error())
 | 
			
		||||
			t = time.Now()
 | 
			
		||||
			if t, err = dec.Time(lineprotocol.Millisecond, t); err != nil {
 | 
			
		||||
				t = time.Now()
 | 
			
		||||
				if t, err = dec.Time(lineprotocol.Microsecond, t); err != nil {
 | 
			
		||||
					t = time.Now()
 | 
			
		||||
					if t, err = dec.Time(lineprotocol.Nanosecond, t); err != nil {
 | 
			
		||||
						return fmt.Errorf("host %s: timestamp : %#v with error : %#v", host, t, err.Error())
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return fmt.Errorf("host %s: timestamp : %#v with error : %#v", host, t, err.Error())
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if err := ms.WriteToLevel(lvl, selector, t.Unix(), []memorystore.Metric{metric}); err != nil {
 | 
			
		||||
 
 | 
			
		||||
@@ -268,6 +268,15 @@ func (l *Level) toCheckpoint(dir string, from, to int64, m *MemoryStore) error {
 | 
			
		||||
// This function can only be called once and before the very first write or read.
 | 
			
		||||
// Different host's data is loaded to memory in parallel.
 | 
			
		||||
func (m *MemoryStore) FromCheckpoint(dir string, from int64) (int, error) {
 | 
			
		||||
	if _, err := os.Stat(dir); os.IsNotExist(err) {
 | 
			
		||||
		// The directory does not exist, so create it using os.MkdirAll()
 | 
			
		||||
		err := os.MkdirAll(dir, 0755) // 0755 sets the permissions for the directory
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			log.Fatalf("Error creating directory: %#v\n", err)
 | 
			
		||||
		}
 | 
			
		||||
		fmt.Printf("%#v Directory created successfully.\n", dir)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	var wg sync.WaitGroup
 | 
			
		||||
	work := make(chan [2]string, NumWorkers)
 | 
			
		||||
	n, errs := int32(0), int32(0)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user